2024-08-06 05:52:32 -04:00
|
|
|
function SystemLinkMenuButtons(menu, controller)
|
|
|
|
local SystemLinkMenuButtons = LUI.UIVerticalList.new()
|
2024-08-06 16:00:14 -04:00
|
|
|
SystemLinkMenuButtons:SetAnchorsAndPosition(0, 1, 0, 1, 0, 450 * _1080p, 0, 300 * _1080p)
|
2024-08-06 05:52:32 -04:00
|
|
|
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 16:00:14 -04:00
|
|
|
CASButton.buttonDescription = Engine.Localize("LUA_MENU_DESC_CREATE_A_CLASS")
|
2024-08-06 06:05:07 -04:00
|
|
|
CASButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_CREATE_A_CLASS")), 0)
|
2024-08-06 16:00:14 -04:00
|
|
|
CASButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 450, _1080p * 80, _1080p * 110)
|
2024-08-06 06:05:07 -04:00
|
|
|
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"
|
2024-08-06 16:00:14 -04:00
|
|
|
LoadoutButton.buttonDescription = Engine.Localize("LUA_MENU_ZM_LOADOUT_DESC")
|
2024-08-06 05:52:32 -04:00
|
|
|
LoadoutButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_ZM_LOADOUT_CAPS")), 0)
|
2024-08-06 16:00:14 -04:00
|
|
|
LoadoutButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 450, _1080p * 80, _1080p * 110)
|
2024-08-06 05:52:32 -04:00
|
|
|
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
|
|
|
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
|