local UIGoldenHeroTry = UIViewClass() local HeroPicPath = ConstAssetPathConfig.HeroPicPath local NormalScaleSize = 1.2 local PADScreenScaleSize = 1.4 function UIGoldenHeroTry:OnOpened(context) self.activityId = context.activityId self.heroType = context.heroType self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) local heroTypeData = DataSheetManager.GoldHeroActivityModeData:GetDataByHeroType(self.heroType) self.tryLevelId = heroTypeData.TryLevelID self.tryLevelData = DataSheetManager.GoldHeroActivityTryLevel:GetDataByTryLevelID(self.tryLevelId) --标题 UIUtils.SetLabelText(self.txt_Title, Const_IDS[self.tryLevelData.BarrierName]) --首通奖励 --是否已经通关领取了奖励 local isGot = not MDL.GoldenHeroMain.GetHeroTryFirstPassRp() local cfg = DataSheetManager.RewardClientShow:GetDataByClientShowID(self.tryLevelData.RewardClientShowID) self.rewardData = DataSheetUtil.GetRewardClientShowItemTable(cfg) for i, v in ipairs(self.group_Reward) do local reward = self.rewardData[i] if reward then UTL.Item.SetItemCell(v.Item, reward.ItemID, reward.ItemNum, reward.FristGothrough) UIUtils.SetActive(v.group_Got, isGot or false) UIUtils.SetActive(v.gameObject, true) else UIUtils.SetActive(v.gameObject, false) end end self.heroId = heroTypeData.SynergyBossHeroID self:ShowHeroInfo(self.heroId) end function UIGoldenHeroTry:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView() end end end function UIGoldenHeroTry:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UIGoldenHeroTry:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() elseif comp == self.btn_Try then MDL.GoldenHeroMain.EnterHeroTry(self.activityId, self.tryLevelId, self.tryLevelData.MissonDataID[1]) elseif comp == self.btn_Check then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIGoldenHeroTryShow, {activityId = self.activityId, heroID = self.heroId}, "HeroSelect/UIHeroSelectPanel") else for i, v in ipairs(self.group_Reward) do if comp == v.Item.event_Click then UTL.ItemTips.ShowCommonTipsById(self.rewardData[i].ItemID) end end end end function UIGoldenHeroTry:ShowHeroInfo(heroId) --武将相关 local heroData = DataSheetManager.HeroNum:GetDataByID(self.heroId) UIUtils.SetLabelText(self.txt_Name, Const_IDS[heroData.NameIDS]) UIUtils.SetImageByAssetBundle(self.img_Hero, string.format(HeroPicPath, heroData.JPHalfCardImage)) local scale = self.tryLevelData.HeroSize self.img_Hero:SetNativeSize() self.img_Hero.transform:SetLocalScale(scale, scale, scale) self.img_Hero.transform:SetLocalPosition(self.tryLevelData.HeroOffsetX, self.tryLevelData.HeroOffsetY, 0) end return UIGoldenHeroTry