local UIStormBattle = UIViewClass() function UIStormBattle:OnOpened(context) self:RegistSystemEvent(EventID.StormChallenge_ScoreChange, self.OnRefreshScore) self:RegistSystemEvent(EventID.UI_Storm_OnBossStateChange, self.OnBossStateChanged) self.curScore = BattleDataGetter.GetLevelScore() or 0 self.maxScore = MDL.Storm.GetMaxScore() self.coVal = DataSheetManager.StormLevelBR:GetDataByID(MDL.Storm.GetLastSelectDifficultID(MDL.Storm.GetEnterBattleLine())).LevelScoreCoef self:SetScoreShow() UIUtils.SetActive(self.group_Rampage.gameObject, false) end -- Boss进入狂暴状态 -- state:(0:正常倒计时(目前只用于节点显隐判断) ; 1:n秒后进入狂暴 ;2:狂暴中) -- second: 需要显示的时间 function UIStormBattle:OnBossStateChanged(state, second) if state == 0 then UIUtils.SetActive(self.group_Rampage.gameObject, false) elseif state == 1 then UIUtils.SetActive(self.group_Rampage.gameObject, true) self.rampageCountDown = second self:RampageCountDown() self:StartRepeatFunc(self.RampageCountDown, 1) elseif state == 2 then UIUtils.SetActive(self.group_Rampage.gameObject, true) UIUtils.SetLabelText(self.txt_Rampage, Const_IDS["IDS_Storm_BOSSViolentTime2"]) end end function UIStormBattle:RampageCountDown(deltaTime, timeSinceUpdate) if self.rampageCountDown > 0 then self.rampageCountDown = self.rampageCountDown - 1 UIUtils.SetLabel(self.txt_Rampage, string.FormatByIdsId(Const_IDS["IDS_Storm_BOSSViolentTime1"], self.rampageCountDown)) else self:StopRepeatFunc(self.RampageCountDown) end end function UIStormBattle:OnRefreshScore(score) self.curScore = score * self.coVal if self.curScore > self.maxScore then self.maxScore = self.curScore end self:SetScoreShow() end function UIStormBattle:SetScoreShow() -- 当前伤害 UIUtils.SetLabel(self.txt_NumberRecord, self.maxScore) -- 最高伤害 UIUtils.SetLabel(self.txt_NumberNow, self.curScore) end return UIStormBattle