ISAP/Assets/Scripts/UI/UIHistoryInfo.cs

50 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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>().text = "姓:" + data.familyName + " 名:" + data.name + "/n性别" + sex + "/n职业" + data.occupation;
}
}
}