选房间 yhj

This commit is contained in:
liuliang 2024-12-27 23:12:22 +08:00
parent 98865a9ca3
commit 9c71a751ba
11 changed files with 161 additions and 31 deletions

View File

@ -5,6 +5,8 @@ using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class Drill : MonoBehaviour
{
public Text username;
public Text companyName;
private Button ScheduledBtn;
private bool isadministrator=false; // 是否为管理员
private bool eventAdded = false; // 防止重复添加事件
@ -17,6 +19,9 @@ public class Drill : MonoBehaviour
// 记录上一次的 isadministrator 状态,用于减少重复执行逻辑
private bool lastIsAdministratorState;
void Start()
{
ScheduledBtn = transform.Find("down/ScheduledBtn").GetComponent<Button>();
@ -26,7 +31,12 @@ public class Drill : MonoBehaviour
noRoomText.gameObject.SetActive(false); // 初始隐藏文本
content = transform.Find("Mid/Scroll View/Viewport/Content");
if(GlobalData.ServerData.data.isCreater=="N")
{
username.text = $"[{GlobalData.ServerData.data.userId}](管理员)";
}
else username.text = $"[{GlobalData.ServerData.data.userId}]";
companyName.text = "所属机构:[" + GlobalData.ServerData.data.companyName +"]";
}
void Update()

View File

@ -38,9 +38,11 @@ public class ReadRoom : MonoBehaviour
if (response != null && response.Data != null)
{
if(GlobalData.ServerData.data.isCreater == "Y")
Debug.LogError(GlobalData.ServerData.data.isCreater);
if(GlobalData.ServerData.data.isCreater == "N")
{
SceneManager.LoadScene("yhj");
Debug.LogError(1);
SceneManager.LoadScene(1);
isadministrator=true;
}
roomDataList = response.Data;
@ -67,7 +69,7 @@ public class ReadRoom : MonoBehaviour
//传人物职业ID
//Player.CSZS.SetPlayerID(room.PlayerList[i].RoleId);
Debug.Log("可以直接进入房间");
SceneManager.LoadScene("Tmap 1");
//SceneManager.LoadScene("Tmap 1");
isenter = true;
found = true; // 找到匹配用户 ID
break; // 直接跳出循环

View File

@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor.SearchService;
//using System.Drawing;
using UnityEngine;
using UnityEngine.SceneManagement;
@ -78,7 +79,10 @@ public class RoomManager : MonoBehaviour
}
// 添加 RoomDataHolder 脚本并存储数据
Status dataHolder = roomItem.GetComponent<Status>();
dataHolder.SetRoomData(room.RoomId, room.SceneId, room.SubjectId, room.TemplateId, room.Status);
dataHolder.text.text = $"[{js.SetUIText(room.SceneId)}][{js.SetUIText(room.SubjectId)}]";
Debug.Log(js.SetUIText(room.SceneId));
Debug.Log(dataHolder.text.text);
dataHolder.SetRoomData(room.RoomId, room.SceneId, room.SubjectId, room.TemplateId, room.Status, room.ReserveDate);
// 获取当前日期
DateTime currentDate = DateTime.Now;

View File

@ -4,6 +4,9 @@ using UnityEngine;
using UnityEngine.UI;
using System.Threading.Tasks;
using UnityEngine.SceneManagement;
using System;
public class Status : MonoBehaviour
{
private Button button;
@ -28,19 +31,19 @@ public class Status : MonoBehaviour
private string scenename;//场景名
private string accidenttype;//事故类型
private Text text;//场景名加事故类型的文本
private Text timetext;//房间时间文本
public Text text;//场景名加事故类型的文本
public Text timetext;//房间时间文本
private gameRoomList gameRoomListInstance; // 引用 gameRoomList 脚本实例
private List<GameRoomListData> roomDataList; // 保存获取到的房间列表
public JSONReader JSONReader;
public string RoomId;
public string status;
public string TemplateId;
public string SceneId;
public string SubjectId;
// Start is called before the first frame update
void Start()
void Awake()
{
button=GetComponent<Button>();
button.onClick.AddListener(OnClickBtn);
@ -61,7 +64,7 @@ public class Status : MonoBehaviour
drill=GameObject.Find("Panel").GetComponent<Drill>();
drill.OnBoolAChanged += OnBoolAChanged;
text=transform.Find("down/detail").GetComponent<Text>();
timetext=transform.Find("up/date").GetComponent <Text>();
// 查找场景中的 gameRoomList 脚本实例
@ -69,13 +72,19 @@ public class Status : MonoBehaviour
isadministrator = ReadRoom.instance.isadministrator;
}
public void SetRoomData(string roomId, string sceneId, string subjectId, string templateId, string statu)
public void SetRoomData(string roomId, string sceneId, string subjectId, string templateId, string statu,string time)
{
RoomId = roomId;
SceneId = sceneId;
SubjectId = subjectId;
TemplateId = templateId;
status = statu;
Debug.Log(sceneId);
Debug.Log(subjectId);
DateTime currentDate = Convert.ToDateTime(time);
timetext.text = $"{currentDate.Month}月{currentDate.Day}日";
}
// 调试方法

View File

@ -1665,8 +1665,8 @@ MonoBehaviour:
isEnd: 0
isOngoing: 0
isScheduled: 0
isadministrator: 1
drill: {fileID: 0}
timetext: {fileID: 6282968326833298297}
RoomId:
status:
TemplateId:

View File

@ -8689,6 +8689,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
currentItem: {fileID: 0}
Xfs: {fileID: 0}
_skill_Pick: {fileID: 0}
_skill_Jump: {fileID: 0}
_skill_Watering: {fileID: 0}
@ -8724,6 +8725,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
CharacterAnimator: {fileID: 1948499803}
player: {fileID: 382802812}
xfs: {fileID: 0}
relativePosition: {x: 0, y: 0, z: 0}
relativeRotation: {x: 0, y: 0, z: 0}
pickUpRange: 2
@ -13395,10 +13397,66 @@ PrefabInstance:
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1036384108419493601, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1036384108419493601, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1036384108419493601, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1036384108419493601, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1036384108419493601, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1036384108419493601, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1139272851256039431, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1407198451904434455, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1407198451904434455, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1407198452705769409, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1407198452705769409, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1407198452705769409, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1407198452705769409, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1407198452705769409, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1407198452705769409, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1809610721369072280, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@ -13463,6 +13521,14 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3032695105273604146, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3032695105273604146, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3032695105467395617, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
@ -13567,6 +13633,30 @@ PrefabInstance:
propertyPath: m_Name
value: FreePanel_End
objectReference: {fileID: 0}
- target: {fileID: 4030979446590429124, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4030979446590429124, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4030979446590429124, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4030979446590429124, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4030979446590429124, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4030979446590429124, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4030979447516607306, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@ -27670,6 +27760,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 8f4189fe310885b45b10fb435499ae64, type: 3}
m_Name:
m_EditorClassIdentifier:
isPlayerInRange: 0
extinguishTime: 3
fireHurt: 10
dis: 0
@ -33355,6 +33446,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 919949400, guid: 807d6c3842cc1714caf2b4497e4daed7, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 948396698034575733, guid: 807d6c3842cc1714caf2b4497e4daed7, type: 3}
propertyPath: m_AnchorMax.y
value: 0

View File

@ -777,10 +777,10 @@ GameObject:
- component: {fileID: 423561711}
- component: {fileID: 423561713}
- component: {fileID: 423561714}
- component: {fileID: 423561715}
- component: {fileID: 423561716}
- component: {fileID: 423561717}
- component: {fileID: 423561718}
- component: {fileID: 423561719}
m_Layer: 5
m_Name: Panel
m_TagString: Untagged
@ -851,18 +851,6 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &423561715
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 423561710}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5e5a05a2a1e8fc54f84494c10939f22a, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &423561716
MonoBehaviour:
m_ObjectHideFlags: 0
@ -902,6 +890,20 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 92f8778f7c80dcc4ba76a40411a6fa9c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &423561719
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 423561710}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5e5a05a2a1e8fc54f84494c10939f22a, type: 3}
m_Name:
m_EditorClassIdentifier:
username: {fileID: 1776157176}
companyName: {fileID: 2086101897}
--- !u!1 &423928793
GameObject:
m_ObjectHideFlags: 0
@ -2855,6 +2857,8 @@ MonoBehaviour:
isOngoing: 0
isScheduled: 0
drill: {fileID: 0}
timetext: {fileID: 0}
JSONReader: {fileID: 0}
RoomId:
status:
TemplateId:
@ -2918,6 +2922,8 @@ MonoBehaviour:
isOngoing: 0
isScheduled: 0
drill: {fileID: 0}
timetext: {fileID: 0}
JSONReader: {fileID: 0}
RoomId:
status:
TemplateId:
@ -3591,8 +3597,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5067708, y: 0.6095164}
m_AnchoredPosition: {x: -660.65857, y: -29.1529}
m_SizeDelta: {x: 508.1311, y: 35.9645}
m_AnchoredPosition: {x: -604.8165, y: -29.1529}
m_SizeDelta: {x: 603.2648, y: 35.9645}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1776157176
MonoBehaviour:
@ -3738,6 +3744,8 @@ MonoBehaviour:
isOngoing: 0
isScheduled: 0
drill: {fileID: 0}
timetext: {fileID: 0}
JSONReader: {fileID: 0}
RoomId:
status:
TemplateId:
@ -5128,7 +5136,7 @@ GameObject:
- component: {fileID: 3977981761658744020}
- component: {fileID: 3977981761658744021}
m_Layer: 0
m_Name: GameObject
m_Name: JSON
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

View File

@ -25,7 +25,7 @@ public class PlayerTask : MonoBehaviour
Debug.Log(1111111111111111111);
Debug.Log(id);
TaskPanel.instance.displaytask(id);
Player.CSZS.SetPlayerID(id.ToString());
ZZZPlayer.CSZS.SetPlayerID(id.ToString());
}
}

View File

@ -8,7 +8,7 @@ public class Test : MonoBehaviour
void Start()
{
//Player.CSZS.SetPlayerID("主持人", "123");
List<string> strings = Player.CSZS.GetPlayerID("主持人");
List<string> strings = ZZZPlayer.CSZS.GetPlayerID("主持人");
Debug.Log("aaaaa"+strings[0]);
}

View File

@ -350,7 +350,7 @@ public class ZZUIManager : MonoBehaviour
{
isHidden = true;
instert = this;
TimeText.text = "00.00";
//TimeText.text = "00.00";
num = 0;
}
private void Start()

View File

@ -73,6 +73,8 @@ public class LoginPanel : Base
}
else if(id.text == "13051628292" && pwd.text == "ZF16c788632")
{
//SceneManager.LoadScene("yhj");
ReadRoom.instance.head();
}
else