1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- 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<string, Transform> childDictionary = new Dictionary<string, Transform>();
- Auxiliary.CompileDic(transform, childDictionary);
- NicknameTitle = childDictionary[PrivateMessageItemLabel.Nickname].GetComponent<Text>();
- ContentTitle = childDictionary[PrivateMessageItemLabel.Content].GetComponent<Text>();
- TimeTitle = childDictionary[PrivateMessageItemLabel.Time].GetComponent<Text>();
- 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;
- }
- }
- }
|