Moved command center menu to GROUP level, also Mission menu.

This commit is contained in:
FlightControl_Master 2017-12-22 11:38:01 +01:00
parent e54fad6c53
commit f615d2c50a
2 changed files with 37 additions and 37 deletions

View File

@ -119,24 +119,24 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
end end
) )
-- When a player enters a client or a unit, the CommandCenter will check for each Mission and each Task in the Mission if the player has things to do. -- -- When a player enters a client or a unit, the CommandCenter will check for each Mission and each Task in the Mission if the player has things to do.
-- For these elements, it will= -- -- For these elements, it will=
-- - Set the correct menu. -- -- - Set the correct menu.
-- - Assign the PlayerUnit to the Task if required. -- -- - Assign the PlayerUnit to the Task if required.
-- - Send a message to the other players in the group that this player has joined. -- -- - Send a message to the other players in the group that this player has joined.
self:HandleEvent( EVENTS.PlayerEnterUnit, -- self:HandleEvent( EVENTS.PlayerEnterUnit,
--- @param #COMMANDCENTER self -- --- @param #COMMANDCENTER self
-- @param Core.Event#EVENTDATA EventData -- -- @param Core.Event#EVENTDATA EventData
function( self, EventData ) -- function( self, EventData )
local PlayerUnit = EventData.IniUnit -- local PlayerUnit = EventData.IniUnit
for MissionID, Mission in pairs( self:GetMissions() ) do -- for MissionID, Mission in pairs( self:GetMissions() ) do
local Mission = Mission -- Tasking.Mission#MISSION -- local Mission = Mission -- Tasking.Mission#MISSION
local PlayerGroup = EventData.IniGroup -- The GROUP object should be filled! -- local PlayerGroup = EventData.IniGroup -- The GROUP object should be filled!
Mission:JoinUnit( PlayerUnit, PlayerGroup ) -- Mission:JoinUnit( PlayerUnit, PlayerGroup )
end -- end
self:SetMenu() -- self:SetMenu()
end -- end
) -- )
-- Handle when a player leaves a slot and goes back to spectators ... -- Handle when a player leaves a slot and goes back to spectators ...
-- The PlayerUnit will be UnAssigned from the Task. -- The PlayerUnit will be UnAssigned from the Task.
@ -153,22 +153,22 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
end end
) )
-- Handle when a player leaves a slot and goes back to spectators ... -- -- Handle when a player leaves a slot and goes back to spectators ...
-- The PlayerUnit will be UnAssigned from the Task. -- -- The PlayerUnit will be UnAssigned from the Task.
-- When there is no Unit left running the Task, the Task goes into Abort... -- -- When there is no Unit left running the Task, the Task goes into Abort...
self:HandleEvent( EVENTS.PlayerLeaveUnit, -- self:HandleEvent( EVENTS.PlayerLeaveUnit,
--- @param #TASK self -- --- @param #TASK self
-- @param Core.Event#EVENTDATA EventData -- -- @param Core.Event#EVENTDATA EventData
function( self, EventData ) -- function( self, EventData )
local PlayerUnit = EventData.IniUnit -- local PlayerUnit = EventData.IniUnit
for MissionID, Mission in pairs( self:GetMissions() ) do -- for MissionID, Mission in pairs( self:GetMissions() ) do
local Mission = Mission -- Tasking.Mission#MISSION -- local Mission = Mission -- Tasking.Mission#MISSION
if Mission:IsENGAGED() then -- if Mission:IsENGAGED() then
Mission:AbortUnit( PlayerUnit ) -- Mission:AbortUnit( PlayerUnit )
end -- end
end -- end
end -- end
) -- )
-- Handle when a player leaves a slot and goes back to spectators ... -- Handle when a player leaves a slot and goes back to spectators ...
-- The PlayerUnit will be UnAssigned from the Task. -- The PlayerUnit will be UnAssigned from the Task.
@ -305,8 +305,6 @@ end
function COMMANDCENTER:SetMenu() function COMMANDCENTER:SetMenu()
self:F() self:F()
self.CommandCenterMenu = MENU_COALITION:New( self.CommandCenterCoalition, "Command Center (" .. self:GetName() .. ")" )
local MenuTime = timer.getTime() local MenuTime = timer.getTime()
for MissionID, Mission in pairs( self:GetMissions() or {} ) do for MissionID, Mission in pairs( self:GetMissions() or {} ) do
local Mission = Mission -- Tasking.Mission#MISSION local Mission = Mission -- Tasking.Mission#MISSION

View File

@ -514,7 +514,9 @@ function MISSION:GetMenu( TaskGroup ) -- R2.1 -- Changed Menu Structure
local GroupMenu = self.MissionGroupMenu[TaskGroup] local GroupMenu = self.MissionGroupMenu[TaskGroup]
self.MissionMenu = MENU_COALITION:New( self.MissionCoalition, self:GetName(), CommandCenterMenu ) self.CommandCenterMenu = MENU_GROUP:New( TaskGroup, "Command Center (" .. CommandCenter:GetName() .. ")" )
self.MissionMenu = MENU_GROUP:New( TaskGroup, self:GetName(), self.CommandCenterMenu )
GroupMenu.BriefingMenu = MENU_GROUP_COMMAND:New( TaskGroup, "Mission Briefing", self.MissionMenu, self.MenuReportBriefing, self, TaskGroup ) GroupMenu.BriefingMenu = MENU_GROUP_COMMAND:New( TaskGroup, "Mission Briefing", self.MissionMenu, self.MenuReportBriefing, self, TaskGroup )