local UIWarZonePanel = UIViewClass() function UIWarZonePanel:OnOpened() self:RegistSystemEvent(EventID.WarZone_State_Change, self.RefreshPreviewTimer) UTL.Item.SetLocalizationImage(self.group_Infos[1].loc_WarZoneBoss, self.group_Infos[1].img_WarZoneBoss, "zqjc_msz_01.png") UTL.Item.SetLocalizationImage(self.group_Infos[2].loc_GuildBoss, self.group_Infos[2].img_GuildBoss, "zqjc_msz_02.png") UTL.Item.SetLocalizationImage(self.group_Infos[3].loc_WarzoneFeatures, self.group_Infos[3].img_WarzoneFeatures, "zqjc_msz_03.png") UTL.Item.SetLocalizationImage(self.group_Infos[4].loc_DemonGod, self.group_Infos[4].img_DemonGod, "zqjc_msz_04.png") UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_WarZone_Title_1) UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, false) self:InitRewards() self.selectedIndex = 0 self:SelectedTab(1) self:RefreshPreviewTimer() self:StartRepeatFunc(self.RefreshPreviewTimer, 1, -1) end function UIWarZonePanel:OnClosed() UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, true) end function UIWarZonePanel:InitRewards() -- 乱世奖励 local rewardID = DataSheetManager.ConstData:GetDataByID("WarZoneBossRewardShow").IntValue local cfg = DataSheetManager.RewardClientShow:GetDataByClientShowID(rewardID) local levelRewardTable = DataSheetUtil.GetRewardClientShowItemTable(cfg) for _,v in ipairs(levelRewardTable) do self.group_Infos[1].loop_WarZoneBossPrize:AddData(v, 0) end -- 魔神降世 local rewardID = DataSheetManager.ConstData:GetDataByID("WarZoneDemonGod").IntValue local levelRewardTable = DataSheetManager.DemonGodBossReward:GetDataByID(rewardID).Item_Table for _,v in ipairs(levelRewardTable) do self.group_Infos[4].loop_DemonGod:AddData(v, 0) end end function UIWarZonePanel:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.group_Infos[1].loop_WarZoneBossPrize then UTL.Item.SetItemCell(cellTable.item, data.ItemID,data.ItemNum) elseif scrollRect == self.group_Infos[4].loop_DemonGod then UTL.Item.SetItemCell(cellTable.item, data.ItemID,data.ItemNum) end end function UIWarZonePanel:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.group_Infos[1].loop_WarZoneBossPrize then if target == cellTable.item.event_Click then UTL.ItemTips.ShowCommonTipsById(data.ItemID) end elseif scrollRect == self.group_Infos[4].loop_DemonGod then if target == cellTable.item.event_Click then UTL.ItemTips.ShowCommonTipsById(data.ItemID) end end end function UIWarZonePanel:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UIWarZonePanel:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then self:CloseView(true) elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.UITemplateTitlePanel.btn_Info then -- UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.Horse}) elseif comp == self.Btn_Check then UIManager.OpenView(Const_UI_Lua.UIEnum.UIWarzoneList) elseif comp == self.Btn_Go then if self.selectedIndex == 1 then -- 战区bossIndex暂时是1 CTL.CountryWorldBoss.OpenCountryWorldBossPanel() elseif self.selectedIndex == 2 then if not MDL.Guild.IsHasGuild() then CTL.Tips.AddTipsMsg(Const_IDS["IDS_GoldHeroActivity_SynergyBoss_Help_Hint8"]) return end UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIGuildBossMain) elseif self.selectedIndex == 4 then -- 魔神降世 if CTL.WarZone.IsWarZoneOpen() then if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.DemonGod) then CTL.DemonGod.OpenDemonGodView() else CTL.Tips.AddTipsMsg(Const_IDS.IDS_WorldBoss_Label_NotOpen) end else CTL.Tips.AddTipsMsg(Const_IDS.IDS_WarZoneBoss_ZhanQuWeiKaiQi) end end else for i, v in ipairs (self.group_Btns) do if v.btn == comp then self:SelectedTab(i) break end end end end function UIWarZonePanel:SelectedTab(tabIndex) if self.selectedIndex ~= tabIndex then if self.selectedIndex ~= 0 then self.group_Btns[self.selectedIndex].UIStateSelect:SetState(0) UIUtils.SetActive(self.group_Infos[self.selectedIndex].gameObject, false) else for _, v in ipairs (self.group_Infos) do UIUtils.SetActive(v.gameObject, false) end end self.selectedIndex = tabIndex self.group_Btns[self.selectedIndex].UIStateSelect:SetState(1) UIUtils.SetActive(self.group_Infos[self.selectedIndex].gameObject, true) self:RefreshBtnShow() end end function UIWarZonePanel:RefreshPreviewTimer() local state, timeStr = CTL.WarZone.GetTimeState() if state == CTL.WarZone.TimeState.Preview then self.UIStateTime:SetState(0) UIUtils.SetLabel(self.lab_LeftTime, string.format(UIUtils.GetLocalizedTxt(Const_IDS["IDS_WarZone_Time"]), timeStr)) elseif state == CTL.WarZone.TimeState.Start then self.UIStateTime:SetState(1) self:StopRepeatFunc(self.RefreshPreviewTimer) else UIManager.CloseView(Const_UI_Lua.UIEnum.UIWarzoneList) self:CloseView(true) end self:RefreshBtnShow() end function UIWarZonePanel:RefreshBtnShow() UIUtils.SetActive(self.group_Infos[4].img_StartPrompt, false) local state, timeStr = CTL.WarZone.GetTimeState() if state == CTL.WarZone.TimeState.Start then if self.selectedIndex == 1 or self.selectedIndex == 4 or self.selectedIndex == 2 then self.state_BtnGo:SetState(0) elseif self.selectedIndex == 3 then self.state_BtnGo:SetState(2) end else if self.selectedIndex == 3 then self.state_BtnGo:SetState(2) UIUtils.SetActive(self.group_Infos[4].img_StartPrompt, false) else self.state_BtnGo:SetState(1) self:SpecialHandlerForJP() end end end function UIWarZonePanel:SpecialHandlerForJP() --日本地区的将星降临使用自己新增的文本框,屏蔽以前的文本框 if GameAppInfo.IsJapanesePackage() and self.selectedIndex == 4 then self.state_BtnGo:SetState(2) UIUtils.SetActive(self.group_Infos[4].img_StartPrompt, true) end end return UIWarZonePanel