public override void OnShow(object msg) { base.OnShow(msg); StopUpdate(); MSG_TimeInfo timeInfo = msg as MSG_TimeInfo; if (timeInfo != null && timeInfo.time > 0) { m_TimerText.gameObject.SetActive(true); m_CallBackAction = timeInfo.CallbackAction; uint time = timeInfo.time / 1000; uint min = time / 60; uint sec = time - 60 * min; uint ssec = timeInfo.time - 60 * min * 1000 - sec * 1000; string ms = min.ToString(); string ss = sec.ToString(); if (min > 0) { if (sec < 10) { ss = 0 + ss; } m_TimerText.text = ms + ":" + ss; if (m_MsTimeGameObject) { m_MsTimeGameObject.SetActive(min <= 0 && sec < 10); } } else if (min <= 0) { if (sec < 10) { m_IsPlaySMusic = true; WwiseUtil.PlaySound(51, false, m_TimerText.transform); m_TimerText.text = ss; m_MsTimerText.text = "." + ssec; } else { m_TimerText.text = ss; } } m_ForeFrameTime = ServerTimeUtil.Instance.GetNowTimeMSEL(); m_SecondTime = m_ForeFrameTime; m_Timer = (int)timeInfo.time; StartUpdate(); } else { WwiseUtil.PlaySound(53, false, m_TimerText.transform); m_IsPlaySMusic = false; m_TimerText.gameObject.SetActive(false); m_MsTimeGameObject.SetActive(false); } }
/// <summary> /// 打开倒计时界面 /// </summary> public void OpenCountDownTimePanel(bool isneed, uint time = 10) { if (isneed) { MSG_TimeInfo info = new MSG_TimeInfo(); info.time = time; info.CallbackAction = PlayTimeOverAction; UIManager.Instance.OpenPanel(UIPanel.HudDangerTipPanel, info); } else { UIManager.Instance.ClosePanel(UIPanel.HudDangerTipPanel); } }