using Assets.Scripts; using Assets.Scripts.Apis.Models; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class MailItemController : MonoBehaviour { // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void Initial(MailModel item) { var color = item.IsRead ? Utils.HexToColorHtml("#5C5C6E") : Utils.HexToColorHtml("#ffffff"); Text title = transform.Find("Content/Title").GetComponent(), time = transform.Find("Content/Time").GetComponent(); title.text = item.Title; time.text = item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"); title.color = color; time.color = color; transform.Find("Content/MailImage").GetComponent().color = color; UIManager.AddEvent(gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => { UIManager.ShowMailDetailPanel(item); }); } }