Compare commits
No commits in common. "1441e13a503c431d825ada5a38f974d4d7b83324" and "700c9ae420fbc6c789a6d4b5a78178f4310fa7b3" have entirely different histories.
1441e13a50
...
700c9ae420
@ -487,7 +487,7 @@ public class EvacuationPanel : Base
|
|||||||
{
|
{
|
||||||
JueseChoicePop jueseChoicePop = jueseChoicePanel.GetComponent<JueseChoicePop>();
|
JueseChoicePop jueseChoicePop = jueseChoicePanel.GetComponent<JueseChoicePop>();
|
||||||
jueseChoicePanel.gameObject.SetActive(true);
|
jueseChoicePanel.gameObject.SetActive(true);
|
||||||
jueseChoicePop.SetClass(classLevel.classname.text);
|
jueseChoicePop.SetClass();
|
||||||
//jueseChoicePanel.SetClass();
|
//jueseChoicePanel.SetClass();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ MonoBehaviour:
|
|||||||
id: 0
|
id: 0
|
||||||
name:
|
name:
|
||||||
classmatename: {fileID: 5469669078877023921}
|
classmatename: {fileID: 5469669078877023921}
|
||||||
classText: {fileID: 646037399500158430}
|
classText: {fileID: 0}
|
||||||
s:
|
s:
|
||||||
otherButton: {fileID: 0}
|
otherButton: {fileID: 0}
|
||||||
button: {fileID: 5469669078140634246}
|
button: {fileID: 5469669078140634246}
|
||||||
|
@ -20,8 +20,6 @@ public class JueseChoicePop : MonoBehaviour
|
|||||||
public List<ClassMate> classMateList = new List<ClassMate> ();
|
public List<ClassMate> classMateList = new List<ClassMate> ();
|
||||||
// 存储已实例化的 GameObject 列表
|
// 存储已实例化的 GameObject 列表
|
||||||
private List<GameObject> instantiatedObjects = new List<GameObject>();
|
private List<GameObject> instantiatedObjects = new List<GameObject>();
|
||||||
// 用于记录已加载的SceneId或者DutyId
|
|
||||||
HashSet<string> loadedSceneIds = new HashSet<string>(); // 或者使用字典来记录更多信息
|
|
||||||
|
|
||||||
public string s;
|
public string s;
|
||||||
public JSONReader jsonReader;
|
public JSONReader jsonReader;
|
||||||
@ -42,7 +40,7 @@ public class JueseChoicePop : MonoBehaviour
|
|||||||
}
|
}
|
||||||
void CLosePop()
|
void CLosePop()
|
||||||
{
|
{
|
||||||
//ClearAll();
|
ClearAll();
|
||||||
this.gameObject.SetActive(false);
|
this.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
public void openPop()
|
public void openPop()
|
||||||
@ -57,63 +55,56 @@ public class JueseChoicePop : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
//加载分管人员
|
//加载分管人员
|
||||||
public void SetClass(string a)
|
public void SetClass()
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
foreach(var all in panel.sceneDataDictionary)
|
|
||||||
{
|
{
|
||||||
foreach (var info in all.Value)
|
//if (instantiatedObjects.Any(obj => obj.GetComponent<ClassMate>().id == id))
|
||||||
|
//{
|
||||||
|
// Debug.Log($"这个: {id} 已经被实例化.");
|
||||||
|
// return; // 如果已实例化,跳过
|
||||||
|
//}
|
||||||
|
//foreach (Transform child in content)
|
||||||
|
//{
|
||||||
|
// Destroy(child.gameObject);
|
||||||
|
//}
|
||||||
|
foreach(var all in panel.sceneDataDictionary)
|
||||||
{
|
{
|
||||||
Debug.LogError("-------------------------"+ info.sceneId);
|
foreach (var info in all.Value)
|
||||||
LocationData locationData = jsonReader.GetAreaDateById(int.Parse(info.sceneId));
|
|
||||||
|
|
||||||
if (locationData.Oversee == "-1")
|
|
||||||
{
|
{
|
||||||
Debug.Log($"Skipping ID{info.sceneId}: Oversee is -1.");
|
Debug.LogError("-------------------------"+ info.sceneId);
|
||||||
continue; // 跳过
|
LocationData locationData = jsonReader.GetAreaDateById(int.Parse(info.sceneId));
|
||||||
}
|
if (locationData.Oversee == "-1")
|
||||||
|
|
||||||
string[] overseeParts = locationData.Oversee.Split(',');
|
|
||||||
string firstElement = overseeParts[0];
|
|
||||||
string lastElement = overseeParts[1];
|
|
||||||
|
|
||||||
if (overseeParts.Length > 0 && firstElement == info.dutyId && lastElement == "1")
|
|
||||||
{
|
|
||||||
Debug.LogError(loadedSceneIds.Contains(info.name));
|
|
||||||
// 如果已经加载过,跳过
|
|
||||||
if (loadedSceneIds.Contains(info.name))
|
|
||||||
{
|
{
|
||||||
Debug.Log($"Scene ID {info.sceneId} already loaded. Skipping.");
|
Debug.Log($"Skipping ID{info.sceneId}: Oversee is -1.");
|
||||||
continue; // 如果该sceneId已经加载过,就跳过
|
continue; // 跳过
|
||||||
}
|
}
|
||||||
|
string[] overseeParts = locationData.Oversee.Split(',');
|
||||||
// 如果没有加载过,实例化预制体
|
string firstElement = overseeParts[0];
|
||||||
GameObject item = GameObject.Instantiate(classmatePrefab, content);
|
string lastElement = overseeParts[1];
|
||||||
ClassMate classMate = item.GetComponent<ClassMate>();
|
if (overseeParts.Length > 0)
|
||||||
Button button = item.GetComponent<Button>();
|
|
||||||
|
|
||||||
button.onClick.AddListener(() =>
|
|
||||||
{
|
{
|
||||||
SetClassMate(classMate, a);
|
|
||||||
});
|
if(firstElement==info.dutyId&&lastElement=="1")
|
||||||
classMate.name = info.name;
|
{
|
||||||
classMate.classmatename.text = classMate.name;
|
GameObject item = GameObject.Instantiate(classmatePrefab, content);
|
||||||
// classMate.id = info.dutyId;
|
ClassMate classMate = item.GetComponent<ClassMate>();
|
||||||
instantiatedObjects.Add(item);
|
Button button = item.GetComponent<Button>();
|
||||||
// 将当前加载的sceneId添加到集合中
|
button.onClick.AddListener(() =>
|
||||||
loadedSceneIds.Add(info.name);
|
{
|
||||||
|
//SetClassMate(classMate, );
|
||||||
|
});
|
||||||
|
classMate.name = info.name;
|
||||||
|
classMate.classmatename.text = classMate.name;
|
||||||
|
//classMate.id = info.dutyId;
|
||||||
|
instantiatedObjects.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(panel.sceneDataDictionary.Count==0)
|
||||||
|
{
|
||||||
|
WarningPopPanel.OpenPanel("请先添加对应的应急人员配置");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有数据,弹出提示框
|
|
||||||
if (panel.sceneDataDictionary.Count == 0)
|
|
||||||
{
|
|
||||||
WarningPopPanel.OpenPanel("请先添加对应的应急人员配置");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//点击人员后设置位置的方法
|
//点击人员后设置位置的方法
|
||||||
public void SetClassMate(ClassMate classMate, string a = "")
|
public void SetClassMate(ClassMate classMate, string a = "")
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user