local UISweepView = require "View/Sweep/UISweepView" local UIGoldenHeroStorySweep = UIViewClass(UISweepView) function UIGoldenHeroStorySweep:OnOpened(context) self.activityId = context.activityId self.heroType = context.heroType self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) end function UIGoldenHeroStorySweep:InitView(context) self.typestate:SetState(1) local data = DataSheetManager.GoldHeroActivityLevel:GetDataByID(context.fuBenId) UIUtils.SetLabelText(self.txt_Stage,Const_IDS[data.BarrierName]) self.txt_Cost.text = data.EnergyNum self.costEnergy = data.EnergyNum self.btn_SkipTen.gameObject:SetActive(true) self.btn_SkipOne.gameObject:SetActive(true) self.btn_UseItem.gameObject:SetActive(false) self.btn_SkipAuto.gameObject:SetActive(false) end function UIGoldenHeroStorySweep:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView() end end end function UIGoldenHeroStorySweep:OnClickSweep(count) local currencyCount = MDL.GoldenHeroStory.GetGoldHeroLevelCurrencyCountByActivityId(self.activityId) if self.costEnergy * count > currencyCount then count = math.floor(currencyCount/self.costEnergy) self.noEnergy = true else self.noEnergy = false end if count > 0 then MDL.GoldenHeroStory.GoldHeroFBSweepRequest(self.context.activityId, self.context.fuBenId, count) -- 进副本 else if not CTL.GoldenHeroMain.OpenEnergyBuyViewByAttack(self.context.activityId, MDL.GoldenHeroMain.EnergyType.Story) then CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS.IDS_GoldHeroActivity_ActivityLevel_WrongHint1, UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.ItemData:GetDataByID(DataSheetManager.GoldHeroActivityModeData:GetDataByHeroType(self.heroType).LevelEnergyType).Name]))) end end end return UIGoldenHeroStorySweep