-- 矿场布阵界面 local UIFreeLineupSelectOfficer = require("View/FreeLineUp/UIFreeLineupSelectOfficer") local UIGuildMineSelectOfficer = UIViewClass(UIFreeLineupSelectOfficer) --region--------------------- 子类重写方法 -------------------------- -- 初始化 TODO -- OVERRIDE function UIGuildMineSelectOfficer:Init() self.UIState_NationClimbTower:SetState(1) self.teamNums = MDL.FreeLineUp.TeamNums.Multi CTL.GuildMine.SetCurSelectKingdom() --记录当前进入的塔类型,进行跨天判断使用 --注册事件 self:RegistSystemEvent(EventID.New_Day_Refresh, self.NewDayRefresh) -- 跨天 self:RegistSystemEvent(EventID.UI_GuildMine_CloseView, self.ForcedExit) -- GMS self:RegistSystemEvent(EventID.UI_Guild_BeKickOutRefresh, self.ForcedExit) -- 被踢出势力 self:RegistSystemEvent(EventID.UI_GuildMine_LineUpLockOrClear, self.CloseView) -- 确定阵容 self:RegistSystemEvent(EventID.UI_GuildMine_LineupDetailPanelHome, self.LineupDetailPanelHome) -- 阵容详情home键 -- 标题 UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_DemonGod_UI_9) UIUtils.SetActive(self.btn_Next, false) self.curKingdom = MDL.GuildMine.GetMineCurKingdomId() end function UIGuildMineSelectOfficer:NewDayRefresh() if CTL.GuildMine.IsKindDomChanged() then CTL.Tips.AddTipsMsg(Const_IDS["IDS_Mine_RefreshLineup"]) self:ForcedExit() end end function UIGuildMineSelectOfficer:ForcedExit() MDL.FreeLineUp.FreeLineUpLockOrClearReq(MDL.FreeLineUp.FuncType.GuildMine, false) self:CloseView() end function UIGuildMineSelectOfficer:LineupDetailPanelHome() if self:CheakLineUp() then MDL.FreeLineUp.FreeLineUpLockOrClearReq(MDL.FreeLineUp.FuncType.GuildMine, true) CTL.HomeMain.CloseViewBackHomeMain() end end --左侧前中后军按钮 -- OVERRIDE function UIGuildMineSelectOfficer:InitTeamSlotUnlock() for index, v in ipairs(self.group_Buttons) do local isUnlock = CTL.GuildMine.IsTeamSlotUnlock(index) v.btn_team:SetGray(not isUnlock, true) if self.selectTeamId == index then v.state_Button:SetState(1) else v.state_Button:SetState(0) end UIUtils.SetActive(v.img_Lock, not isUnlock) end end -- 刷新界面信息 -- OVERRIDE function UIGuildMineSelectOfficer:RefreshSelectOfficerView() self:RefreshHeroList() end function UIGuildMineSelectOfficer:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then if self:CheakLineUp() then MDL.FreeLineUp.FreeLineUpLockOrClearReq(MDL.FreeLineUp.FuncType.GuildMine, true) end elseif comp == self.UITemplateTitlePanel.btn_Home then if self:CheakLineUp() then MDL.FreeLineUp.FreeLineUpLockOrClearReq(MDL.FreeLineUp.FuncType.GuildMine, true) CTL.HomeMain.CloseViewBackHomeMain() end elseif comp == self.UITemplateTitlePanel.btn_Info then local activityData = DataSheetManager.ActivityData:GetDataByID(LuaConst.ActivityType.GuildMine).Time_Table[1] local _, timeStr = UTL.Time.GetDateDescAndTimeById(activityData.StartTime, activityData.EndTime) local countryDayLimit = DataSheetManager.ConstData:GetDataByID("CountryDayLimit").IntValue UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.GuildMine, params = {timeStr, UTL.Time.GetDiffLocalStrById(1), countryDayLimit}}) elseif comp == self.btn_Formation then UIManager.OpenView( Const_UI_Lua.UIEnum.UIGuildMineFreeLineupDetailPanel, {id = MDL.FreeLineUp.FuncType.GuildMine, heroList = self.allHeroList, curKingdom = self.curKingdom}, Const_UI_Lua.UIEnum.UIFreeLineupDetailPanel ) else self:OnTeamSlotBtnClick(comp) end end -- 左侧槽位解锁刷新 function UIGuildMineSelectOfficer:OnTeamSlotBtnClick(btnComp) local slotUnlockList = DataSheetManager.ConstData:GetDataByID("MineLineup").IntListValue for k,v in ipairs(self.group_Buttons) do if btnComp == v.btn_team then if self.selectTeamId ~= k then local isUnlock = CTL.GuildMine.IsTeamSlotUnlock(k) if isUnlock then v.state_Button:SetState(1) self.group_Buttons[self.selectTeamId].state_Button:SetState(0) self.selectTeamId = k self:RefreshTeamInfo() else local tlData = DataSheetManager.TeamLevelData:GetDataByTeamLevel(slotUnlockList[k]) if tlData ~= nil then local _levelStr = UTL.Item.GetNobilityByTeamLevel(tlData.TeamLevel) -- 爵位转换 local teamLevelName = string.FormatByIdsId(Const_IDS[tlData.TeamLevelName], _levelStr) CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS.IDS_DemonGod_UI_51, teamLevelName)) end end end end end end -- 面板右侧显示 -- OVERRIDE function UIGuildMineSelectOfficer:RefreshRightPanelInfo() local index = self.selectTeamId -- 选中军的战力 UIUtils.SetLabelText(self.txt_TotalBR, Const_IDS[MDL.FreeLineUp.TeamIDS[self.selectTeamId]]) UIUtils.SetLabel(self.txt_BR, MDL.GuildMine.GetLineUpGSByTeamID(self.curKingdom, index)) -- 下一行战力显示 index = index + 1 > 3 and 1 or index + 1 UIUtils.SetLabelText(self.txt_Score01, Const_IDS[MDL.FreeLineUp.TeamIDS[index]]) UIUtils.SetLabel(self.txt_Num01, MDL.GuildMine.GetLineUpGSByTeamID(self.curKingdom, index)) -- 下一行战力显示 index = index + 1 > 3 and 1 or index + 1 UIUtils.SetLabelText(self.txt_Score02, Const_IDS[MDL.FreeLineUp.TeamIDS[index]]) UIUtils.SetLabel(self.txt_Num02, MDL.GuildMine.GetLineUpGSByTeamID(self.curKingdom, index)) -- 三军总战力 UIUtils.SetLabel(self.txt_TotalScore, string.FormatByIdsId(Const_IDS["IDS_NationClimbTower_AllHero"], MDL.GuildMine.GetLineUpGSTotal(self.curKingdom))) end function UIGuildMineSelectOfficer:SetLineUps() MDL.FreeLineUp.FreeLineUpSetRequest( self.freeLineupFuncType, MDL.FreeLineUp.GetFreeLineUpLineNumber(self.freeLineupFuncType), MDL.FreeLineUp.SetType.Simulate, self.allHeroList ) end --OVERRIDE function UIGuildMineSelectOfficer: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 --endregion------------------------------------------------------------------- --检查是否可以保存布阵 function UIGuildMineSelectOfficer:CheakLineUp() for i = 1, 3 do if self:GetTeamPos(1, i) <= 0 and self:GetTeamPos(2, i) > 0 then CTL.Tips.AddTipsMsg(Const_IDS["IDS_DemonGod_UI_12"]) self:OnTeamSlotBtnClick(self.group_Buttons[i].btn_team) return false end end local myMine = MDL.GuildMine.GetMyMineInfo().mineBaseShowInfo if myMine and myMine.mineLevel > 0 then for i = 1, 3 do if self:GetTeamPos(1, i) > 0 then return true end end CTL.Tips.AddTipsMsg(Const_IDS["IDS_Mine_AtLeastOne"]) return false end return true end return UIGuildMineSelectOfficer