-- 暴风布阵界面 local UIFreeLineupSelectOfficer = require("View/FreeLineUp/UIFreeLineupSelectOfficer") local UIHeroMatch1v1SelectOfficer = UIViewClass(UIFreeLineupSelectOfficer) -- OVERRIDER function UIHeroMatch1v1SelectOfficer:Init() UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, false) self.kingdomLimitType = CTL.FreeLineUp.KingdomLimitShowType.MutilFlags self.curKingdom = MDL.HeroMatch1v1.GetCurCountryId() self:RegistSystemEvent(EventID.UI_FreeLineUp_RefreshSilk, self.UpdateSilkInfo) self:RegistSystemEvent(EventID.UI_HeroMatch1v1_CloseView, self.CloseView) --锦囊列表 self.silkBagList = { [1] = 0, [2] = 0, [3] = 0, } UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_DemonGod_UI_9) UIUtils.SetActive(self.btn_Fight, false) UIUtils.SetActive(self.btn_Formation, true) UIUtils.SetActive(self.btn_Next, false) UIUtils.SetActive(self.img_ScoreBg, false) UIUtils.SetActive(self.btn_Skill, true) end function UIHeroMatch1v1SelectOfficer:UpdateSilkInfo(funcType, silkBags) for i, v in ipairs(self.silkBagList) do self.silkBagList[i] = silkBags[i] or 0 end self:UpdateCurTeamSilk() end function UIHeroMatch1v1SelectOfficer:UpdateCurTeamSilk() local silkBagID = self.silkBagList[self.selectTeamId] UIUtils.SetActive(self.img_Skill, silkBagID > 0) if silkBagID > 0 then local buffData = DataSheetManager.BuffData:GetDataByBuffID(silkBagID) UIUtils.SetImageByAssetBundle(self.img_Skill, buffData.BuffIcon) UIUtils.SetLabelText(self.txt_SkillName, Const_IDS[buffData.BuffName]) else UIUtils.SetLabelText(self.txt_SkillName, Const_IDS.IDS_HeroMatch3v3_AddSkillBag) end end -- OVERRIDER function UIHeroMatch1v1SelectOfficer:OnButtonClicked(comp) if comp == self.btn_Skill then UIManager.OpenView(Const_UI_Lua.UIEnum.UIHeroMatch1v1SilkBag, { parent = self, selectSkillID = self.silkBagList[self.selectTeamId] }, "SpecialTeam/UISpecialTeamSilkBag") elseif comp == self.UITemplateTitlePanel.btn_close then self:OnBackButtonPressed() elseif comp == self.UITemplateTitlePanel.btn_Home then self:TryBackHome() elseif comp == self.btn_Formation then UIManager.OpenView(Const_UI_Lua.UIEnum.UIFreeLineupDetailPanel, {id = self.freeLineupFuncType, heroList = self.allHeroList, homeFunc = function() self:TryBackHome() end}) else UIFreeLineupSelectOfficer.OnButtonClicked(self, comp) end end -- OVERRIDER function UIHeroMatch1v1SelectOfficer:InitTeamSlotUnlock() self.teamSlotUnlock = {} for k, v in ipairs(self.group_Buttons) do table.insert(self.teamSlotUnlock, true) v.btn_team:SetGray(false) UIUtils.SetActive(v.img_Lock, false) if self.selectTeamId == k then v.state_Button:SetState(1) else v.state_Button:SetState(0) end end end -- OVERRIDER function UIHeroMatch1v1SelectOfficer:OnTeamSlotBtnClick(btnComp) for k,v in ipairs(self.group_Buttons) do if btnComp == v.btn_team then if self.selectTeamId ~= k then v.state_Button:SetState(1) self.group_Buttons[self.selectTeamId].state_Button:SetState(0) self.selectTeamId = k self:RefreshTeamInfo() self:UpdateCurTeamSilk() end end end end -- OVERRIDER function UIHeroMatch1v1SelectOfficer:RefreshSelectOfficerView() self:RefreshHeroList() end -- OVERRIDER function UIHeroMatch1v1SelectOfficer:RefreshRightPanelInfo() UIUtils.SetLabel(self.txt_BR, 0) UIUtils.SetActive(self.group_Sopt1.img_Lock, self:IsTeamPosLockedUp(self.selectTeamId)) UIUtils.SetActive(self.group_Sopt2.img_Lock, self:IsTeamPosLockedUp(self.selectTeamId)) self.txt_Tips.text = nil end -- OVERRIDER function UIHeroMatch1v1SelectOfficer:IsTeamPosLockedUp() return false end -- OVERRIDER function UIHeroMatch1v1SelectOfficer:ExecuteFightFunc() if self:CheckLineUpFull() == false then return end self:CloseView() end function UIHeroMatch1v1SelectOfficer:TryBackHome() if self:CheckLineUpFull() == false then return end CTL.HomeMain.CloseViewBackHomeMain() end -- OVERRIDER function UIHeroMatch1v1SelectOfficer:OnBackButtonPressed() self:ExecuteFightFunc() end -- OVERRIDER function UIHeroMatch1v1SelectOfficer:RefreshKingdomState() UIFreeLineupSelectOfficer.RefreshKingdomState(self) UIUtils.SetLabelText(self.lab_Limit, Const_IDS.IDS_HeroMatch3v3_SeasonHero) end function UIHeroMatch1v1SelectOfficer:CheckLineUpFull() local count = 0 for i = 1, #self.allHeroList, 2 do count = count + 1 if self.teamSlotUnlock[count] and self.allHeroList[i] <= 0 then if self.allHeroList[i+1] > 0 then CTL.Tips.AddTipsMsg(Const_IDS.IDS_SiegeCity_LineupTips_2) else CTL.Tips.AddTipsMsg(Const_IDS.IDS_DemonGod_UI_12) end self:OnTeamSlotBtnClick(self.group_Buttons[count].btn_team) return false end end return true end function UIHeroMatch1v1SelectOfficer:SetPosSkillID(skillID) local tempSilkBagList = {} for i, v in ipairs(self.silkBagList) do tempSilkBagList[i] = v end tempSilkBagList[self.selectTeamId] = skillID self:SetLineUps(tempSilkBagList) end function UIHeroMatch1v1SelectOfficer:SetLineUps(silkBagList) local silkBagList = silkBagList or self.silkBagList MDL.FreeLineUp.FreeLineUpSetRequest( self.freeLineupFuncType, MDL.FreeLineUp.GetFreeLineUpLineNumber(self.freeLineupFuncType), MDL.FreeLineUp.SetType.Official, self.allHeroList, nil, nil, silkBagList ) end function UIHeroMatch1v1SelectOfficer:OnClosed() UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, true) end return UIHeroMatch1v1SelectOfficer