using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; [Serializable] public class ZhiQingRenData { //public string name; public bool zhy; public bool wz; public bool bkry; public bool zdwxy; public bool snxfss; public bool jznbjg; public string other; public string answer; } public class ZhiQingRenPanel : ResourceLoadPanel { public Toggle ZHY; public Toggle WZ; public Toggle BKRY; public Toggle ZDWXY; public Toggle SNXFSS; public Toggle JZNBJG; public InputField QuestionInput; public Button CloseBtn; public Button SureBtn; private string answer; void Start() { CloseBtn.onClick.AddListener(CloseBtn_Click); SureBtn.onClick.AddListener(SureBtn_Click); } private void CloseBtn_Click() { gameObject.SetActive(false); } public void AddRecordEventAskZhiQingRen(ZhiQingRenData data) { if (ReplaySetting.PlayStatus == PlayStatus.isEditor && RecordManager.Instance.recordStatus == RecordStatus.normal) { var eventData = new EventData(); eventData.time = RecordManager.Instance.RecordTimer; eventData.cloneObjType = CloneObjType.None; eventData.eventType = RecordEventType.AskZhiQingRen; eventData.json = JsonUtility.ToJson(data); RecordManager.Instance.jsonData.eventDataList.Add(eventData); } } private void SureBtn_Click() { if (ZHY.isOn) { answer += "着火源:不明确 "; } if (WZ.isOn) { answer += "位置:不明确 "; } if (BKRY.isOn) { if (GameObject.Find("P_AllParent").transform.Find("P_Disaster/P_Wounded").childCount > 0 || GameObject.Find("P_AllParent").transform.Find("P_Disaster/P_TrappedPerson").childCount > 0) answer += "有被困人员 "; else answer += "未发现有被困人员 "; } if (ZDWXY.isOn) { answer += "重大危险源不明确 "; } if (SNXFSS.isOn) { answer += "室内消防设施情况不明确 "; } if (JZNBJG.isOn) { answer += "建筑结构内部拆改情况不明确 "; } if (!string.IsNullOrEmpty(answer)) ResourceLoadWindow.Instance.LoadTextHintWindow(answer, 2f); ZhiQingRenData data = new ZhiQingRenData(); data.zhy = ZHY.isOn; data.wz = WZ.isOn; data.bkry = BKRY.isOn; data.zdwxy = ZDWXY.isOn; data.snxfss = SNXFSS.isOn; data.jznbjg = JZNBJG.isOn; data.other = QuestionInput.text; data.answer = answer; AddRecordEventAskZhiQingRen(data); CloseBtn_Click(); } public void AskZhiQingRen(ZhiQingRenData data = null) { if (data != null) { ZHY.isOn = data.zhy; WZ.isOn = data.wz; BKRY.isOn = data.bkry; ZDWXY.isOn = data.zdwxy; SNXFSS.isOn = data.snxfss; JZNBJG.isOn = data.jznbjg; QuestionInput.text = data.other; answer = data.answer; } else { if (ZHY.isOn) ZHY.isOn = false; if (WZ.isOn) WZ.isOn = false; if (BKRY.isOn) BKRY.isOn = false; if (ZDWXY.isOn) ZDWXY.isOn = false; if (SNXFSS.isOn) SNXFSS.isOn = false; if (JZNBJG.isOn) JZNBJG.isOn = false; QuestionInput.text = ""; answer = ""; } } }