iw6-lui/lui/mp_menus/systemlinkmenu.dec.lua
2024-09-12 17:25:45 +02:00

205 lines
5.7 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function SystemLinkJoinGame( f1_arg0, f1_arg1 )
Cac.ValidateAllPlayersPrivateSquadMembers()
if Engine.IsConsoleGame() then
if Engine.OfflineProfileCanSave( f1_arg1.controller ) then
LUI.FlowManager.RequestPopupMenu( f1_arg0, "menu_systemlink_join", true, f1_arg1.controller, false )
else
LUI.FlowManager.RequestPopupMenu( f1_arg0, "savegame_error_mp", true, f1_arg1.controller, false, {
callback_params = {
continue_to_menu = "menu_systemlink_join"
}
} )
end
else
DebugPrint( "Menu Unsupported on PC at the moment..." )
end
end
function SystemLinkCreateGame( f2_arg0, f2_arg1 )
local f2_local0 = Engine.OfflineProfileCanSave( f2_arg1.controller )
Cac.ValidateAllPlayersPrivateSquadMembers()
if f2_local0 then
LUI.FlowManager.RequestAddMenu( f2_arg0, "menu_gamesetup_systemlink", false, f2_arg1.controller, false, {} )
else
LUI.FlowManager.RequestPopupMenu( f2_arg0, "savegame_error_mp", true, f2_arg1.controller, false, {
callback_params = {
continue_to_menu = "menu_gamesetup_systemlink"
}
} )
end
end
f0_local0 = function ( f3_arg0, f3_arg1 )
local f3_local0 = "loadouts"
Cac.ValidateAllPlayersPrivateSquadMembers()
LUI.FlowManager.RequestAddMenu( f3_arg0, "cac_member_select_main", true, f3_arg1.controller, false, {
next_screen = "cac_edit_main",
squad_location = "privateMatchSquadMembers",
class_location = f3_local0
} )
end
function SystemLinkCreateHandler( f4_arg0, f4_arg1 )
LUI.FlowManager.RequestSetStack( f4_arg0, {
{
name = "mp_main_menu"
}
} )
ConfigureResolution()
Engine.Exec( MPConfig.default_dvars )
f4_arg0:dispatchEventToRoot( LUI.ButtonHelperText.CommonEvents.addBackButton )
f4_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addGameSummaryButton )
local f4_local0 = TryForceOpenAfterActionReport( f4_arg0, f4_arg1 )
if MLG.AreMLGRulesEnabled() then
MLG.Toggle( f4_arg0, f4_arg1 )
MLG.Hide( f4_arg0 )
end
if not f4_local0 then
Engine.Exec( "SelectOfflineProfile" )
end
Engine.PLMRefreshData()
end
f0_local1 = function ( f5_arg0, f5_arg1 )
LUI.FlowManager.RequestPopupMenu( f5_arg0, "menu_ps3_profile", true, f5_arg1.controller, false )
end
f0_local2 = function ( f6_arg0, f6_arg1 )
Engine.SetDvarBool( "systemlink", false )
Engine.Exec( "forcesplitscreencontrol systemLinkExit" )
LUI.FlowManager.RequestLeaveMenu( self )
end
function SystemLinkOptionsFeeder( f7_arg0 )
local f7_local0 = Engine.IsAliensMode()
local f7_local1 = {
[#f7_local1 + 1] = {
type = "UIGenericButton",
id = "join_game_btn_id",
properties = {
button_text = Engine.Localize( "@LUA_MENU_JOIN_GAME_CAPS" ),
desc_text = Engine.Localize( "@LUA_MENU_DESC_JOIN_GAME" ),
button_action_func = SystemLinkJoinGame
}
},
[#f7_local1 + 1] = {
type = "UIGenericButton",
id = "create_game_btn_id",
properties = {
button_text = Engine.Localize( "@LUA_MENU_CREATE_GAME_CAPS" ),
desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_GAME" ),
button_action_func = SystemLinkCreateGame
}
}
}
if not f7_local0 then
f7_local1[#f7_local1 + 1] = {
type = "UIGenericButton",
id = "create_squad_btn_id",
properties = {
button_text = Engine.Localize( "@LUA_MENU_CREATE_A_CLASS_CAPS" ),
desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_A_CLASS" ),
button_action_func = f0_local0
}
}
else
f7_local1[#f7_local1 + 1] = LUI.mp_menus.AliensLoadout.GetAliensLoadoutButton()
if LUI.mp_menus.Aliens.CanAccessIntelMenu() then
f7_local1[#f7_local1 + 1] = LUI.mp_menus.AliensIntel.GetAliensIntelButton()
end
end
if Engine.IsPS3() then
f7_local1[#f7_local1 + 1] = {
type = "UIGenericButton",
id = "create_offline_profile_btn_id",
properties = {
button_text = Engine.Localize( "@LUA_MENU_CHANGE_OFFLINE_PROFILE" ),
desc_text = Engine.Localize( "@LUA_MENU_CHANGE_OFFLINE_PROFILE_DESC" ),
button_action_func = f0_local1
}
}
end
f7_local1[#f7_local1 + 1] = {
type = "button_desc_text",
id = "systemlink_description_id"
}
return f7_local1
end
function menu_systemlink()
local f8_local0 = Engine.IsAliensMode()
return {
type = "UIElement",
id = "menu_systemlink_root",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = SystemLinkCreateHandler,
open_after_action_report = OpenAfterActionReport,
open_ps3_profile_menu = f0_local1,
exit_system_link = f0_local2
},
children = {
{
type = "generic_menu_title",
id = "system_link_menu_title",
properties = {
menu_title = Engine.Localize( "@PLATFORM_SYSTEM_LINK_TITLE" )
}
},
{
type = "UIVerticalList",
id = "live_systemlink_options_id",
states = {
default = {
alignment = LUI.Alignment.Top,
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = GenericMenuDims.menu_left,
right = GenericMenuDims.menu_right,
top = GenericMenuDims.menu_top,
bottom = GenericMenuDims.menu_bottom
}
},
childrenFeeder = SystemLinkOptionsFeeder
},
{
type = "UIBindButton",
id = "lobby_bind_buttons_id",
handlers = {
button_secondary = f0_local2,
button_select = OpenAfterActionReport
}
},
{
type = "button_helper_text_main",
id = "system_link_helper_text_id"
},
{
type = "online_friends_widget",
id = "online_friends_widget_id"
}
}
}
end
LUI.MenuBuilder.registerDef( "menu_systemlink", menu_systemlink )
LUI.FlowManager.RegisterStackPopBehaviour( "menu_systemlink", clearMatchData )
LockTable( _M )