using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using UnityEngine; using UnityEngine.Experimental.GlobalIllumination; using UnityEngine.PlayerLoop; using UnityEngine.UI; namespace ET.Client { #region 定时器 刷新 [Invoke(TimerInvokeType.fightTimeShow)] public class UIStartFightRoomComponentChecker : ATimer { protected override void Run(UIStartFightRoomComponent self) { try { self.Check(); } catch (Exception e) { Log.Error($"idle check error: {self.Id}\n{e}"); } } } [Invoke(TimerInvokeType.startFightTimeCount)] public class UIStartFightTimeCountChecker : ATimer { protected override void Run(UIStartFightRoomComponent self) { try { self.UpdateTimeCount(); } catch (Exception e) { Log.Error($"idle check error: {self.Id}\n{e}"); } } } #endregion [FriendOf(typeof(UIStartFightRoomComponent))] public static class UIStartFightRoomComponentSystem { public static void Check(this UIStartFightRoomComponent self) { self.timeTxt.text = string.Format("{0}:{1}", DateTime.Now.Hour, DateTime.Now.Minute); } public static void UpdateTimeCount(this UIStartFightRoomComponent self) { if (self.startTimeCount > 0) { self.timeCountTxt.text = self.startTimeCount.ToString(); } else { if (self.startTimer > 0) TimerComponent.Instance?.Remove(ref self.startTimer); self.timeCountTxt.text = ""; } self.startTimeCount = self.startTimeCount - 1; } [ObjectSystem] public class UIStartFightRoomComponentAwakeSystem : AwakeSystem { protected override void Awake(UIStartFightRoomComponent self, params object[] param) { ReferenceCollector rc = self.GetParent().GameObject.GetComponent(); //头像部分 self.houseIdTxt = rc.Get("houseIdTxt"); self.gameNumTxt = rc.Get("gameNumTxt"); self.curResidueTxt = rc.Get("curResidueTxt"); //右上系统信息部分 self.wifiImage = rc.Get("wifiImage"); self.powerImage = rc.Get("powerImage"); var timeTxt = rc.Get("timeTxt"); self.timeTxt = timeTxt.GetComponent(); self.menuBtn = rc.Get("menuBtn"); self.menuBtn.GetComponent