Last Updates

This commit is contained in:
FlightControl
2016-09-12 12:29:20 +02:00
parent dac29f6356
commit cd4d4af559
241 changed files with 6314 additions and 1827 deletions

View File

@@ -0,0 +1,56 @@
do
-- This demo creates a menu structure for the two clients of planes.
-- Each client will receive a different menu structure.
-- To test, join the planes, then look at the other radio menus (Option F10).
-- Then switch planes and check if the menu is still there.
-- And play with the Add and Remove menu options.
-- Note that in multi player, this will only work after the DCS clients bug is solved.
local function ShowStatus( PlaneClient, StatusText, Coalition )
MESSAGE:New( Coalition, 15 ):ToRed()
PlaneClient:Message( StatusText, 15 )
end
local MenuStatus = {}
local function RemoveStatusMenu( MenuClient )
local MenuClientName = MenuClient:GetName()
MenuStatus[MenuClientName]:Remove()
end
--- @param Client#CLIENT MenuClient
local function AddStatusMenu( MenuClient )
local MenuClientName = MenuClient:GetName()
-- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
MenuStatus[MenuClientName] = MENU_CLIENT:New( MenuClient, "Status for Planes" )
MENU_CLIENT_COMMAND:New( MenuClient, "Show Status", MenuStatus[MenuClientName], ShowStatus, MenuClient, "Status of planes is ok!", "Message to Red Coalition" )
end
SCHEDULER:New( nil,
function()
local PlaneClient = CLIENT:FindByName( "Plane 1" )
if PlaneClient and PlaneClient:IsAlive() then
local MenuManage = MENU_CLIENT:New( PlaneClient, "Manage Menus" )
MENU_CLIENT_COMMAND:New( PlaneClient, "Add Status Menu Plane 1", MenuManage, AddStatusMenu, PlaneClient )
MENU_CLIENT_COMMAND:New( PlaneClient, "Remove Status Menu Plane 1", MenuManage, RemoveStatusMenu, PlaneClient )
end
end, {}, 10, 10 )
SCHEDULER:New( nil,
function()
local PlaneClient = CLIENT:FindByName( "Plane 2" )
if PlaneClient and PlaneClient:IsAlive() then
local MenuManage = MENU_CLIENT:New( PlaneClient, "Manage Menus" )
MENU_CLIENT_COMMAND:New( PlaneClient, "Add Status Menu Plane 2", MenuManage, AddStatusMenu, PlaneClient )
MENU_CLIENT_COMMAND:New( PlaneClient, "Remove Status Menu Plane 2", MenuManage, RemoveStatusMenu, PlaneClient )
end
end, {}, 10, 10 )
end

View File

@@ -0,0 +1,43 @@
do
-- This demo creates a menu structure for the planes within the red coalition.
-- To test, join the planes, then look at the other radio menus (Option F10).
-- Then switch planes and check if the menu is still there.
local Plane1 = CLIENT:FindByName( "Plane 1" )
local Plane2 = CLIENT:FindByName( "Plane 2" )
-- This would create a menu for the red coalition under the main DCS "Others" menu.
local MenuCoalitionRed = MENU_COALITION:New( coalition.side.RED, "Manage Menus" )
local function ShowStatus( StatusText, Coalition )
MESSAGE:New( Coalition, 15 ):ToRed()
Plane1:Message( StatusText, 15 )
Plane2:Message( StatusText, 15 )
end
local MenuStatus -- Menu#MENU_COALITION
local MenuStatusShow -- Menu#MENU_COALITION_COMMAND
local function RemoveStatusMenu()
MenuStatus:Remove()
end
local function AddStatusMenu()
-- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
MenuStatus = MENU_COALITION:New( coalition.side.RED, "Status for Planes" )
MenuStatusShow = MENU_COALITION_COMMAND:New( coalition.side.RED, "Show Status", MenuStatus, ShowStatus, "Status of planes is ok!", "Message to Red Coalition" )
end
local MenuAdd = MENU_COALITION_COMMAND:New( coalition.side.RED, "Add Status Menu", MenuCoalitionRed, AddStatusMenu )
local MenuRemove = MENU_COALITION_COMMAND:New( coalition.side.RED, "Remove Status Menu", MenuCoalitionRed, RemoveStatusMenu )
end

View File

@@ -0,0 +1,56 @@
do
-- This demo creates a menu structure for the two groups of planes.
-- Each group will receive a different menu structure.
-- To test, join the planes, then look at the other radio menus (Option F10).
-- Then switch planes and check if the menu is still there.
-- And play with the Add and Remove menu options.
-- Note that in multi player, this will only work after the DCS groups bug is solved.
local function ShowStatus( PlaneGroup, StatusText, Coalition )
MESSAGE:New( Coalition, 15 ):ToRed()
PlaneGroup:Message( StatusText, 15 )
end
local MenuStatus = {}
local function RemoveStatusMenu( MenuGroup )
local MenuGroupName = MenuGroup:GetName()
MenuStatus[MenuGroupName]:Remove()
end
--- @param Group#GROUP MenuGroup
local function AddStatusMenu( MenuGroup )
local MenuGroupName = MenuGroup:GetName()
-- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
MenuStatus[MenuGroupName] = MENU_GROUP:New( MenuGroup, "Status for Planes" )
MENU_GROUP_COMMAND:New( MenuGroup, "Show Status", MenuStatus[MenuGroupName], ShowStatus, MenuGroup, "Status of planes is ok!", "Message to Red Coalition" )
end
SCHEDULER:New( nil,
function()
local PlaneGroup = GROUP:FindByName( "Plane 1" )
if PlaneGroup and PlaneGroup:IsAlive() then
local MenuManage = MENU_GROUP:New( PlaneGroup, "Manage Menus" )
MENU_GROUP_COMMAND:New( PlaneGroup, "Add Status Menu Plane 1", MenuManage, AddStatusMenu, PlaneGroup )
MENU_GROUP_COMMAND:New( PlaneGroup, "Remove Status Menu Plane 1", MenuManage, RemoveStatusMenu, PlaneGroup )
end
end, {}, 10, 10 )
SCHEDULER:New( nil,
function()
local PlaneGroup = GROUP:FindByName( "Plane 2" )
if PlaneGroup and PlaneGroup:IsAlive() then
local MenuManage = MENU_GROUP:New( PlaneGroup, "Manage Menus" )
MENU_GROUP_COMMAND:New( PlaneGroup, "Add Status Menu Plane 2", MenuManage, AddStatusMenu, PlaneGroup )
MENU_GROUP_COMMAND:New( PlaneGroup, "Remove Status Menu Plane 2", MenuManage, RemoveStatusMenu, PlaneGroup )
end
end, {}, 10, 10 )
end