diff --git a/xiaofang/Assets/Res/gsj/scripts/ReadRoom.cs b/xiaofang/Assets/Res/gsj/scripts/ReadRoom.cs index 3a3c6cc9..782ab6a1 100644 --- a/xiaofang/Assets/Res/gsj/scripts/ReadRoom.cs +++ b/xiaofang/Assets/Res/gsj/scripts/ReadRoom.cs @@ -17,6 +17,7 @@ public class ReadRoom : MonoBehaviour public bool isadministrator = false;//是否是管理员 private bool isStartRoom = false;//主持人是否已经点击演练开始 public bool iszongzhihui = false; + public int RoleId; // Start is called before the first frame update void Start() { @@ -57,6 +58,7 @@ public class ReadRoom : MonoBehaviour { if(GlobalData.ServerData.data.userId==item1.UserId) { + RoleId= item1.RoleId; if(item1.RoleId==8000)//主持人 { isenter=true; @@ -70,6 +72,7 @@ public class ReadRoom : MonoBehaviour isenter = false; } } + } } diff --git a/xiaofang/Assets/Script/UI/ZZZZZZ/ZZZPlayer.cs b/xiaofang/Assets/Script/UI/ZZZZZZ/ZZZPlayer.cs index f8a5cd2a..b98882ff 100644 --- a/xiaofang/Assets/Script/UI/ZZZZZZ/ZZZPlayer.cs +++ b/xiaofang/Assets/Script/UI/ZZZZZZ/ZZZPlayer.cs @@ -11,7 +11,8 @@ public class ZZZPlayer : MonoBehaviour public static ZZZPlayer CSZS; public JSONReader jSONReader; public Dictionary> CSB1 = new Dictionary>(); //Key是判断是不是一组,string是ID tanchuang1用的 - public bool isYou=true; + public bool isYou = true; + public bool isHYL=false; public void Start() { @@ -30,7 +31,16 @@ public class ZZZPlayer : MonoBehaviour //} } - + public void Update() + { + isHYL=ReadRoom.instance.iszongzhihui; + } + + private void Awake() + { + CSZS = this; + } + //初始化字典 public Dictionary> PlayerID = new Dictionary>() { { "8000", new List() }, @@ -47,10 +57,6 @@ public class ZZZPlayer : MonoBehaviour { "8011", new List() } }; - private void Awake() - { - CSZS = this; - } /// /// 接收玩家接受的任务 /// @@ -106,7 +112,7 @@ public class ZZZPlayer : MonoBehaviour foreach (var item in jSONReader.ZZSelectsDictionary) { Select data = item.Value; - if (data.AppliedUI == "tanchuang1") + if (data.AppliedUI == Type) { var a = GetNumberBeforeComma(data.Group); @@ -136,22 +142,7 @@ public class ZZZPlayer : MonoBehaviour // 获取所有 Value List allValues = GetAllValues(CSB1); Debug.Log("所有的 Values: " + string.Join(", ", allValues)); - //foreach (var kvp in CSB1) - //{ - // int key = kvp.Key; - // string value = kvp.Value; - - // // 分割 Value 字符串为多个部分 - // List valueList = new List(value.Split(',')); - - // Debug.Log($"Key {key} 包含的值:{string.Join(", ", valueList)}"); - - // // 遍历分割后的值并逐个传递 - // foreach (string item in valueList) - // { - // Debug.Log(key+"_"+item); - // } - //} + } #region 测试 @@ -177,6 +168,21 @@ public class ZZZPlayer : MonoBehaviour return allValues; } + /// + /// 获取指定 Key 对应的所有 Value + /// + private List GetValuesForKey(int key) + { + if (CSB1.ContainsKey(key)) + { + return CSB1[key]; // 返回对应的值列表 + } + else + { + Debug.LogWarning($"Key {key} 不存在于字典中!"); + return null; + } + } #endregion public bool IsNumberInData(string data, int number) {