using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class UIHistoryInfo : UIBase { public Button close; public GameObject infoItem; public Transform content; string dataURL = string.Empty; int currentDiaID = -1; private void Awake() { close.onClick.AddListener(() => { UIManager.Instance.DestoryUI(UIType.UIHistoryInfo); }); var allData = DataManager.Instance.currentPeoplesQuestion; if (allData != null) { if (allData.Count > 0) { currentDiaID = allData[0].diagnosisId; } } dataURL = DataManager.Instance.currentHistoryChoose + currentDiaID; Debug.Log(dataURL); DataParse.Instance.ParsePeopleInfo(dataURL); EventCenter.dispatcher.AddListener(MsgType.OnGetPeopleInfo2, OnGetPeopleInfo); } private void OnGetPeopleInfo(Message evt) { var currentInfo = DataManager.Instance.rowitems2; for (int i = 0; i < currentInfo.Count; i++) { var data = currentInfo[i]; var newUI = GameObject.Instantiate(infoItem, content); string sex = data.sex == 0 ? "男" : "女"; newUI.transform.Find("info").GetComponent().text = "姓:" + data.familyName + " 名:" + data.name + "/n性别:" + sex + "/n职业:" + data.occupation; } } }