local UISuperGoldStoryLevelInfo = UIViewClass() local EventSystem = require('Event/EventSystem') function UISuperGoldStoryLevelInfo:OnOpened(context) self.activityId = context.activityId self.heroType = context.heroType self.storyLevelCfg = context.storyLevelInfo.levelCfg self.levelState = context.storyLevelInfo.levelState self:RegistSystemEvent(EventID.UI_GoldenHero_RefreshCurrency, self.RefreshLevelInfoPanel) self:RegistSystemEvent(EventID.UI_GoldenHeroStory_RefreshStoryStarPanel, self.RefreshLevelInfoPanel) self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) self:RefreshLevelInfoPanel() end function UISuperGoldStoryLevelInfo:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView() end end end function UISuperGoldStoryLevelInfo:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UISuperGoldStoryLevelInfo:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() elseif comp == self.btn_GoTo then -- 前往副本 self:EnterGoldHeroStoryFuBen() end end function UISuperGoldStoryLevelInfo:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_LevelReward then UTL.Item.SetItemCell(cellTable.item, data[1].ItemID, data[1].ItemNum, data[2]) UIUtils.SetActive(cellTable.item.sprite_Selected, false) UIUtils.SetActive(cellTable.item.sprite_Arrow, false) end end function UISuperGoldStoryLevelInfo:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.loop_LevelReward then UTL.ItemTips.ShowCommonTipsById(data[1].ItemID) end end function UISuperGoldStoryLevelInfo:RefreshLevelInfoPanel() UIUtils.SetLabelText(self.txt_Task, Const_IDS[self.storyLevelCfg.BarrierName]) -- 关卡标题 UIUtils.SetImageByAssetBundle(self.img_Level, self.storyLevelCfg.BarrierPic) -- 关卡图片 UIUtils.SetLabelText(self.txt_Desc, Const_IDS[self.storyLevelCfg.BarrierDes]) -- 关卡描述 local levelState = MDL.SuperGoldStory.GetGoldHeroLevelStateByActivityID_LevelID(self.activityId, self.storyLevelCfg.LevelID) -- 关卡状态 UIUtils.SetActive(self.group_Reward, levelState == MDL.GoldenHeroStory.LevelState.UnLock) if levelState == MDL.GoldenHeroStory.LevelState.UnLock then -- 奖励 local cfg = DataSheetManager.RewardClientShow:GetDataByClientShowID(self.storyLevelCfg.RewardClientShowID) local rewardData = DataSheetUtil.GetRewardClientShowItemTable(cfg) if self.loop_LevelReward.Count > 0 then self.loop_LevelReward:ClearCells() end for i, v in ipairs(rewardData) do local cellData if v.FristGothrough then cellData = {v, true} else cellData = {v, false} end if cellData then self.loop_LevelReward:AddData(cellData, 0) end end end end -- 进攻 function UISuperGoldStoryLevelInfo:EnterGoldHeroStoryFuBen() if self.levelState == MDL.GoldenHeroStory.LevelState.Lock then CTL.Tips.AddTipsMsg(Const_IDS.IDS_GoldHeroActivity_ActivityLevel_LockHint3) -- 请先完成前置任务 else local levelId = self.storyLevelCfg.LevelID NotSyncBattleSetter.StopAutoFightPathInTown() MDL.SuperGoldStory.EnterSuperGoldStoryRequest(levelId, self.storyLevelCfg.MissonDataID[1], self.activityId) -- 进副本 end end return UISuperGoldStoryLevelInfo