local UIBattleSummaryPanel = require("View/Battle/UIBattleSummaryPanel") local UIMaterialLevelSummary = UIViewClass(UIBattleSummaryPanel) local DelayTiming = 0.5 local WinEffectTime = 0.5 local StarTimeGap = 0.2 function UIMaterialLevelSummary:OnOpened(context) self:RegistSystemEvent(EventID.UI_LevelSelect_LevelFinished, self.OnLevelFinish) local count,totalCount = MDL.MaterialLevel.GetCount(context.MaterialId) if context.Win then if count == 0 then self.event_BackTown.gameObject:SetActive(false) self.event_Retry.gameObject:SetActive(false) self.RewardScroll.gameObject:SetActive(false) self.event_exit.gameObject:SetActive(true) UIUtils.SetLabelText(self.txt_Tips,Const_IDS.IDS_ResourcesChapter_RewardReminder_1) else self.event_exit.gameObject:SetActive(false) if context.isThreeStars then self.event_Retry.gameObject:SetActive(false) self.btn_State:SetState(1) else self.event_Retry.gameObject:SetActive(true) self.btn_State:SetState(0) end end self.isThreeStars = context.isThreeStars else self.isThreeStars = false self.event_BackTown.gameObject:SetActive(false) self.event_Retry.gameObject:SetActive(false) self.RewardScroll.gameObject:SetActive(false) self.event_exit.gameObject:SetActive(true) end self.summaryTemplateEffectHandle1,self.summaryTemplateEffectHandle2 = CTL.LevelSelect.ShowCommonSummaryTemplate(self,context.Win) end function UIMaterialLevelSummary:OnLevelFinish() self.mask.gameObject:SetActive(true) end function UIMaterialLevelSummary:OnUpdateFun(deltaTime, timeSinceUpdate) CameraController.Instance:SetDOF(true, 2) if timeSinceUpdate > self.delayTime and not self.obj_Container.gameObject.activeInHierarchy then self:ShowSummary(self.isWin) elseif timeSinceUpdate > WinEffectTime and self.obj_Container.gameObject.activeInHierarchy then if timeSinceUpdate - self.lastStarTime >= StarTimeGap then self:PlayStarEffect() self.lastStarTime = timeSinceUpdate end end end function UIMaterialLevelSummary:OnButtonClicked(comp) if comp == self.event_BackTown then if not self.isThreeStars then UTL.MessageBox.ShowOKCancelBox(Const_IDS.IDS_WARNING, Const_IDS.IDS_ResourcesChapter_ConfirmReminder_4, function () MDL.MaterialLevel.GetReward(self.isWin,self.stars) end ,MDL.Level.SendRoleLeaveFuben,Const_IDS.IDS_ResourcesChapter_button_3,Const_IDS.IDS_ResourcesChapter_button_4) return end MDL.MaterialLevel.GetReward(self.isWin,self.stars) elseif comp == self.event_Retry then MDL.Level.SendRoleLeaveFuben() elseif comp == self.event_exit then MDL.MaterialLevel.GetReward(self.isWin,self.stars) end end function UIMaterialLevelSummary:OnCellInit(scrollRect, index, cellTable, data) UTL.Item.SetItemCell(cellTable.item, data.ItemID, data.ItemNum) end function UIMaterialLevelSummary:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.RewardScroll then UTL.ItemTips.ShowCommonTipsById(data.ItemID) end end function UIMaterialLevelSummary:OnClosed() CTL.LevelSelect.RemoveSummaryTemplateEffect(self) end return UIMaterialLevelSummary