Compare commits

...

2 Commits

Author SHA1 Message Date
lq
26e6f4e6d1 Merge branch 'main' of http://shu.sheziwanglo.cn:3000/wulongxiao/_xiaofang 2024-12-12 20:01:23 +08:00
lq
0e0fe09cbc Language传入 2024-12-12 19:58:55 +08:00
4 changed files with 225 additions and 193 deletions

View File

@ -1,170 +1,182 @@
[ [
{ {
"ID": 8000, "ID": "8000",
"Note": "主持人", "Note": "主持人",
"Name": "2001,8001|2002,8001|2003,80022", "Name": "2001,1,8000|2001,2,8000|2001,6,8000",
"ActionMode": 0, "ActionMode": "0",
"Group": -1, "Group": "-1",
"GroupLeader": 3, "GroupLeader": "3",
"IsLeadingNPC": 0, "IsLeadingNPC": "0",
"ICON": "ICON_312", "ICON": "ICON_312",
"WeightLimit": -1, "WeightLimit": "-1",
"Stats": "1,4.5|2,2|3,1|4,0|5,0|6,100", "Stats": "-1",
"Skills": "4001,-1|4003,202|4005,-1", "Skills": "4001,-1|4003,202|4005,-1",
"ResPath": "\\ASSETS\\b013.Prefeb" "ResPath": "\\ASSETS\\b013.Prefeb",
}, "ManageLevel": "-1"
{ },
"ID": 8001, {
"Note": "总指挥", "ID": "8001",
"Name": "2001,8001|2002,8001|2003,80010", "Note": "总指挥",
"ActionMode": 2, "Name": "2001,1,8001|2001,2,8001|2001,6,8001",
"Group": -1, "ActionMode": "2",
"GroupLeader": 2, "Group": "-1",
"IsLeadingNPC": 0, "GroupLeader": "2",
"ICON": "ICON_313", "IsLeadingNPC": "0",
"WeightLimit": 6, "ICON": "ICON_313",
"Stats": "1,4.5|2,2|3,1|4,0|5,0|6,100", "WeightLimit": "5",
"Skills": "4001,-1|4003,202|4005,-1", "Stats": "1,6.5|2,1.8|3,1|6,100",
"ResPath": "\\ASSETS\\b001.Prefeb" "Skills": "4001,-1|4003,202|4005,-1",
}, "ResPath": "\\ASSETS\\b001.Prefeb",
{ "ManageLevel": "-1"
"ID": 8002, },
"Note": "抢险救援组", {
"Name": "2001,8001|2002,8001|2003,80011", "ID": "8002",
"ActionMode": 2, "Note": "抢险救援组",
"Group": 8003, "Name": "2001,1,8002|2001,2,8002|2001,6,8002",
"GroupLeader": 0, "ActionMode": "2",
"IsLeadingNPC": 0, "Group": "8003",
"ICON": "ICON_314", "GroupLeader": "0",
"WeightLimit": 6, "IsLeadingNPC": "0",
"Stats": "1,4.5|2,2|3,1|4,0|5,0|6,100", "ICON": "ICON_314",
"Skills": "4001,-1|4003,202|4005,-1", "WeightLimit": "5",
"ResPath": "\\ASSETS\\b002.Prefeb" "Stats": "1,6.5|2,1.8|3,1|6,100",
}, "Skills": "4001,-1|4003,202|4005,-1",
{ "ResPath": "\\ASSETS\\b002.Prefeb",
"ID": 8003, "ManageLevel": "-1"
"Note": "(组长)抢险救援组", },
"Name": "2001,8001|2002,8001|2003,80012", {
"ActionMode": 2, "ID": "8003",
"Group": -1, "Note": "(组长)抢险救援组",
"GroupLeader": 1, "Name": "2001,1,8003|2001,2,8003|2001,6,8003",
"IsLeadingNPC": 0, "ActionMode": "2",
"ICON": "ICON_315", "Group": "-1",
"WeightLimit": 6, "GroupLeader": "1",
"Stats": "1,4.5|2,2|3,1|4,0|5,0|6,100", "IsLeadingNPC": "0",
"Skills": "4001,-1|4003,202|4005,-1", "ICON": "ICON_315",
"ResPath": "\\ASSETS\\b003.Prefeb" "WeightLimit": "5",
}, "Stats": "1,6.5|2,1.8|3,1|6,100",
{ "Skills": "4001,-1|4003,202|4005,-1",
"ID": 8004, "ResPath": "\\ASSETS\\b003.Prefeb",
"Note": "医疗救护组", "ManageLevel": "-1"
"Name": "2001,8001|2002,8001|2003,80013", },
"ActionMode": 2, {
"Group": 8005, "ID": "8004",
"GroupLeader": 0, "Note": "医疗救护组",
"IsLeadingNPC": 0, "Name": "2001,1,8004|2001,2,8004|2001,6,8004",
"ICON": "ICON_316", "ActionMode": "2",
"WeightLimit": 6, "Group": "8005",
"Stats": "1,4.5|2,2|3,1|4,0|5,0|6,100", "GroupLeader": "0",
"Skills": "4001,-1|4003,202|4005,-1", "IsLeadingNPC": "0",
"ResPath": "\\ASSETS\\b004.Prefeb" "ICON": "ICON_316",
}, "WeightLimit": "5",
{ "Stats": "1,6.5|2,1.8|3,1|6,100",
"ID": 8005, "Skills": "4001,-1|4003,202|4005,-1",
"Note": "(组长)医疗救护组", "ResPath": "\\ASSETS\\b004.Prefeb",
"Name": "2001,8001|2002,8001|2003,80014", "ManageLevel": "-1"
"ActionMode": 2, },
"Group": -1, {
"GroupLeader": 1, "ID": "8005",
"IsLeadingNPC": 0, "Note": "(组长)医疗救护组",
"ICON": "ICON_317", "Name": "2001,1,8005|2001,2,8005|2001,6,8005",
"WeightLimit": 6, "ActionMode": "2",
"Stats": "1,4.5|2,2|3,1|4,0|5,0|6,100", "Group": "-1",
"Skills": "4001,-1|4003,202|4005,-1", "GroupLeader": "1",
"ResPath": "\\ASSETS\\b005.Prefeb" "IsLeadingNPC": "0",
}, "ICON": "ICON_317",
{ "WeightLimit": "5",
"ID": 8006, "Stats": "1,6.5|2,1.8|3,1|6,100",
"Note": "疏散引导组1", "Skills": "4001,-1|4003,202|4005,-1",
"Name": "2001,8001|2002,8001|2003,80015", "ResPath": "\\ASSETS\\b005.Prefeb",
"ActionMode": 1, "ManageLevel": "-1"
"Group": 8001, },
"GroupLeader": 0, {
"IsLeadingNPC": 1, "ID": "8006",
"ICON": "ICON_318", "Note": "疏散引导组1",
"WeightLimit": -1, "Name": "2001,1,8005|2001,2,8005|2001,6,8999",
"Stats": "1,4.5|2,2|3,1|4,0|5,0|6,100", "ActionMode": "1",
"Skills": "4001,-1|4003,202|4005,-1", "Group": "8001",
"ResPath": "\\ASSETS\\b006.Prefeb" "GroupLeader": "0",
}, "IsLeadingNPC": "1",
{ "ICON": "ICON_318",
"ID": 8007, "WeightLimit": "-1",
"Note": "疏散引导组2", "Stats": "1,6.5|2,1.8|3,1|6,100",
"Name": "2001,8001|2002,8001|2003,80016", "Skills": "4001,-1|4003,202|4005,-1",
"ActionMode": 1, "ResPath": "\\ASSETS\\b006.Prefeb",
"Group": 8001, "ManageLevel": "-1"
"GroupLeader": 0, },
"IsLeadingNPC": 1, {
"ICON": "ICON_319", "ID": "8007",
"WeightLimit": -1, "Note": "疏散引导组2",
"Stats": "1,4.5|2,2|3,1|4,0|5,0|6,100", "Name": "2002,1,8007|2002,2,8007|2002,3,8999",
"Skills": "4001,-1|4003,202|4005,-1", "ActionMode": "2",
"ResPath": "\\ASSETS\\b007.Prefeb" "Group": "8001",
}, "GroupLeader": "0",
{ "IsLeadingNPC": "1",
"ID": 8008, "ICON": "ICON_319",
"Note": "后勤保障组", "WeightLimit": "-1",
"Name": "2001,8001|2002,8001|2003,80017", "Stats": "1,6.5|2,1.8|3,1|6,100",
"ActionMode": 2, "Skills": "4001,-1|4003,202|4005,-1",
"Group": 8009, "ResPath": "\\ASSETS\\b007.Prefeb",
"GroupLeader": 0, "ManageLevel": "-1"
"IsLeadingNPC": 0, },
"ICON": "ICON_320", {
"WeightLimit": 12, "ID": "8008",
"Stats": "1,4.5|2,2|3,1|4,0|5,0|6,100", "Note": "后勤保障组",
"Skills": "4001,-1|4003,202|4005,-1", "Name": "2001,1,8008|2001,2,8008|2001,6,8008",
"ResPath": "\\ASSETS\\b008.Prefeb" "ActionMode": "2",
}, "Group": "8009",
{ "GroupLeader": "0",
"ID": 8009, "IsLeadingNPC": "0",
"Note": "(组长)后勤保障组", "ICON": "ICON_320",
"Name": "2001,8001|2002,8001|2003,80018", "WeightLimit": "10",
"ActionMode": 2, "Stats": "1,6.5|2,1.8|3,1|6,100",
"Group": -1, "Skills": "4001,-1|4003,202|4005,-1",
"GroupLeader": 1, "ResPath": "\\ASSETS\\b008.Prefeb",
"IsLeadingNPC": 0, "ManageLevel": "-1"
"ICON": "ICON_321", },
"WeightLimit": 12, {
"Stats": "1,4.5|2,2|3,1|4,0|5,0|6,100", "ID": "8009",
"Skills": "4001,-1|4003,202|4005,-1", "Note": "(组长)后勤保障组",
"ResPath": "\\ASSETS\\b009.Prefeb" "Name": "2001,1,8009|2001,2,8009|2001,6,8009",
}, "ActionMode": "2",
{ "Group": "-1",
"ID": 8010, "GroupLeader": "1",
"Note": "搜寻组", "IsLeadingNPC": "0",
"Name": "2001,8001|2002,8001|2003,80019", "ICON": "ICON_321",
"ActionMode": 2, "WeightLimit": "10",
"Group": 8001, "Stats": "1,6.5|2,1.8|3,1|6,100",
"GroupLeader": 0, "Skills": "4001,-1|4003,202|4005,-1",
"IsLeadingNPC": 0, "ResPath": "\\ASSETS\\b009.Prefeb",
"ICON": "ICON_322", "ManageLevel": "-1"
"WeightLimit": 6, },
"Stats": "1,4.5|2,2|3,1|4,0|5,0|6,100", {
"Skills": "4001,-1|4003,202|4005,-1", "ID": "8010",
"ResPath": "\\ASSETS\\b010.Prefeb" "Note": "搜寻组",
}, "Name": "2001,1,8010|2001,2,8010|2001,6,8010",
{ "ActionMode": "2",
"ID": 8011, "Group": "8001",
"Note": "学生寝室长", "GroupLeader": "0",
"Name": "2001,8001|2002,8001|2003,80021", "IsLeadingNPC": "0",
"ActionMode": 1, "ICON": "ICON_322",
"Group": 8001, "WeightLimit": "5",
"GroupLeader": 0, "Stats": "1,6.5|2,1.8|3,1|6,100",
"IsLeadingNPC": 1, "Skills": "4001,-1|4003,202|4005,-1",
"ICON": "ICON_323", "ResPath": "\\ASSETS\\b010.Prefeb",
"WeightLimit": -1, "ManageLevel": "1|2|3|4|5"
"Stats": "1,4.5|2,2|3,1|4,0|5,0|6,100", },
"Skills": "4001,-1|4003,202|4005,-1", {
"ResPath": "\\ASSETS\\b012.Prefeb" "ID": "8011",
} "Note": "学生寝室长",
"Name": "2002,1,8011|2002,2,8011|2002,3,8999",
"ActionMode": "1",
"Group": "8001",
"GroupLeader": "0",
"IsLeadingNPC": "1",
"ICON": "ICON_323",
"WeightLimit": "-1",
"Stats": "1,6.5|2,1.8|3,1|6,100",
"Skills": "4001,-1|4003,202|4005,-1",
"ResPath": "\\ASSETS\\b012.Prefeb",
"ManageLevel": "-1"
}
] ]

View File

@ -296,10 +296,18 @@ public class JSONReader : MonoBehaviour
} }
//设置UI文本的方法 //设置UI文本的方法
public void SetUIText(Text text, int id) public string SetUIText(int id)
{ {
Language languageinfo = GetLanguageByID(id); Language info = null;
text.text = languageinfo.Text; if (LanguageDictionary.TryGetValue(id, out info))
{
return info.Text;
}
else
{
Debug.Log($"No Language found with ID: {id}");
return null;
}
} }
} }

View File

@ -137,7 +137,7 @@ public class Panel : MonoBehaviour
} }
} }
//动态加载职责 //动态加载职责
public void DynamicLoadingDuty(int id) public void DynamicLoadingDuty(int id,int idcidentId)
{ {
if (selectScenePanel.difficultyToRoles.ContainsKey(id)) if (selectScenePanel.difficultyToRoles.ContainsKey(id))
{ {
@ -152,30 +152,42 @@ public class Panel : MonoBehaviour
{ {
var npcInfo = jsonReader1.npcDictionary[roleId]; var npcInfo = jsonReader1.npcDictionary[roleId];
// 创建DutyItem实例 // 创建DutyItem实例
GameObject item = GameObject.Instantiate(dutyPrefab, dutyCount); string[] roleLimitSections = npcData.Name.Split('|');
DutyItem dutyItem = item.GetComponent<DutyItem>(); foreach(string plopleInfo in roleLimitSections)
Button dutuybutton = item.transform.Find("TextBtn").GetComponent<Button>();
dutuybutton.onClick.AddListener(() =>
{ {
OnDutyItemClicked(item, Color.red, selectedDuty);
if(dutyItem.dutyNameText.text=="Ö÷³ÖÈË") string[] peopleLimit = plopleInfo.Split(',');
if (peopleLimit[0] == idcidentId.ToString() && peopleLimit[1]==id.ToString())
{ {
peopleList.Clear(); GameObject item = GameObject.Instantiate(dutyPrefab, dutyCount);
foreach (Transform child in sceneCount) DutyItem dutyItem = item.GetComponent<DutyItem>();
Button dutuybutton = item.transform.Find("TextBtn").GetComponent<Button>();
string showText = jsonReader1.SetUIText(int.Parse(peopleLimit[2]));
dutuybutton.onClick.AddListener(() =>
{ {
Destroy(child.gameObject); OnDutyItemClicked(item, Color.red, selectedDuty);
} if(dutyItem.dutyNameText.text=="Ö÷³ÖÈË")
Debug.Log("ÎÞÐèÖ¸¶¨Î»ÖÃ"); {
peopleList.Clear();
foreach (Transform child in sceneCount)
{
Destroy(child.gameObject);
}
Debug.Log("ÎÞÐèÖ¸¶¨Î»ÖÃ");
}
else
{
SetScene(dutyItem.dutyId);
}
});
dutyItem.dutyNameText.text = showText;
dutyItem.leader = npcData.GroupLeader;
dutyItem.dutyId = npcData.ID;
peopleList.Add(item);
} }
else }
{
SetScene(dutyItem.dutyId);
}
});
dutyItem.dutyNameText.text = npcData.Note;
dutyItem.leader = npcData.GroupLeader;
dutyItem.dutyId = npcData.ID;
peopleList.Add(item);
} }
} }
} }

View File

@ -447,7 +447,7 @@ public class SelectScenePanel : MonoBehaviour
DisableUIInteraction(); DisableUIInteraction();
panel.DynamicLoadingPeople(); panel.DynamicLoadingPeople();
panel.DynamicLoadingScene(); panel.DynamicLoadingScene();
panel.DynamicLoadingDuty(this.difficultyId); panel.DynamicLoadingDuty(this.difficultyId,this.idcidentId);
isSure = true; isSure = true;
} }