using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; using GCGame.Table; using Games.Mission; using Games.Events; using Games.Item; public class RegistInfoItem : UIItemBase { public Text _Idx; public Text _RegistTime; public Text _StartTime; public Text _RegCnt; public Text _State; private BattleFieldTurnInfo _RegistInfo; private System.DateTime _ActStartTime; private System.DateTime _ActEndTime; private void Update() { UpdateTime(); } #region public override void Show(Hashtable hash) { base.Show(hash); _RegistInfo = (BattleFieldTurnInfo)hash["InitObj"]; RefreshRegistInfo(); } public override void Refresh() { base.Refresh(); RefreshRegistInfo(); } private void RefreshRegistInfo() { _Idx.text = (_RegistInfo.TurnID).ToString(); var registTime = GCGame.Utils.GetServerDateTime((int)_RegistInfo.StTime); var registEndTime = GCGame.Utils.GetServerDateTime((int)_RegistInfo.BtTime - 60); _ActStartTime = GCGame.Utils.GetServerDateTime((int)_RegistInfo.BtTime); _ActEndTime = GCGame.Utils.GetServerDateTime((int)_RegistInfo.BtEndTime); //_RegistTime.text = string.Format("{0:HH:mm}", registTime) + "-" + string.Format("{0:HH:mm}", registEndTime); _StartTime.text = string.Format("{0:HH:mm}", _ActStartTime) + "-" + string.Format("{0:HH:mm}", _ActEndTime); _RegCnt.text = _RegistInfo.SignedNum.ToString(); } private void UpdateTime() { var serverTime = GCGame.Utils.GetServerDateTime(); if (serverTime > _ActEndTime) { _State.text = StrDictionary.GetClientDictionaryString("#{8151}"); } else if (serverTime > _ActStartTime && serverTime < _ActEndTime) { _State.text = StrDictionary.GetClientDictionaryString("#{8152}"); } else { var deltaTime = _ActStartTime - serverTime; var totalSec = deltaTime.TotalSeconds; _State.text = StrDictionary.GetClientDictionaryString("#{8153}", (int)totalSec); } } #endregion }