提交一下获取职业ID

This commit is contained in:
林小智丶 2024-12-28 14:50:56 +08:00
parent 5dcc934ab2
commit c3fc4b7c0b
2 changed files with 32 additions and 23 deletions

View File

@ -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;
}
}
}
}

View File

@ -11,7 +11,8 @@ public class ZZZPlayer : MonoBehaviour
public static ZZZPlayer CSZS;
public JSONReader jSONReader;
public Dictionary<int, List<string>> CSB1 = new Dictionary<int,List<string>>(); //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<string, List<string>> PlayerID = new Dictionary<string, List<string>>()
{
{ "8000", new List<string>() },
@ -47,10 +57,6 @@ public class ZZZPlayer : MonoBehaviour
{ "8011", new List<string>() }
};
private void Awake()
{
CSZS = this;
}
/// <summary>
/// 接收玩家接受的任务
/// </summary>
@ -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<string> allValues = GetAllValues(CSB1);
Debug.Log("所有的 Values: " + string.Join(", ", allValues));
//foreach (var kvp in CSB1)
//{
// int key = kvp.Key;
// string value = kvp.Value;
// // 分割 Value 字符串为多个部分
// List<string> valueList = new List<string>(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;
}
/// <summary>
/// 获取指定 Key 对应的所有 Value
/// </summary>
private List<string> 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)
{