using UnityEngine; using UnityEngine.UI; public class NeedForWhiteCoolTime : ILBehaviour { Text m_Time; protected override void Awake() { m_Time = proxy.GetWidgtEx("Txt_Time"); } protected override void OnEnable() { GlobalTimeEvent.Instance.secondEvent += RefreshSecond; RefreshSecond(); } protected override void OnDisable() { //关闭游戏触发报错 GlobalTimeEvent为空? GlobalTimeEvent.Instance.secondEvent -= RefreshSecond; } private void RefreshSecond() { int seconds = NeedForWhiteModel.Instance.GetCloseSeconds(); if (seconds > 0) { m_Time.text = StringUtility.Contact("", TimeUtility.SecondsToDHMS(seconds), ""); } else { m_Time.text = UIHelper.AppendColor(TextColType.White, Language.Get("XMZZ110")); } } }