diff --git a/xiaofang/Assets/Res/gsj/scripts/Drill.cs b/xiaofang/Assets/Res/gsj/scripts/Drill.cs index 48b5a5fe..ca619b7c 100644 --- a/xiaofang/Assets/Res/gsj/scripts/Drill.cs +++ b/xiaofang/Assets/Res/gsj/scripts/Drill.cs @@ -31,7 +31,7 @@ public class Drill : MonoBehaviour noRoomText.gameObject.SetActive(false); // 初始隐藏文本 content = transform.Find("Mid/Scroll View/Viewport/Content"); - if(GlobalData.ServerData.data.isCreater=="N") + if(GlobalData.ServerData.data.isCreater=="Y") { username.text = $"[{GlobalData.ServerData.data.userId}](管理员)"; } diff --git a/xiaofang/Assets/Res/gsj/scripts/ReadRoom.cs b/xiaofang/Assets/Res/gsj/scripts/ReadRoom.cs index 6f9523b7..3a3c6cc9 100644 --- a/xiaofang/Assets/Res/gsj/scripts/ReadRoom.cs +++ b/xiaofang/Assets/Res/gsj/scripts/ReadRoom.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.Analytics; using UnityEngine.SceneManagement; using UnityEngine.UI; @@ -15,6 +16,7 @@ public class ReadRoom : MonoBehaviour public bool isenter=false;//主持人进入 public bool isadministrator = false;//是否是管理员 private bool isStartRoom = false;//主持人是否已经点击演练开始 + public bool iszongzhihui = false; // Start is called before the first frame update void Start() { @@ -44,8 +46,33 @@ public class ReadRoom : MonoBehaviour { Debug.LogError(1); SceneManager.LoadScene("yhj"); - isadministrator=true; + isadministrator=false; + }else + { + isadministrator = true; ; } + foreach(var item in response.Data) + { + foreach(var item1 in item.PlayerList) + { + if(GlobalData.ServerData.data.userId==item1.UserId) + { + if(item1.RoleId==8000)//主持人 + { + isenter=true; + } + else if(item1.RoleId == 8001)//总指挥 + { + iszongzhihui=true; + } + else + { + isenter = false; + } + } + } + } + roomDataList = response.Data; Debug.Log($"获取到的房间数量:{roomDataList.Count}"); // 获取当前日期 @@ -71,6 +98,7 @@ public class ReadRoom : MonoBehaviour //Player.CSZS.SetPlayerID(room.PlayerList[i].RoleId); Debug.Log("可以直接进入房间"); SceneManager.LoadScene("Tmap 1"); + //if(GlobalData.ServerData.data.openId==) isenter = true; found = true; // 找到匹配用户 ID break; // 直接跳出循环 @@ -80,14 +108,14 @@ public class ReadRoom : MonoBehaviour else { Debug.Log("主持人点击了开始演练,但没有进入场景,要进入大厅房间"); - SceneManager.LoadScene("yhj"); + //SceneManager.LoadScene("yhj"); break; } // 如果没有找到匹配的用户 ID,跳转到 "yhj" 场景 if (!found) { Debug.Log("未找到匹配用户 ID,跳转到场景 'yhj'"); - SceneManager.LoadScene("yhj"); + //SceneManager.LoadScene("yhj"); break; } // 如果找到了匹配房间,不需要再检查其他房间 @@ -96,7 +124,7 @@ public class ReadRoom : MonoBehaviour else { Debug.Log("状态不是 '进行中',跳转到场景 'yhj'"); - SceneManager.LoadScene("yhj"); + //SceneManager.LoadScene("yhj"); break; } } diff --git a/xiaofang/Assets/Res/gsj/scripts/Starthost.cs b/xiaofang/Assets/Res/gsj/scripts/Starthost.cs index adb93748..2e180706 100644 --- a/xiaofang/Assets/Res/gsj/scripts/Starthost.cs +++ b/xiaofang/Assets/Res/gsj/scripts/Starthost.cs @@ -5,6 +5,8 @@ using UnityEngine.UI; using System.Threading.Tasks; using UnityEngine.SceneManagement; using Unity.VisualScripting; +using System.Runtime.CompilerServices; + public class Starthost : MonoBehaviour { // 定义委托事件 @@ -35,7 +37,7 @@ public class Starthost : MonoBehaviour private GameObject peopleposition;//人员的位置信息 //非主持人的画面 public bool ishost=false; - private Button ready; + public Button ready; private Image image; //语音内容 @@ -58,9 +60,8 @@ public class Starthost : MonoBehaviour audioSource= GetComponent(); // 确保对讲机图标默认隐藏 walkieTalkieIcon.SetActive(false); - - - right=transform.Find("Panel1/right").gameObject; + ishost = ReadRoom.instance.isenter; + right =transform.Find("Panel1/right").gameObject; panel = transform.Find("Panel1").gameObject; posiBtn = transform.Find("Panel1/right/under/btnRenYuanDaoWei").GetComponent