local UICountryWorldBossDetail = UIViewClass() local HERO_RENDER_ID = 1000001 local UIHeroLightEffectTool = require "View/Common/UIHeroLightEffectTool" function UICountryWorldBossDetail:OnOpened(context) self.UIheroLightEffectDatas = UIHeroLightEffectTool.CreateHeroLightEffectDatas(true) self.BossShowModelHandle = UTL.UIRender.CreateModelComponentDatas(self.img_BossShow) -- 创建handle,别忘记关闭时释放 self:RegistSystemEvent(EventID.UI_CountryWorldBoss_UpdateInfo, self.UpdateEnterBtnState) self:RegistSystemEvent(EventID.UI_CountryWorldBoss_UpdateRewardTimes, self.UpdateCountryWorldBossRewardTimes) self:RegistSystemEvent(EventID.UI_PurchaseNumsSuccess, self.UpdateCountryWorldBossRewardTimes) self.bossInfo = context self.txt_Info.text = UIUtils.GetLocalizedTxt(Const_IDS.IDS_CountryWorldBoss_JingXiTips) self.txt_Info2.text = UIUtils.GetLocalizedTxt(Const_IDS.IDS_WorldBoss_EquipRewardDes) self:RefreshCountryWorldBossInfo() self:UpdateCountryWorldBossRewardTimes() self:RefreshOfficialProfitTips() self:UIAdjustByRegion() CTL.Sound.PlayGameSound("UI_sound_Qiejiang") end function UICountryWorldBossDetail:OnButtonClicked(comp) if self.btn_Close == comp then UTL.UIRender.DisposeModelComponentData(self.BossShowModelHandle) self:CloseView() elseif comp == self.btn_Challenge then -- 进入战斗 if CTL.CountryWorldBoss.TryToEnterWorldBoss(self.bossInfo.BossConfig.ID) then MDL.CountryWorldBoss.SetIsEnterMain(true) end elseif comp == self.btn_Team then -- 组队平台 CTL.Team.OpenTeamPanel(LuaConst.ActivityType.CountryWorldBoss) elseif comp == self.btn_Tips then -- 收益tips UIUtils.SetActive(self.rect_CloseTips, true) UIUtils.SetActive(self.group_Tip, true) elseif comp == self.rect_CloseTips then UIUtils.SetActive(self.rect_CloseTips, false) UIUtils.SetActive(self.group_Tip, false) elseif self.btn_ParticipateRewardInfo == comp then UIUtils.SetActive(self.Btn_CloseClick, true) UIUtils.SetActive(self.group_TipsPanel2, true) elseif self.btn_OtherRewardInfo == comp then UIUtils.SetActive(self.Btn_CloseClick, true) UIUtils.SetActive(self.group_TipsPanel, true) elseif self.Btn_CloseClick == comp then UIUtils.SetActive(self.Btn_CloseClick, false) UIUtils.SetActive(self.group_TipsPanel, false) UIUtils.SetActive(self.group_TipsPanel2, false) end end function UICountryWorldBossDetail:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UICountryWorldBossDetail:OnCellInit(scrollRect, index, cellTable, data) UTL.Item.SetItemCell(cellTable.item, data.ItemID,data.ItemNum) end function UICountryWorldBossDetail:OnCellClicked(scrollRect, index, cellTable, target, data) UTL.ItemTips.ShowCommonTipsById(data.ItemID) end function UICountryWorldBossDetail:RefreshCountryWorldBossInfo() local bossConfig = self.bossInfo.BossConfig UTL.UIRender.CreateRTSceneTrans(self.BossShowModelHandle, bossConfig.ModelLight) UTL.UIRender.CreateRTRenderModel(self.BossShowModelHandle, bossConfig.BossShow, bossConfig.ModelScale, bossConfig.ShowEquipmentID, HERO_RENDER_ID, nil) UIUtils.SetLabel(self.txt_Condition02, CTL.LevelSelect.GetSubjugateGsText(bossConfig.SubjugateDataPVE, bossConfig.Battle)) -- 设置背景 UIUtils.SetImageByAssetBundle(self.img_ParticipateRewardTitleBG, bossConfig.WarZoneBossTips) UIUtils.SetImageByAssetBundle(self.img_AscriptionRewardTitleBG, bossConfig.WarZoneBossTips) UIUtils.SetImageByAssetBundle(self.img_OtherRewardTitleBG, bossConfig.WarZoneBossTips) -- 参与奖励 local participateShowReward = bossConfig.ParticipateShowReward local cfg = DataSheetManager.RewardClientShow:GetDataByClientShowID(participateShowReward) local rewardData = DataSheetUtil.GetRewardClientShowItemTable(cfg) self.loop_ParticipateReward:ReloadAll(rewardData) -- 战胜国奖励 local victoryCountryReward = bossConfig.ExtraShowReward2 local victoryCountryCfg = DataSheetManager.RewardClientShow:GetDataByClientShowID(victoryCountryReward) local victoryCountryData = DataSheetUtil.GetRewardClientShowItemTable(victoryCountryCfg) self.loop_AscriptionReward:ReloadAll(victoryCountryData) -- 额外奖励 local extraShowReward = bossConfig.ExtraShowReward local extraShowCfg = DataSheetManager.RewardClientShow:GetDataByClientShowID(extraShowReward) local extraShowData = DataSheetUtil.GetRewardClientShowItemTable(extraShowCfg) self.loop_OtherReward:ReloadAll(extraShowData) self:UpdateEnterBtnState() end --更新按钮状态 function UICountryWorldBossDetail:UpdateEnterBtnState() self.bossState = CTL.WorldBoss.GetBossStateAndLev(self.bossInfo) if self.bossState == CTL.PersonalBoss.BossState.Opening then self.btn_Challenge:SetGray(false) else self.btn_Challenge:SetGray(true, true) end end function UICountryWorldBossDetail:UpdateCountryWorldBossRewardTimes() local totalTimes = DataSheetManager.ActivityData:GetDataByID(LuaConst.ActivityType.CountryWorldBoss).DailyRefreshTimes --只显示基础次数 local str = string.format("%d/%d", MDL.CountryWorldBoss.GetRewardCountLeft(), totalTimes) if MDL.CountryWorldBoss.GetRewardCountLeft() == 0 then str = UTL.Color.FormatRedColor(str) elseif MDL.CountryWorldBoss.GetRewardCountLeft() > totalTimes then str = UTL.Color.FormatGreenColor(str) end UIUtils.SetLabel(self.txt_Times,str) end function UICountryWorldBossDetail:RefreshOfficialProfitTips() UIUtils.SetActive(self.rect_CloseTips, false) UIUtils.SetActive(self.group_Tip, false) local profitGradeId1 = DataSheetManager.ConstData:GetDataByID("OfficialProfitWorldBossShowID1").IntValue local profitGradeId2 = DataSheetManager.ConstData:GetDataByID("OfficialProfitWorldBossShowID2").IntValue local curGradeId = MDL.OfficialPosition.GetCurGradeID() if curGradeId > 0 and curGradeId <= profitGradeId1 then UIUtils.SetImageByAssetBundle(self.Image, ConstAssetPathConfig.AssetPath118) else UIUtils.SetImageByAssetBundle(self.Image, ConstAssetPathConfig.Path19) end local profit1 = MDL.OfficialPosition.GetProfitParamByGradeId("WarZoneBossProfit", profitGradeId1) local profit2 = MDL.OfficialPosition.GetProfitParamByGradeId("WarZoneBossProfit", profitGradeId2) local str1 = string.FormatByIdsId(Const_IDS.IDS_OfficialProfit_Double, CTL.OfficialPosition.GetGradeDescByGradeID(profitGradeId1), profit1) local str2 = string.FormatByIdsId(Const_IDS.IDS_OfficialProfit_Double, CTL.OfficialPosition.GetGradeDescByGradeID(profitGradeId2), profit2) if curGradeId > 0 then if curGradeId <= profitGradeId2 then str2 = UTL.Color.FormatGreenColor(str2) elseif curGradeId <= profitGradeId1 then str1 = UTL.Color.FormatGreenColor(str1) end end UIUtils.SetLabel(self.txt_Tips, str1.."\n"..str2) end function UICountryWorldBossDetail:UIAdjustByRegion() --越南地区屏蔽乱世争雄概率掉落双倍奖励入口 JWS2-45067 if GameAppInfo.IsVietnamPackage() then UIUtils.SetActive(self.group_OfficialProfit, false) UIUtils.SetActive(self.group_Tip, false) end end return UICountryWorldBossDetail