Files
JJBB/Assets/Project/Script/GUI/StroyCopy/TestingRankItem.cs

52 lines
1.7 KiB
C#
Raw Normal View History

2024-08-23 15:49:34 +08:00
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 = "<color=#d4d6db>{0}</color>";
private const string _SelefColor = "<color=#59ee60>{0}</color>";
public GameObject _RankIconPanel;
public List<GameObject> _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;
}
}