2024-08-06 05:52:32 -04:00
|
|
|
function SystemLinkMenuButtons(menu, controller)
|
|
|
|
local SystemLinkMenuButtons = LUI.UIVerticalList.new()
|
|
|
|
SystemLinkMenuButtons:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 300 * _1080p)
|
|
|
|
SystemLinkMenuButtons.id = "SystemLinkMenuButtons"
|
|
|
|
|
|
|
|
local controllerIndex = controller and controller.controllerIndex
|
|
|
|
if not controllerIndex and not Engine.InFrontend() then
|
|
|
|
controllerIndex = SystemLinkMenuButtons:getRootController()
|
|
|
|
end
|
|
|
|
assert(controllerIndex)
|
|
|
|
|
|
|
|
SystemLinkMenuButtons:SetSpacing(10 * _1080p)
|
2024-08-03 08:15:37 -04:00
|
|
|
|
2024-08-06 06:05:07 -04:00
|
|
|
local CASButton = nil
|
2024-08-06 05:52:32 -04:00
|
|
|
if CONDITIONS.IsCoreMultiplayer(SystemLinkMenuButtons) then
|
2024-08-06 06:05:07 -04:00
|
|
|
CASButton = MenuBuilder.BuildRegisteredType("MenuButton", {
|
2024-08-06 05:52:32 -04:00
|
|
|
controllerIndex = controllerIndex
|
|
|
|
})
|
2024-08-06 06:05:07 -04:00
|
|
|
CASButton.id = "CASButton"
|
2024-08-06 05:52:32 -04:00
|
|
|
|
|
|
|
if CONDITIONS.IsCoreMultiplayer(SystemLinkMenuButtons) then
|
2024-08-06 06:05:07 -04:00
|
|
|
CASButton.buttonDescription = Engine.Localize("LUA_MENU_DESC_CREATE_A_CLASS")
|
2024-08-06 05:52:32 -04:00
|
|
|
end
|
|
|
|
|
2024-08-06 06:05:07 -04:00
|
|
|
CASButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_CREATE_A_CLASS")), 0)
|
|
|
|
CASButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 80, _1080p * 110)
|
|
|
|
SystemLinkMenuButtons:addElement(CASButton)
|
|
|
|
SystemLinkMenuButtons.CASButton = CASButton
|
2024-08-06 05:52:32 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
local LoadoutButton = nil
|
|
|
|
if CONDITIONS.IsThirdGameMode(SystemLinkMenuButtons) then
|
|
|
|
LoadoutButton = MenuBuilder.BuildRegisteredType("MenuButton", {
|
|
|
|
controllerIndex = controllerIndex
|
|
|
|
})
|
|
|
|
LoadoutButton.id = "LoadoutButton"
|
|
|
|
|
|
|
|
if CONDITIONS.IsThirdGameMode(SystemLinkMenuButtons) then
|
|
|
|
LoadoutButton.buttonDescription = Engine.Localize("LUA_MENU_ZM_LOADOUT_DESC")
|
|
|
|
end
|
|
|
|
|
|
|
|
LoadoutButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_ZM_LOADOUT_CAPS")), 0)
|
|
|
|
LoadoutButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 120, _1080p * 150)
|
|
|
|
SystemLinkMenuButtons:addElement(LoadoutButton)
|
|
|
|
SystemLinkMenuButtons.LoadoutButton = LoadoutButton
|
|
|
|
end
|
2024-08-03 08:15:37 -04:00
|
|
|
|
2024-08-06 05:52:32 -04:00
|
|
|
if CONDITIONS.IsCoreMultiplayer(SystemLinkMenuButtons) then
|
2024-08-06 06:05:07 -04:00
|
|
|
CASButton:addEventHandler("button_action", function(button, event)
|
2024-08-06 05:52:32 -04:00
|
|
|
local currentControllerIndex = event.controller or controllerIndex
|
|
|
|
ClientWeapon.SetWeaponVisible(0, true)
|
|
|
|
ClientCharacter.SetCharacterVisible(0, true)
|
|
|
|
ACTIONS.OpenCreateAClass(SystemLinkMenuButtons, event)
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
if CONDITIONS.IsThirdGameMode(SystemLinkMenuButtons) then
|
2024-08-06 06:05:07 -04:00
|
|
|
LoadoutButton:addEventHandler("button_action", function(button, event)
|
2024-08-06 05:52:32 -04:00
|
|
|
ACTIONS.OpenMenu("CPLoadoutMenu", true, event.controller or controllerIndex)
|
|
|
|
end)
|
|
|
|
end
|
2024-08-03 08:15:37 -04:00
|
|
|
|
2024-08-06 05:52:32 -04:00
|
|
|
return SystemLinkMenuButtons
|
2024-08-03 08:15:37 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
MenuBuilder.m_types["SystemLinkMenuButtons"] = SystemLinkMenuButtons
|