local UIBossChallengeSummaryPanel = UIViewClass() local AutoExitBarrierTime = DataSheetManager.ConstData:GetDataByID("AutoExitBarrier").IntValue local DelayTiming = 0.5 function UIBossChallengeSummaryPanel:OnOpened(context) local info = context[1] self:SetBossChallengeScore(info) self:SetBossChallengeText(info.curPoint) local heroData = DataSheetManager.HeroNum:GetDataByID(BattleDataGetter.GetMainPlayerCharacterID()) self.delayTime = heroData.PoseTime / 1000 + DelayTiming self:StartRepeatFunc(self.OnUpdateFun, 0) end function UIBossChallengeSummaryPanel:SetBossChallengeScore(info) self.txt_Score.text = info.curPoint self.txt_TimeScore.text = "+" .. info.passTimePoint self.txt_Damage.text = UTL.Attr.FormatNumberToPercentage(1 - info.bossHpLeft, 0) self.txt_DamageScore.text = "+" .. info.bossHpLeftPoint self.txt_SurvivalNum.text = info.heroLeft self.txt_SurvivalScore.text = "+" .. info.heroLeftPoint if info.bossKilledPoint > 0 then UIUtils.SetLabelText(self.txt_BossKill, Const_IDS["IDS_BossChallenge_Settlement_ScoreInfo_Yes"]) self.txt_Time.text = self:FormatTime(info.passTime) else UIUtils.SetLabelText(self.txt_BossKill, Const_IDS["IDS_BossChallenge_Settlement_ScoreInfo_No"]) UIUtils.SetLabelText(self.txt_Time, Const_IDS["IDS_BossChallenge_Settlement_ScoreInfo_NotPass"]) end self.txt_BossKillScore.text = "+" .. info.bossKilledPoint self.difficult = DataSheetManager.BossChallengeLevel:GetDataByID(info.bossLevelId).Difficulty self.seasonId = info.seasonId self.bossLevelId = CTL.BossChallenge.GetSeasonBossLevelList(self.seasonId)[self.difficult] self.bossId = CTL.BossChallenge.GetSeasonBossById(self.seasonId) local scoreData = DataSheetManager.BossChallengeScore:GetDataByID(self.difficult) if self.difficult == MDL.BossChallenge.Difficult.Nightmare then UIUtils.SetActive(self.txt_ScoreLimit, false) else self.txt_ScoreLimit.text = "/" .. scoreData.MaxScore end UIUtils.SetActive(self.img_NewRecord, info.curPoint > info.lastPoint) end function UIBossChallengeSummaryPanel:SetBossChallengeText(score) local name = DataSheetManager.BossChallengeData:GetDataByID(self.bossId).BossChallengeName self.txt_Target.text = string.Concat(UIUtils.GetLocalizedTxt(Const_IDS[name]), UIUtils.GetLocalizedTxt(Const_IDS[MDL.BossChallenge.DifficultIDS[self.difficult]])) local isPass, stateText = CTL.BossChallenge.GetBossChallengeSummaryStateText(self.seasonId, self.difficult, score) UIUtils.SetActive(self.event_ChallengeAgain, not isPass) if isPass then UIUtils.SetActive(self.txt_NotPass, false) UIUtils.SetActive(self.txt_Pass, true) self.txt_Pass.text = stateText CTL.Sound.PlayGameSound("MUSIC_Victory") else UIUtils.SetActive(self.txt_NotPass, true) UIUtils.SetActive(self.txt_Pass, false) self.txt_NotPass.text = stateText CTL.Sound.PlayGameSound("MUSIC_Fail") end end function UIBossChallengeSummaryPanel:OnUpdateFun(deltaTime, timeSinceUpdate) UIUtils.SetLabel(self.txt_Tips, string.FormatByIdsId(Const_IDS.IDS_AutoExit, math.abs(math.ceil(AutoExitBarrierTime - timeSinceUpdate)))) CameraController.Instance:SetDOF(true, 2) if timeSinceUpdate > AutoExitBarrierTime then self:OnClickBackTownButton() elseif timeSinceUpdate > self.delayTime and not self.group_Right.gameObject.activeInHierarchy then UIUtils.SetActive(self.group_Right.gameObject, true) end end function UIBossChallengeSummaryPanel:FormatTime(passTime) if passTime > UTL.Time.TotalSecondsOneMinute then local passMinutes = math.floor(passTime / UTL.Time.TotalSecondsOneMinute) local passSeconds = passTime % UTL.Time.TotalSecondsOneMinute local passMinText = string.FormatByIdsId(Const_IDS.IDS_TimeMinute, passMinutes) local passSecText = string.FormatByIdsId(Const_IDS.IDS_TimeSecond, passSeconds) return string.format("%s%s", passMinText, passSecText) else return string.FormatByIdsId(Const_IDS.IDS_TimeSecond, passTime) end end function UIBossChallengeSummaryPanel:OnButtonClicked(comp) if comp == self.event_BackTown then self:OnClickBackTownButton() elseif comp == self.event_ChallengeAgain then self:OnClickChallengeAgain() end end function UIBossChallengeSummaryPanel:OnClickChallengeAgain() local heroFormationList = MDL.BossChallenge.LoadBossFormation(self.seasonId, self.bossLevelId) for i, v in ipairs(heroFormationList) do if v == 0 then CTL.Tips.AddTipsMsg(Const_IDS["IDS_BossChallenge_ChooseHero_LackHero"]) return end end MDL.BossChallenge.EnterBossChallengeRequest(self.bossLevelId, self.seasonId, heroFormationList) end -- 点击按钮回城 function UIBossChallengeSummaryPanel:OnClickBackTownButton() MDL.Level.SendRoleLeaveFuben() self:StopRepeatFunc(self.OnUpdateFun) end return UIBossChallengeSummaryPanel