-- 长安布阵界面 local UIFreeLineupSelectOfficer = require("View/FreeLineUp/UIFreeLineupSelectOfficer") local UICountryNightBossSelectOfficer = UIViewClass(UIFreeLineupSelectOfficer) --region--------------------- 子类重写方法 -------------------------- -- OVERRIDE function UICountryNightBossSelectOfficer:Init() self.UIState_NationClimbTower:SetState(0) CTL.CountryNightBoss.SetCurSelectKingdom() --记录当前进入国别类型,进行跨天判断使用 --注册事件 self:RegistSystemEvent(EventID.UI_CountryNightBoss_LineUpInfoChanged, self.OnLineUpInfoChanged) self:RegistSystemEvent(EventID.UI_CountryNightBoss_LineUpLockOrClear, self.CloseView) -- 确定阵容 -- 标题 UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_DemonGod_UI_9) self.curKingdom = CTL.CountryNightBoss.GetCurLimitKingdom() self.kingdomLimitType = CTL.FreeLineUp.KingdomLimitShowType.MutilFlags --布阵国别限制的旗帜表现 self.teamNums = MDL.FreeLineUp.TeamNums.Multi end --OVERRIDE function UICountryNightBossSelectOfficer:GetHeroHavePos(heroId) local lineUps = MDL.FreeLineUp.GetLineUpInfoByFunctionType(self.freeLineupFuncType) if lineUps then for _,teamInfo in ipairs(lineUps) do if teamInfo.lineNumber == self.curKingdom then for _, heroInfo in ipairs(teamInfo.heroInfos) do if heroInfo.heroId == heroId then return heroInfo.posNumber end end end end end return 0 end function UICountryNightBossSelectOfficer:OnLineUpInfoChanged() if CTL.CountryNightBoss.IsKindDomChanged() then UTL.MessageBox.ShowOnlyOkBox(nil, Const_IDS["IDS_Mine_RefreshLineup"]) self:ExitCancelLineUp() end end function UICountryNightBossSelectOfficer:ExitCancelLineUp() MDL.FreeLineUp.FreeLineUpLockOrClearReq(MDL.FreeLineUp.FuncType.CountryNightBoss, false) self:CloseView() end --左侧前中后军按钮 -- OVERRIDE function UICountryNightBossSelectOfficer:InitTeamSlotUnlock() for index, v in ipairs(self.group_Buttons) do v.btn_team:SetGray(false, true) if self.selectTeamId == index then v.state_Button:SetState(1) else v.state_Button:SetState(0) end UIUtils.SetActive(v.img_Lock, false) end end -- 刷新界面信息 -- OVERRIDE function UICountryNightBossSelectOfficer:RefreshSelectOfficerView() self:RefreshHeroList() end function UICountryNightBossSelectOfficer:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then self:ExitCancelLineUp() elseif comp == self.UITemplateTitlePanel.btn_Home then MDL.FreeLineUp.FreeLineUpLockOrClearReq(MDL.FreeLineUp.FuncType.CountryNightBoss, false) CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.UITemplateTitlePanel.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, { id = LuaConst.NoteID.DemonGod_SelectArray}) elseif comp == self.btn_Formation then UIManager.OpenView( Const_UI_Lua.UIEnum.UIChangAnSiegeFreeLineupDetailPanel, { id = MDL.FreeLineUp.FuncType.CountryNightBoss, heroList = self.allHeroList, curKingdom = self.curKingdom }, Const_UI_Lua.UIEnum.UIFreeLineupDetailPanel ) elseif comp == self.btn_Fight then self:ExecuteFightFunc() else self:OnTeamSlotBtnClick(comp) end end -- 按钮点击执行逻辑 -- OVERRIDE function UICountryNightBossSelectOfficer:ExecuteFightFunc() -- 检查阵容上将情况 if self:CheckLineUp() then MDL.FreeLineUp.FreeLineUpLockOrClearReq(MDL.FreeLineUp.FuncType.CountryNightBoss, true) end end -- 左侧槽位刷新 function UICountryNightBossSelectOfficer: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() end end end end -- 面板右侧显示 -- OVERRIDE function UICountryNightBossSelectOfficer:RefreshRightPanelInfo() UIUtils.SetLabel(self.txt_BR, 0) UIUtils.SetActive(self.group_Sopt1.img_Lock, false) UIUtils.SetActive(self.group_Sopt2.img_Lock, false) UIUtils.SetActive(self.img_ScoreBg, false) UIUtils.SetLabel(self.txt_Tips, "") end function UICountryNightBossSelectOfficer:SetLineUps() MDL.FreeLineUp.FreeLineUpSetRequest( self.freeLineupFuncType, MDL.FreeLineUp.GetFreeLineUpLineNumber(self.freeLineupFuncType), MDL.FreeLineUp.SetType.Simulate, self.allHeroList ) end --endregion------------------------------------------------------------------- --检查是否可以保存布阵 function UICountryNightBossSelectOfficer:CheckLineUp() if self:GetTeamPos(1, 1) > 0 then for i = 2, 3 do if self:GetTeamPos(1, i) <= 0 and self:GetTeamPos(2, i) > 0 then CTL.Tips.AddTipsMsg(Const_IDS["IDS_SiegeCity_LineupTips_2"]) self:OnTeamSlotBtnClick(self.group_Buttons[i].btn_team) return false end end return true else CTL.Tips.AddTipsMsg(Const_IDS["IDS_SiegeCity_LineupTips_1"]) self:OnTeamSlotBtnClick(self.group_Buttons[1].btn_team) return false end end return UICountryNightBossSelectOfficer