local UICommonSummary = UIViewClass() function UICommonSummary:OnOpened(context) self:StartRepeatFunc(self.OnUpdate, 1, -1, true) self.isWin = context.isWin if self.isWin then CTL.Sound.PlayGameSound("MUSIC_Victory") self.txt_Time.text = UTL.Time.FormatTimeBySeconds(context.Time) --奖励 for _, v in ipairs(context.Reward) do self.loop_SummaryReward:AddData(v, 0) end UIUtils.SetActive(self.group_LevelReward, self.loop_SummaryReward.Count > 0) self.obj_state:SetState(1) else CTL.Sound.PlayGameSound("MUSIC_Fail") self.obj_state:SetState(0) end self.summaryTemplateEffectHandle1,self.summaryTemplateEffectHandle2 = CTL.LevelSelect.ShowCommonSummaryTemplate(self,self.isWin) self:SetSummaryInfo(context) end function UICommonSummary:SetSummaryInfo(context) UIUtils.SetActive(self.group_BtnNext, false) UIUtils.SetActive(self.group_BtnAgain, false) UIUtils.SetActive(self.group_Hint, false) if self.isWin then self.txt_Back.text = nil local seconds = DataSheetManager.ConstData:GetDataByID("ClimbTowerAutoQuit").IntValue self.leftTime = seconds self.txt_Back.text = string.FormatByIdsId(Const_IDS.IDS_ClimbTower_AutoQuit, seconds) else local seconds = DataSheetManager.ConstData:GetDataByID("ClimbTowerAutoQuit").IntValue self.leftTime = seconds self.txt_Exit.text = string.FormatByIdsId(Const_IDS.IDS_ClimbTower_AutoQuit, seconds) UIUtils.SetActive(self.group_BtnAgain.gameObject, true) end end function UICommonSummary:OnClickExit() MDL.Level.SendRoleLeaveFuben() --退出副本 end function UICommonSummary:OnClickAgain() logging.error(LTAG.ERROR, "UICommonSummary:OnClickAgain()此方法需要重写,这个LOG不应该被打印!!!") end function UICommonSummary:OnClickNext() logging.error(LTAG.ERROR, "UICommonSummary:OnClickNext()此方法需要重写,这个LOG不应该被打印!!!") end function UICommonSummary:OnUpdate(deltaTime, timeSinceUpdate) local timeOffset = self.leftTime - timeSinceUpdate if timeOffset > 0 then if self.isWin then self.txt_Back.text = string.FormatByIdsId(Const_IDS.IDS_ClimbTower_AutoQuit, timeOffset) else self.txt_Exit.text = string.FormatByIdsId(Const_IDS.IDS_ClimbTower_AutoQuit, timeOffset) end else self:StopRepeatFunc(self.OnUpdate) self:OnButtonClicked(self.btn_BackTown) end end function UICommonSummary:OnButtonClicked(comp) if comp == self.btn_BackTown or comp == self.btn_Exit then self:OnClickExit() elseif comp == self.btn_Again then self:OnClickAgain() elseif comp == self.btn_Next then self:OnClickNext() end end function UICommonSummary:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_SummaryReward then UTL.Item.SetItemCell(cellTable.UIItem, data.ItemId, data.ItemCount) end end function UICommonSummary:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.loop_SummaryReward then if target == cellTable.UIItem.event_Click then UTL.ItemTips.ShowCommonTipsById(data.ItemId) end end end function UICommonSummary:OnClosed() CTL.LevelSelect.RemoveSummaryTemplateEffect(self) end return UICommonSummary