local UISuperGoldBossBattleSummary = UIViewClass() local DelayTiming = 0.5 local UpdateRepeatGapTime = 0.1 local AutoTimeOutTime = DataSheetManager.ConstData:GetDataByID("SuperGoldBossTime").IntValue function UISuperGoldBossBattleSummary:OnOpened(context) self:RegistSystemEvent(EventID.UI_SuperGoldBoss_SummaryOpt, self.SummaryOptCallBack) self.result = context.battleResult self.activityId = self.result.activityId self.summaryTemplateEffectHandle1, self.summaryTemplateEffectHandle2 = CTL.LevelSelect.ShowCommonSummaryTemplate(self, true) local passSeconds = context.passTime if passSeconds > UTL.Time.TotalSecondsOneMinute then local time = string.format(UIUtils.GetLocalizedTxt(Const_IDS.IDS_TimeMinute), math.floor(passSeconds / 60))..string.format(UIUtils.GetLocalizedTxt(Const_IDS.IDS_TimeSecond), passSeconds % 60) UIUtils.SetLabel(self.txt_ClearanceTime, time) else UIUtils.SetLabel(self.txt_ClearanceTime, string.format(UIUtils.GetLocalizedTxt(Const_IDS.IDS_TimeSecond), passSeconds)) end UIUtils.SetActive(self.panel_Summary.gameObject, false) local todayMaxScore = MDL.SuperGoldBoss.GetMaxScore(self.activityId) local battleTotalScore = self.result.score + self.result.killScore + self.result.timeScore + self.result.heroAdd self.txt_Score.text = battleTotalScore self.isHigher = battleTotalScore > todayMaxScore self.txt_HighestToday.text = todayMaxScore UIUtils.SetActive(self.group_HighestToday, todayMaxScore ~= 0) if battleTotalScore == todayMaxScore then self.state_Record:SetState(2) else self.state_Record:SetState(self.isHigher and 1 or 0) end UIUtils.SetActive(self.btn_Save, self.isHigher) UIUtils.SetActive(self.btn_Restart, not self.isHigher) self.timeText = self.isHigher and UIUtils.GetLocalizedTxt(Const_IDS.IDS_SuperGoldHeroActivity_HeroTrial_AccountHint11) or UIUtils.GetLocalizedTxt(Const_IDS.IDS_SuperGoldHeroActivity_HeroTrial_AccountHint12) self.timeComp = self.isHigher and self.txt_Hint or self.txt_Tips local heroData = DataSheetManager.HeroNum:GetDataByID(BattleDataGetter.GetMainPlayerCharacterID()) self.delayTime = heroData.PoseTime / 1000 + DelayTiming CTL.Sound.PlayGameSound("MUSIC_Victory") self:StartRepeatFunc(self.OnUpdate, UpdateRepeatGapTime, -1) end function UISuperGoldBossBattleSummary:OnUpdate(deltaTime, timeSinceUpdate) UIUtils.SetLabel(self.timeComp, string.format(self.timeText, math.abs(math.ceil(AutoTimeOutTime - timeSinceUpdate)))) if timeSinceUpdate > AutoTimeOutTime then self:TimeOutOpt() elseif timeSinceUpdate > self.delayTime and not self.panel_Summary.gameObject.activeInHierarchy then self:ShowSummary() end end function UISuperGoldBossBattleSummary:OnClosed() CTL.LevelSelect.RemoveSummaryTemplateEffect(self) end function UISuperGoldBossBattleSummary:OnButtonClicked(comp) if comp == self.btn_GiveUp then MDL.SuperGoldBoss.SuperGoldTrialResultOptReq(self.activityId, false) elseif comp == self.btn_Save then MDL.SuperGoldBoss.SuperGoldTrialResultOptReq(self.activityId, true) elseif comp == self.btn_Restart then MDL.SuperGoldBoss.EnterSuperGoldBoss(CTL.SuperGoldBoss.LoadTempData()) end end function UISuperGoldBossBattleSummary:TimeOutOpt() MDL.SuperGoldBoss.SuperGoldTrialResultOptReq(self.activityId, self.isHigher) self:StopRepeatFunc(self.OnUpdate) end function UISuperGoldBossBattleSummary:SummaryOptCallBack(activityId) if activityId == self.activityId then MDL.Level.SendRoleLeaveFuben() end end function UISuperGoldBossBattleSummary:ShowSummary() UIUtils.SetActive(self.panel_Summary.gameObject, true) CameraController.Instance:SetDOF(true, 2) self.txt_DamagePoint.text = self.result.score self.txt_KillPoint.text = self.result.killScore UIUtils.SetActive(self.group_KillPoint, self.result.killScore > 0) self.txt_TimeAdd.text = self.result.timeScore UIUtils.SetActive(self.group_TimePoint, self.result.timeScore > 0) self.txt_HPAdd.text = self.result.heroAdd UIUtils.SetActive(self.group_HPAdd, self.result.heroAdd > 0) UIUtils.SetActive(self.group_Reward, #self.result.reward > 0 and self.isHigher) for i, v in ipairs(self.result.reward) do self.loop_SummaryReward:AddData(v, 0) end end function UISuperGoldBossBattleSummary:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_SummaryReward then UTL.Item.SetItemCell(cellTable.item, data.ItemId, data.ItemCount) end end function UISuperGoldBossBattleSummary:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.loop_SummaryReward then UTL.ItemTips.ShowCommonTipsById(data.ItemId) end end return UISuperGoldBossBattleSummary