powerfun-unity/Assets/Scripts/UI/Prefab/Mail/MailItemController.cs
2022-03-02 17:54:06 +08:00

38 lines
1.1 KiB
C#

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<Text>(), time = transform.Find("Content/Time").GetComponent<Text>();
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<Image>().color = color;
UIManager.AddEvent(gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.ShowMailDetailPanel(item);
});
}
}