Next step of folder restructure

This commit is contained in:
kaltokri
2024-01-01 22:41:16 +01:00
parent 5aa1e1a63a
commit 286d2ed571
288 changed files with 6049 additions and 6049 deletions

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 = GROUP:FindByName( "Red Plane 1" )
local Plane2 = GROUP:FindByName( "Red Plane 2" )
local Plane3 = GROUP:FindByName( "Red Plane 3" )
local Plane4 = GROUP:FindByName( "Red Plane 4" )
-- 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 )
Plane1:MessageToRed( StatusText, 15 )
Plane2:MessageToRed( 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 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 Wrapper.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 Wrapper.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

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 = GROUP:FindByName( "Red Plane 1" )
local Plane2 = GROUP:FindByName( "Red Plane 2" )
local Plane3 = GROUP:FindByName( "Red Plane 3" )
local Plane4 = GROUP:FindByName( "Red Plane 4" )
-- 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 )
Plane1:MessageToRed( StatusText, 15 )
Plane2:MessageToRed( 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 @@
TestMenus = {}
Menu = MENU_MISSION:New( "Generate Menus" )
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 = GROUP:FindByName( "Red Plane 1" )
local Plane2 = GROUP:FindByName( "Red Plane 2" )
local Plane3 = GROUP:FindByName( "Red Plane 3" )
local Plane4 = GROUP:FindByName( "Red Plane 4" )
local CoalitionText = {
[coalition.side.BLUE] = "BLUE",
[coalition.side.RED] = "RED",
}
local function MenuMessage( Text, Parameter )
MESSAGE:NewType( Text .. Parameter, MESSAGE.Type.Information ):ToAll()
end
local function MenuRemove(m)
TestMenus[m]:Remove()
end
local function GenerateMissionMenu()
local m = #TestMenus+1
TestMenus[m] = MENU_MISSION:New( "Menu Mission "..m )
for n = 1, 8 do
local MenuMissionCommand = MENU_MISSION_COMMAND:New( "Show Mission "..m.."."..n, TestMenus[m], MenuMessage, "Mission ", m.."."..n)
end
local MenuMissionRemoveCommand = MENU_MISSION_COMMAND:New( "Remove Mission "..m, TestMenus[m], MenuRemove, m)
end
local function GenerateCoalitionMenu( Coalition )
local m = #TestMenus+1
TestMenus[m] = MENU_COALITION:New( Coalition, "Menu Coalition "..CoalitionText[Coalition].." ".. m )
for n = 1, 8 do
local MenuMissionCommand = MENU_COALITION_COMMAND:New( Coalition, "Show Coalition "..CoalitionText[Coalition].." "..m.."."..n, TestMenus[m], MenuMessage, "Coalition ", CoalitionText[Coalition].." "..m.."."..n)
end
local MenuMissionRemoveCommand = MENU_COALITION_COMMAND:New( Coalition, "Remove Coalition "..CoalitionText[Coalition].." "..m, TestMenus[m], MenuRemove, m)
end
-- Create a mission menu to generate the menus.
local MenuMission = MENU_MISSION_COMMAND:New( "Generate Mission Menus", Menu, GenerateMissionMenu )
local MenuCoalitionBlue = MENU_MISSION_COMMAND:New( "Generate Blue Coalition Menus", Menu, GenerateCoalitionMenu, coalition.side.BLUE )
local MenucoalitionRed = MENU_MISSION_COMMAND:New( "Generate Red Coalition Menus", Menu, GenerateCoalitionMenu, coalition.side.RED )
end