local EventSystem = require('Event/EventSystem') local UIGuildBossCountDown = UIViewClass() function UIGuildBossCountDown:OnOpened(context) self:StartRepeatFunc(self.OnUpdateFun, 1) self.reviveTime = BattleDataGetter.GetMainPlayerReviveTime() self.txt_Time.text = string.format(UIUtils.GetLocalizedTxt(Const_IDS.IDS_TimeSecond),string.format( "%.0f" , self.reviveTime / 1000)) CTL.Sound.PlayGameSound("SFX_die") CTL.ChannelChat.OnSelfDead(true) EventSystem.Dispatch(EventID.UIBattle_OnDeadChatDlgViewTop, true) end function UIGuildBossCountDown:OnUpdateFun(deltaTime, timeSinceUpdate) self.reviveTime = self.reviveTime - 1000 self.txt_Time.text = string.format(UIUtils.GetLocalizedTxt(Const_IDS.IDS_TimeSecond),string.format( "%.0f" , self.reviveTime / 1000)) if self.reviveTime<= 0 then self:CloseView() else CTL.Sound.PlayGameSound("UI_die_daojishi") end end function UIGuildBossCountDown:OnClosed() CTL.Sound.PlayGameSound("SFX_life") EventSystem.Dispatch(EventID.UIBattle_OnDeadChatDlgViewTop, false) CTL.ChannelChat.OnSelfDead(false) end return UIGuildBossCountDown