using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class PrivateMessageData { public string SerialNumber; public string Nickname; public string Content; public DateTime Date; public PrivateMessageData(string serialNumber, string nickname, string content, DateTime date) { SerialNumber = serialNumber; Nickname = nickname; Content = content; Date = date; } } public class PrivateMessageItemLabel { public static string MessageItem = "MessageItem"; public static string Nickname = "Nickname"; public static string Content = "Content"; public static string Time = "Time"; public static string Frame = "Frame"; } public class PrivateMessageItem : VirtualScrollRectItem { #region Config public Text NicknameTitle; public Text ContentTitle; public Text TimeTitle; public PrivateMessageData PrivateMessageData; #endregion public override bool Init() { if (base.Init()) { return true; } Dictionary childDictionary = new Dictionary(); Auxiliary.CompileDic(transform, childDictionary); NicknameTitle = childDictionary[PrivateMessageItemLabel.Nickname].GetComponent(); ContentTitle = childDictionary[PrivateMessageItemLabel.Content].GetComponent(); TimeTitle = childDictionary[PrivateMessageItemLabel.Time].GetComponent(); return false; } public void Reset(PrivateMessageData privateMessageData) { PrivateMessageData = privateMessageData; ContentTitle.text = privateMessageData.Content; TimeTitle.text = HttpManager.GetTimespanAndTransfer(privateMessageData.Date); if (privateMessageData.SerialNumber == HttpManager.SerialNumber) { NicknameTitle.text = Language.GetStr(LanguageLabel.CommentItem__Me); NicknameTitle.color = Lib.PrivateMessageSelfGreen; } else { NicknameTitle.text = privateMessageData.Nickname; NicknameTitle.color = Lib.PrivateMessageOtherBlack; } } }