local CountryPVP_Controller = {} local private = {} local EventSystem = require('Event/EventSystem') function CountryPVP_Controller.OnStartup() EventSystem.Regist(EventID.Country_OpenCountryTargetList, private.OpenCountryTargetList) end --是否在本国 function CountryPVP_Controller.IsInMyCountry() local myKingdom = MDL.Country.GetMyCountryId() return myKingdom == MDL.CountryPVP.GetCurrentInCountryScene() end --是否为本国 function CountryPVP_Controller.IsMyCountry(kingdomId) local myKingdom = MDL.Country.GetMyCountryId() return myKingdom == kingdomId end --是否和队友在同一地图 function CountryPVP_Controller.IsSameScene(teammateScene) local sceneId = BattleDataGetter.GetCurLevelID() return sceneId == teammateScene end function CountryPVP_Controller.IsSameServer(serverId) return MDL.Login.GetServerId() == serverId end --是否在中立地图 function CountryPVP_Controller.IsInNeutralityMap() local currentMapId = BattleDataGetter.GetCurLevelID() local mapId = CTL.CountryWantedTask.GetNeutralityCountryMap() return currentMapId == mapId end --队友是否远离 function CountryPVP_Controller.IsTeammateKeepAwayFrom(mapId) return mapId ~= BattleDataGetter.GetCurLevelID() end --打开战斗模式界面 function private.OpenCountryTargetList() --在国家场景中,可以打开界面 if MDL.CountryPVP.GetCurrentInCountryScene() ~=nil and not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UICountryTargetList) then if not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UICountryTargetList) then UIManager.OpenView(Const_UI_Lua.UIEnum.UICountryTargetList) else EventSystem.Dispatch(EventID.Country_RefreshBattleList) end end end --是否显示战斗列表 function CountryPVP_Controller.IsShowBattleList() local isShowByCountryCase = CountryPVP_Controller.IsInMyCountry() or (CountryPVP_Controller.IsInNeutralityMap() and MDL.CountryPVP.IsInBattleTime()) if isShowByCountryCase then local battleList = CountryPVP_Controller.GetBattleList() return #battleList > 0 end return false end -- 特殊玩法活动期间默认不展开列表 function CountryPVP_Controller.IsShowByActivity() if CTL.CountryNightBoss.IsOpen() then -- 国战晚间Boss return false end return true end function CountryPVP_Controller.GetPVPMapId() local currentCountry = MDL.CountryPVP.GetCurrentInCountryScene() local countryData = DataSheetManager.CountryBase:GetDataByID(currentCountry) return countryData.PVPMapID end --获取战斗列表 function CountryPVP_Controller.GetBattleList() if CountryPVP_Controller.IsInMyCountry() or CountryPVP_Controller.IsInNeutralityMap() then--本国 or 中立国 local result = {} for i,v in pairs(SyncMoveManager.TownRoleList) do if v.roleInfo.countryId ~= MDL.Country.GetMyCountryId() then table.insert(result,v) end end return result end return nil end --打开国战PVP战斗结算界面 function CountryPVP_Controller.OpenBattleOverPanel(battleResult) UIManager.OpenView(Const_UI_Lua.UIEnum.UICountryTargetBattleOverPanel,{battleResult = battleResult}) end --判断国家处于休赛期 function CountryPVP_Controller.IsInCountryReset() return MDL.Country.GetCurStage() == MDL.Country.Stage.CountryReset end return CountryPVP_Controller