using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using GCGame.Table; using System; public class TestingRankItem : UIItemBase { private const string _OriginColor = "{0}"; private const string _SelefColor = "{0}"; public GameObject _RankIconPanel; public List _RankIconList; public Text _Rank; public Text _Name; public Text _Level; public Text _Time; public override void Show(Hashtable hash) { base.Show(hash); TestingCopyRankInfo info = (TestingCopyRankInfo)hash["InitObj"]; if(info._Rank <= 3) { _RankIconPanel.SetActive(true); for(int index = 0; index < _RankIconList.Count; index++) { _RankIconList[index].SetActive(info._Rank - 1 == index); } _Rank.gameObject.SetActive(false); }else { _RankIconPanel.SetActive(false); _Rank.gameObject.SetActive(true); _Rank.text = info._Rank.ToString(); } _Name.text = string.Format(info._IsSelf ? _SelefColor : _OriginColor, info._Name); _Level.text = string.Format(info._IsSelf ? _SelefColor : _OriginColor, info._PassedLevel.ToString()); _Time.text = string.Format(info._IsSelf ? _SelefColor : _OriginColor, GetTime(info._OnRankTime)); } public string GetTime(long time) { string _Time = ""; DateTime startTime = (new DateTime(1970, 1, 1).AddSeconds(time)).ToLocalTime(); _Time = startTime.Year + "." + startTime.Month + "." + startTime.Day; return _Time; } }