diff --git a/xiaofang/Assets/Script/Scheduled_03/Panel.cs b/xiaofang/Assets/Script/Scheduled_03/Panel.cs index 359d7e6e..4b5a175d 100644 --- a/xiaofang/Assets/Script/Scheduled_03/Panel.cs +++ b/xiaofang/Assets/Script/Scheduled_03/Panel.cs @@ -321,44 +321,33 @@ public class Panel : MonoBehaviour { // 按“,”分隔出事故位置ID、职业ID和最低要求人数 string[] roleLimits = section.Split(','); - if (section.Contains("-1")) + string accidentLocationId = roleLimits[0]; // 事故位置ID + string difficultyId = roleLimits[1]; + string roleId = roleLimits[2]; // 职业ID + int minRequired = int.Parse(roleLimits[3]); // 最低要求人数 + if (accidentLocationId == selectScenePanel.idcidentId.ToString() && roleId == id.ToString() && difficultyId == selectScenePanel.difficultyId.ToString()) { - if (roleLimits[0] == "-1") - { - shouldInstantiate = false; // 不实例化该NPC - break; // 跳出循环,直接处理下一个NPC - } - } - else - { - string accidentLocationId = roleLimits[0]; // 事故位置ID - string difficultyId = roleLimits[1]; - string roleId = roleLimits[2]; // 职业ID - int minRequired = int.Parse(roleLimits[3]); // 最低要求人数 - if (accidentLocationId == selectScenePanel.idcidentId.ToString() && roleId == id.ToString() && difficultyId == selectScenePanel.difficultyId.ToString()) - { - GameObject item = GameObject.Instantiate(scenePrefab, sceneCount); - SceneItem sceneItem = item.GetComponent(); - // 获取当前该位置该职业的人数 - int currentPeopleCount = GetCurrentPeopleCount(accidentLocationId, roleId); + GameObject item = GameObject.Instantiate(scenePrefab, sceneCount); + SceneItem sceneItem = item.GetComponent(); + // 获取当前该位置该职业的人数 + int currentPeopleCount = GetCurrentPeopleCount(accidentLocationId, roleId); - // 设置推荐标记(如果人数不足) - if (minRequired > currentPeopleCount) - { - sceneItem.sceneImage.gameObject.SetActive(true); // 显示推荐标记 - } - else - { - sceneItem.sceneImage.gameObject.SetActive(false); // 隐藏推荐标记 - } - Button scenebutton = item.transform.Find("TextBtn").GetComponent