数据传输修改
This commit is contained in:
parent
fb371dfc13
commit
700e90b5ed
@ -47,6 +47,7 @@ public class auth_createTemplate
|
|||||||
public List<PlayerList> playerList;//鯤소죗깊
|
public List<PlayerList> playerList;//鯤소죗깊
|
||||||
public List<NpcList> npcList;//NPC죗깊
|
public List<NpcList> npcList;//NPC죗깊
|
||||||
public List<MaterialList> materialList;//<2F>구포꼼죗깊
|
public List<MaterialList> materialList;//<2F>구포꼼죗깊
|
||||||
|
public string disasterLocation;//事故发生地
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PlayerList//鯤소죗깊
|
public class PlayerList//鯤소죗깊
|
||||||
|
@ -31,7 +31,8 @@ public class getPlayerList : MonoBehaviour
|
|||||||
Debug.Log("获取演练账号列表" + response);
|
Debug.Log("获取演练账号列表" + response);
|
||||||
// 解析服务器返回的数据
|
// 解析服务器返回的数据
|
||||||
PlayerListResponse playerListResponse = JsonConvert.DeserializeObject<PlayerListResponse>(response);
|
PlayerListResponse playerListResponse = JsonConvert.DeserializeObject<PlayerListResponse>(response);
|
||||||
Debug.Log(playerListResponse.data[0].UserName);
|
Debug.Log(playerListResponse.data[0].UserId);
|
||||||
|
|
||||||
return playerListResponse;
|
return playerListResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@ public class DatePanel : MonoBehaviour
|
|||||||
public Text inputText;
|
public Text inputText;
|
||||||
public Text dataText;
|
public Text dataText;
|
||||||
public string placeId;
|
public string placeId;
|
||||||
|
public string disasterLocation;
|
||||||
|
public string evetId;
|
||||||
public Panel panel;
|
public Panel panel;
|
||||||
public createTemplateInterface createTemplateInterface=new createTemplateInterface();
|
public createTemplateInterface createTemplateInterface=new createTemplateInterface();
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
@ -50,6 +52,8 @@ public class DatePanel : MonoBehaviour
|
|||||||
public void OnClickSubmitPanel()
|
public void OnClickSubmitPanel()
|
||||||
{
|
{
|
||||||
createTemplateInfo.Instance.auth_CreateTemplate.sceneId = placeId;
|
createTemplateInfo.Instance.auth_CreateTemplate.sceneId = placeId;
|
||||||
|
createTemplateInfo.Instance.auth_CreateTemplate.disasterLocation = disasterLocation;
|
||||||
|
createTemplateInfo.Instance.auth_CreateTemplate.subjectId = evetId;
|
||||||
if(preservationToggle.isOn)
|
if(preservationToggle.isOn)
|
||||||
{
|
{
|
||||||
createTemplateInfo.Instance.auth_CreateTemplate.isTemplate = "0";
|
createTemplateInfo.Instance.auth_CreateTemplate.isTemplate = "0";
|
||||||
|
@ -487,7 +487,8 @@ 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);
|
string a = "(" + classLevel.classname.text + ")";
|
||||||
|
jueseChoicePop.SetClass(a);
|
||||||
//jueseChoicePanel.SetClass();
|
//jueseChoicePanel.SetClass();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ using Unity.VisualScripting;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using static UnityEditor.Progress;
|
||||||
|
|
||||||
public class SelectScenePanel : Base
|
public class SelectScenePanel : Base
|
||||||
{
|
{
|
||||||
@ -216,7 +217,7 @@ public class SelectScenePanel : Base
|
|||||||
{
|
{
|
||||||
this.idcidentName = item.incidentText.text;
|
this.idcidentName = item.incidentText.text;
|
||||||
this.idcidentId = item.incidentID;
|
this.idcidentId = item.incidentID;
|
||||||
datePanel.placeId = item.incidentID.ToString();
|
|
||||||
|
|
||||||
string[] difficulty = eventData.Value.Difficulty.Split('|');
|
string[] difficulty = eventData.Value.Difficulty.Split('|');
|
||||||
string[] roleGroups = eventData.Value.Role.Split('|'); // 分割Role字段,得到多个角色组
|
string[] roleGroups = eventData.Value.Role.Split('|'); // 分割Role字段,得到多个角色组
|
||||||
@ -325,7 +326,7 @@ public class SelectScenePanel : Base
|
|||||||
OnRandomEventClick();
|
OnRandomEventClick();
|
||||||
}
|
}
|
||||||
// 设置模板信息
|
// 设置模板信息
|
||||||
createTemplateInfo.Instance.auth_CreateTemplate.subjectId = item.eventId.ToString();
|
//createTemplateInfo.Instance.auth_CreateTemplate.subjectId = item.eventId.ToString();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (toggle.isOn)
|
if (toggle.isOn)
|
||||||
@ -437,6 +438,12 @@ public class SelectScenePanel : Base
|
|||||||
//提交按钮,点击上传数据和隐藏界面
|
//提交按钮,点击上传数据和隐藏界面
|
||||||
public void SubmitBtn()
|
public void SubmitBtn()
|
||||||
{
|
{
|
||||||
|
datePanel.evetId = this.eventId.ToString();
|
||||||
|
Debug.LogError("datePanel.evetId"+datePanel.evetId);
|
||||||
|
datePanel.placeId = this.scnenId.ToString();
|
||||||
|
Debug.LogError("datePanel.placeId" + datePanel.placeId);
|
||||||
|
datePanel.disasterLocation = this.idcidentId.ToString();
|
||||||
|
Debug.LogError("datePanel.disasterLocation" + datePanel.disasterLocation);
|
||||||
SelsctDifficulty();
|
SelsctDifficulty();
|
||||||
SetDataPanelInfo();
|
SetDataPanelInfo();
|
||||||
this.gameObject.SetActive(false);
|
this.gameObject.SetActive(false);
|
||||||
|
@ -2,6 +2,7 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
|
using Unity.VisualScripting.Antlr3.Runtime;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Assertions.Must;
|
using UnityEngine.Assertions.Must;
|
||||||
using UnityEngine.Networking.Types;
|
using UnityEngine.Networking.Types;
|
||||||
@ -17,11 +18,12 @@ public class JueseChoicePop : MonoBehaviour
|
|||||||
public GameObject classmatePrefab;
|
public GameObject classmatePrefab;
|
||||||
public Transform content;
|
public Transform content;
|
||||||
|
|
||||||
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
|
// 用于记录已加载的SceneId或者DutyId
|
||||||
HashSet<string> loadedSceneIds = new HashSet<string>(); // 或者使用字典来记录更多信息
|
HashSet<string> loadedplayername = new HashSet<string>(); // 或者使用字典来记录更多信息
|
||||||
|
HashSet<string> loadedlevel = new HashSet<string>(); // 或者使用字典来记录更多信息
|
||||||
|
|
||||||
public string s;
|
public string s;
|
||||||
public JSONReader jsonReader;
|
public JSONReader jsonReader;
|
||||||
@ -57,82 +59,88 @@ public class JueseChoicePop : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
//加载分管人员
|
//加载分管人员
|
||||||
public void SetClass(string a)
|
public void SetClass(string a)
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
foreach(var all in panel.sceneDataDictionary)
|
|
||||||
{
|
{
|
||||||
foreach (var info in all.Value)
|
Debug.LogError("xxxxxxxxxxxxxxxxxxxxxxxxxx" + a);
|
||||||
|
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));
|
||||||
}
|
|
||||||
|
|
||||||
string[] overseeParts = locationData.Oversee.Split(',');
|
if (locationData.Oversee == "-1")
|
||||||
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];
|
||||||
|
string lastElement = overseeParts[1];
|
||||||
|
|
||||||
// 如果没有加载过,实例化预制体
|
if (overseeParts.Length > 0 && firstElement == info.dutyId && lastElement == "1")
|
||||||
GameObject item = GameObject.Instantiate(classmatePrefab, content);
|
|
||||||
ClassMate classMate = item.GetComponent<ClassMate>();
|
|
||||||
Button button = item.GetComponent<Button>();
|
|
||||||
|
|
||||||
button.onClick.AddListener(() =>
|
|
||||||
{
|
{
|
||||||
SetClassMate(classMate, a);
|
Debug.LogError(loadedplayername.Contains(info.name));
|
||||||
});
|
// 如果已经加载过,跳过
|
||||||
classMate.name = info.name;
|
if (loadedplayername.Contains(info.name))
|
||||||
classMate.classmatename.text = classMate.name;
|
{
|
||||||
// classMate.id = info.dutyId;
|
Debug.Log($"Scene ID {info.sceneId} already loaded. Skipping.");
|
||||||
instantiatedObjects.Add(item);
|
continue; // 如果该sceneId已经加载过,就跳过
|
||||||
// 将当前加载的sceneId添加到集合中
|
}
|
||||||
loadedSceneIds.Add(info.name);
|
else
|
||||||
|
{
|
||||||
|
// 如果没有加载过,实例化预制体
|
||||||
|
GameObject item = GameObject.Instantiate(classmatePrefab, content);
|
||||||
|
ClassMate classMate = item.GetComponent<ClassMate>();
|
||||||
|
Button button = item.GetComponent<Button>();
|
||||||
|
string test = a;
|
||||||
|
button.onClick.AddListener(() =>
|
||||||
|
{
|
||||||
|
Debug.LogError("zzzzzzzzzzzzzzzzzzzzzzzzzz" + test);
|
||||||
|
SetClassMate(classMate, test);
|
||||||
|
});
|
||||||
|
classMate.name = info.name;
|
||||||
|
classMate.classmatename.text = classMate.name;
|
||||||
|
// classMate.id = info.dutyId;
|
||||||
|
instantiatedObjects.Add(item);
|
||||||
|
// 将当前加载的玩家名添加到集合中
|
||||||
|
loadedplayername.Add(info.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 如果没有数据,弹出提示框
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
foreach (Transform child in content)
|
||||||
|
{
|
||||||
|
ClassMate find = child.transform.GetComponent<ClassMate>();
|
||||||
|
Debug.LogError("????????????????????????" + find.classText.text);
|
||||||
|
Debug.LogError("---------------------------" + a);
|
||||||
|
if (find.classText.text == a)
|
||||||
|
{
|
||||||
|
find.classText.text = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.classMate = classMate;
|
this.classMate = classMate;
|
||||||
this.classMate.classText.text = "(" + a + ")";
|
this.classMate.classText.text = a;
|
||||||
classMate.isBeSet = false;
|
classMate.isBeSet = false;
|
||||||
|
loadedlevel.Add(this.classMate.classText.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetClassItem(ClassItem classItem)
|
public void SetClassItem(ClassItem classItem)
|
||||||
{
|
{
|
||||||
this.classItem = classItem;
|
this.classItem = classItem;
|
||||||
}
|
|
||||||
|
|
||||||
//关闭界面的时候删除子物体
|
|
||||||
public void ClearAll()
|
|
||||||
{
|
|
||||||
foreach(Transform child in content)
|
|
||||||
{
|
|
||||||
Destroy(child.gameObject);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user