diff --git a/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs b/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs index f31cefd9..de339dcc 100644 --- a/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs +++ b/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs @@ -487,7 +487,7 @@ public class EvacuationPanel : Base { JueseChoicePop jueseChoicePop = jueseChoicePanel.GetComponent(); jueseChoicePanel.gameObject.SetActive(true); - jueseChoicePop.SetClass(); + jueseChoicePop.SetClass(classLevel.classname.text); //jueseChoicePanel.SetClass(); }); diff --git a/xiaofang/Assets/yhj/prefabs/ClassMateName.prefab b/xiaofang/Assets/yhj/prefabs/ClassMateName.prefab index 3e0b27d1..9f3f8ff7 100644 --- a/xiaofang/Assets/yhj/prefabs/ClassMateName.prefab +++ b/xiaofang/Assets/yhj/prefabs/ClassMateName.prefab @@ -461,7 +461,7 @@ MonoBehaviour: id: 0 name: classmatename: {fileID: 5469669078877023921} - classText: {fileID: 0} + classText: {fileID: 646037399500158430} s: otherButton: {fileID: 0} button: {fileID: 5469669078140634246} diff --git a/xiaofang/Assets/yhj/scripts/JueseChoicePop.cs b/xiaofang/Assets/yhj/scripts/JueseChoicePop.cs index 629993f2..0673eeb6 100644 --- a/xiaofang/Assets/yhj/scripts/JueseChoicePop.cs +++ b/xiaofang/Assets/yhj/scripts/JueseChoicePop.cs @@ -20,6 +20,8 @@ public class JueseChoicePop : MonoBehaviour public List classMateList = new List (); // 存储已实例化的 GameObject 列表 private List instantiatedObjects = new List(); + // 用于记录已加载的SceneId或者DutyId + HashSet loadedSceneIds = new HashSet(); // 或者使用字典来记录更多信息 public string s; public JSONReader jsonReader; @@ -40,7 +42,7 @@ public class JueseChoicePop : MonoBehaviour } void CLosePop() { - ClearAll(); + //ClearAll(); this.gameObject.SetActive(false); } public void openPop() @@ -55,56 +57,63 @@ public class JueseChoicePop : MonoBehaviour } //加载分管人员 - public void SetClass() + public void SetClass(string a) +{ + + + foreach(var all in panel.sceneDataDictionary) { - //if (instantiatedObjects.Any(obj => obj.GetComponent().id == id)) - //{ - // Debug.Log($"这个: {id} 已经被实例化."); - // return; // 如果已实例化,跳过 - //} - //foreach (Transform child in content) - //{ - // Destroy(child.gameObject); - //} - foreach(var all in panel.sceneDataDictionary) + foreach (var info in all.Value) { - foreach (var info in all.Value) + Debug.LogError("-------------------------"+ info.sceneId); + LocationData locationData = jsonReader.GetAreaDateById(int.Parse(info.sceneId)); + + if (locationData.Oversee == "-1") { - Debug.LogError("-------------------------"+ info.sceneId); - LocationData locationData = jsonReader.GetAreaDateById(int.Parse(info.sceneId)); - if (locationData.Oversee == "-1") - { - Debug.Log($"Skipping ID{info.sceneId}: Oversee is -1."); - continue; // 跳过 - } - string[] overseeParts = locationData.Oversee.Split(','); - string firstElement = overseeParts[0]; - string lastElement = overseeParts[1]; - if (overseeParts.Length > 0) - { - - if(firstElement==info.dutyId&&lastElement=="1") - { - GameObject item = GameObject.Instantiate(classmatePrefab, content); - ClassMate classMate = item.GetComponent(); - Button button = item.GetComponent