显示修改

This commit is contained in:
lq 2024-12-16 17:56:27 +08:00
parent dbd00a9734
commit e44090390c
3 changed files with 182 additions and 176 deletions

View File

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

View File

@ -196,7 +196,7 @@ public class Panel : MonoBehaviour
sceneItem.sceneId = npcData.ToString(); sceneItem.sceneId = npcData.ToString();
LocationData locationData= jsonReader1.GetAreaDateById(int.Parse(npcData)); LocationData locationData= jsonReader1.GetAreaDateById(int.Parse(npcData));
sceneItem.sceneName.text = jsonReader1.SetUIText(locationData.Name); sceneItem.sceneName.text = jsonReader1.SetUIText(locationData.Name);
Debug.LogError(sceneItem.sceneId); //Debug.LogError(sceneItem.sceneId);
// 将每个实例化的角色添加到列表中 // 将每个实例化的角色添加到列表中
peopleList.Add(item); peopleList.Add(item);
} }
@ -297,6 +297,7 @@ public class Panel : MonoBehaviour
//根据选择的职责加载出对应场景 //根据选择的职责加载出对应场景
public void SetScene(int id) public void SetScene(int id)
{ {
peopleList.Clear(); peopleList.Clear();
foreach(Transform child in sceneCount) foreach(Transform child in sceneCount)
{ {
@ -313,18 +314,20 @@ public class Panel : MonoBehaviour
bool shouldInstantiate = true; bool shouldInstantiate = true;
if(npcData.Value.RoleLimit=="-1") if(npcData.Value.RoleLimit=="-1")
{ {
break; continue;
} }
else else
{ {
foreach (var section in roleLimitSections) foreach (var section in roleLimitSections)
{ {
// 按“,”分隔出事故位置ID、职业ID和最低要求人数 // 按“,”分隔出事故位置ID、职业ID和最低要求人数
string[] roleLimits = section.Split(','); string[] roleLimits = section.Split(',');
string accidentLocationId = roleLimits[0]; // 事故位置ID string accidentLocationId = roleLimits[0]; // 事故位置ID
string difficultyId = roleLimits[1]; string difficultyId = roleLimits[1];
string roleId = roleLimits[2]; // 职业ID string roleId = roleLimits[2]; // 职业ID
int minRequired = int.Parse(roleLimits[3]); // 最低要求人数 int minRequired = int.Parse(roleLimits[3]); // 最低要求人数
Debug.LogError("SceneId+" + selectScenePanel.idcidentId);
if (accidentLocationId == selectScenePanel.idcidentId.ToString() && roleId == id.ToString() && difficultyId == selectScenePanel.difficultyId.ToString()) if (accidentLocationId == selectScenePanel.idcidentId.ToString() && roleId == id.ToString() && difficultyId == selectScenePanel.difficultyId.ToString())
{ {
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount); GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
@ -492,6 +495,7 @@ public class Panel : MonoBehaviour
selectedInfo.scene = scene; selectedInfo.scene = scene;
selectedInfo.sceneId= sceneItem.sceneId; selectedInfo.sceneId= sceneItem.sceneId;
isSceneSelected = true; // 选择了场景 isSceneSelected = true; // 选择了场景
Debug.LogError(">>>>>>>>>>>>>>>>" + selectedInfo.sceneId);
} }
else if (buttonText != null && buttonText.tag == Tags.duty) // 获取标签为职责的信息 else if (buttonText != null && buttonText.tag == Tags.duty) // 获取标签为职责的信息
{ {
@ -510,6 +514,7 @@ public class Panel : MonoBehaviour
dutyId = item.dutyId; dutyId = item.dutyId;
selectedInfo.duty = duty; selectedInfo.duty = duty;
selectedInfo.dutyId = dutyId.ToString(); selectedInfo.dutyId = dutyId.ToString();
Debug.LogError(">>>>>>>>>>>>>>>>" + selectedInfo.dutyId);
} }
} }
} }

View File

@ -297,101 +297,25 @@ public class EvacuationPanel : MonoBehaviour
string[] limit = npcLimit.Split(','); string[] limit = npcLimit.Split(',');
if (limit[0] == selectScene.scnenId.ToString()&& limit[1] == selectScene.difficultyId.ToString()) if (limit[0] == selectScene.scnenId.ToString()&& limit[1] == selectScene.difficultyId.ToString())
{ {
//GameObject sceneitem = GameObject.Instantiate(personnelPrefabs, personnelContent); GameObject sceneitem = GameObject.Instantiate(personnelPrefabs, personnelContent);
//PersonnelItem personnelItem = sceneitem.GetComponent<PersonnelItem>(); PersonnelItem personnelItem = sceneitem.GetComponent<PersonnelItem>();
//Button button = personnelItem.transform.Find("sceneText").GetComponent<Button>();
//personnelItem.sceneText.text = sceneEntry.Key;
//personnelItem.sceneId = area.ID;
//personnelItem.Num = 1; // 设置初始值为 1
//// 点击事件监听
//button.onClick.AddListener(() =>
//{
// // 标记当前选择的区域
// OnSceneItemClicked(item, Color.yellow, selectedScene);
// // 如果被点击的区域已经有人员
// if (personnelItem.NpcNum > 0)
// {
// redistributeBtn.onClick.AddListener(() => {
// // 清除选定区域的人员数据
// RedistributeLogic(personnelItem.sceneId, personnelItem.NpcNum);
// });
// }
// // 清空现有场景下的所有人员UI
// foreach (Transform child in sceneCount)
// {
// Destroy(child.gameObject);
// }
// // 执行后续的场景级别配置
// LocationData locationData = js.GetAreaDateById(personnelItem.sceneId);
// if (locationData.Level.ToString() != "0")
// {
// GameObject levelItem = GameObject.Instantiate(scenePrefab, sceneCount);
// Button levelBtn = levelItem.transform.Find("chooseBtn2").GetComponent<Button>();
// levelBtn.onClick.AddListener(() =>
// {
// JueseChoicePop jueseChoicePop = jueseChoicePanel.GetComponent<JueseChoicePop>();
// jueseChoicePop.SetClass(personnelItem.sceneId);
// jueseChoicePanel.gameObject.SetActive(true);
// });
// ClassItem classItem = levelItem.GetComponent<ClassItem>();
// classItem.classname.text = locationData.Level.ToString();
// }
//});
//personnelItems.Add(personnelItem);
}
}
}
}
}
//设置左侧场景显示
public void SetPersonnel()
{
// 清空现有的UI项
foreach (Transform child in personnelContent)
{
Destroy(child.gameObject);
}
// 清空人员列表
personnelItems.Clear();
foreach (var sceneEntry in panel.sceneDataDictionary)
{
foreach (var sceneInfo in sceneEntry.Value)
{
LocationData area = js.GetAreaDateById(int.Parse(sceneInfo.sceneId));
// 如果NpcRatio不为"-1"表示该场景有效
if (area.NpcRatio != "-1")
{
// 检查 personnelItems 是否已经包含该 sceneText.text
var existingItem = personnelItems.Find(item => item.sceneText.text == sceneEntry.Key);
if (existingItem != null)
{
// 如果已经存在,增加 Num
existingItem.Num++;
}
else
{
// 如果没有重复的 personnelItem创建并添加
GameObject item = GameObject.Instantiate(personnelPrefabs, personnelContent);
PersonnelItem personnelItem = item.GetComponent<PersonnelItem>();
Button button = personnelItem.transform.Find("sceneText").GetComponent<Button>(); Button button = personnelItem.transform.Find("sceneText").GetComponent<Button>();
personnelItem.sceneText.text = sceneEntry.Key;
personnelItem.sceneId = area.ID; personnelItem.sceneText.text = js.SetUIText(item.Key);
personnelItem.sceneId = item.Key;
personnelItem.Num = 1; // 设置初始值为 1 personnelItem.Num = 1; // 设置初始值为 1
// 点击事件监听 // 点击事件监听
button.onClick.AddListener(() => button.onClick.AddListener(() =>
{ {
// 标记当前选择的区域 // 标记当前选择的区域
OnSceneItemClicked(item, Color.yellow, selectedScene); OnSceneItemClicked(sceneitem, Color.yellow, selectedScene);
// 如果被点击的区域已经有人员 // 如果被点击的区域已经有人员
if (personnelItem.NpcNum > 0) if (personnelItem.NpcNum > 0)
{ {
redistributeBtn.onClick.AddListener(() => { redistributeBtn.onClick.AddListener(() =>
{
// 清除选定区域的人员数据 // 清除选定区域的人员数据
RedistributeLogic(personnelItem.sceneId, personnelItem.NpcNum); RedistributeLogic(personnelItem.sceneId, personnelItem.NpcNum);
}); });
} }
// 清空现有场景下的所有人员UI // 清空现有场景下的所有人员UI
@ -418,14 +342,91 @@ public class EvacuationPanel : MonoBehaviour
personnelItems.Add(personnelItem); personnelItems.Add(personnelItem);
} }
} }
else
{
break; // 如果遇到无效场景NpcRatio为-1跳出当前循环
}
} }
} }
} }
//设置左侧场景显示
//public void SetPersonnel()
//{
// // 清空现有的UI项
// foreach (Transform child in personnelContent)
// {
// Destroy(child.gameObject);
// }
// // 清空人员列表
// personnelItems.Clear();
// foreach (var sceneEntry in panel.sceneDataDictionary)
// {
// foreach (var sceneInfo in sceneEntry.Value)
// {
// LocationData area = js.GetAreaDateById(int.Parse(sceneInfo.sceneId));
// // 如果NpcRatio不为"-1"表示该场景有效
// if (area.NpcRatio != "-1")
// {
// // 检查 personnelItems 是否已经包含该 sceneText.text
// var existingItem = personnelItems.Find(item => item.sceneText.text == sceneEntry.Key);
// if (existingItem != null)
// {
// // 如果已经存在,增加 Num
// existingItem.Num++;
// }
// else
// {
// // 如果没有重复的 personnelItem创建并添加
// GameObject item = GameObject.Instantiate(personnelPrefabs, personnelContent);
// PersonnelItem personnelItem = item.GetComponent<PersonnelItem>();
// Button button = personnelItem.transform.Find("sceneText").GetComponent<Button>();
// personnelItem.sceneText.text = sceneEntry.Key;
// personnelItem.sceneId = area.ID;
// personnelItem.Num = 1; // 设置初始值为 1
// // 点击事件监听
// button.onClick.AddListener(() =>
// {
// // 标记当前选择的区域
// OnSceneItemClicked(item, Color.yellow, selectedScene);
// // 如果被点击的区域已经有人员
// if (personnelItem.NpcNum > 0)
// {
// redistributeBtn.onClick.AddListener(() => {
// // 清除选定区域的人员数据
// RedistributeLogic(personnelItem.sceneId, personnelItem.NpcNum);
// });
// }
// // 清空现有场景下的所有人员UI
// foreach (Transform child in sceneCount)
// {
// Destroy(child.gameObject);
// }
// // 执行后续的场景级别配置
// LocationData locationData = js.GetAreaDateById(personnelItem.sceneId);
// if (locationData.Level.ToString() != "0")
// {
// GameObject levelItem = GameObject.Instantiate(scenePrefab, sceneCount);
// Button levelBtn = levelItem.transform.Find("chooseBtn2").GetComponent<Button>();
// levelBtn.onClick.AddListener(() =>
// {
// JueseChoicePop jueseChoicePop = jueseChoicePanel.GetComponent<JueseChoicePop>();
// jueseChoicePop.SetClass(personnelItem.sceneId);
// jueseChoicePanel.gameObject.SetActive(true);
// });
// ClassItem classItem = levelItem.GetComponent<ClassItem>();
// classItem.classname.text = locationData.Level.ToString();
// }
// });
// personnelItems.Add(personnelItem);
// }
// }
// else
// {
// break; // 如果遇到无效场景NpcRatio为-1跳出当前循环
// }
// }
// }
//}
// 判断重新分配按钮是否可以点击 // 判断重新分配按钮是否可以点击
public void IsRedistribution() public void IsRedistribution()
{ {