init
This commit is contained in:
228
ui_scripts/end_game/__init__.lua
Normal file
228
ui_scripts/end_game/__init__.lua
Normal file
@ -0,0 +1,228 @@
|
||||
if (game:issingleplayer() or Engine.InFrontend()) then
|
||||
return
|
||||
end
|
||||
|
||||
f0_local0 = function ( f1_arg0, f1_arg1 )
|
||||
LUI.FlowManager.RequestLeaveMenu( f1_arg0 )
|
||||
end
|
||||
|
||||
f0_local1 = function ( f2_arg0, f2_arg1 )
|
||||
f2_arg0:setText( f2_arg1.message_text )
|
||||
f2_arg0:dispatchEventToRoot( {
|
||||
name = "resize_popup"
|
||||
} )
|
||||
end
|
||||
|
||||
f0_local2 = function ( f3_arg0 )
|
||||
Engine.ExecFirstClient( "xpartybackout" )
|
||||
Engine.ExecFirstClient( "disconnect" )
|
||||
end
|
||||
|
||||
local f0_local3 = function ( f4_arg0 )
|
||||
Engine.ExecFirstClient( "xpartydisbandafterround" )
|
||||
Engine.ExecFirstClient( "disconnect" )
|
||||
end
|
||||
|
||||
local f0_local4 = function ( f5_arg0 )
|
||||
return Engine.GetDvarBool( "onlinegame" )
|
||||
end
|
||||
|
||||
local f0_local5 = function ( f6_arg0 )
|
||||
if f0_local4( f6_arg0 ) then
|
||||
Engine.ExecFirstClient( "xstopprivateparty" )
|
||||
Engine.ExecFirstClient( "disconnect" )
|
||||
Engine.ExecFirstClient( "xblive_privatematch 0" )
|
||||
Engine.ExecFirstClient( "onlinegame 1" )
|
||||
Engine.ExecFirstClient( "xstartprivateparty" )
|
||||
else
|
||||
Engine.ExecFirstClient( "disconnect" )
|
||||
end
|
||||
end
|
||||
|
||||
local f0_local6 = function ( f7_arg0 )
|
||||
Engine.ExecFirstClient( "xstopprivateparty" )
|
||||
Engine.ExecFirstClient( "xpartydisbandafterround" )
|
||||
|
||||
if Engine.GetDvarBool( "sv_running" ) then
|
||||
Engine.NotifyServer( "end_game", 1 )
|
||||
Engine.ExecFirstClient( "xblive_privatematch 0" )
|
||||
Engine.ExecFirstClient( "onlinegame 1" )
|
||||
Engine.ExecFirstClient( "xstartprivateparty" )
|
||||
else
|
||||
f0_local5( f7_arg0 )
|
||||
end
|
||||
end
|
||||
|
||||
local f0_local7 = function ( f8_arg0, f8_arg1 )
|
||||
if Engine.GetDvarBool( "sv_running" ) then
|
||||
Engine.NotifyServer( "end_game", 1 )
|
||||
else
|
||||
f0_local5( f8_arg0 )
|
||||
end
|
||||
LUI.FlowManager.RequestCloseAllMenus( f8_arg0 )
|
||||
end
|
||||
|
||||
local f0_local8 = function ( f9_arg0, f9_arg1 )
|
||||
LUI.FlowManager.RequestLeaveMenu( f9_arg0 )
|
||||
Engine.Exec( "onPlayerQuit" )
|
||||
if Engine.GetDvarBool( "sv_running" ) then
|
||||
f0_local3( f9_arg0 )
|
||||
else
|
||||
f0_local2( f9_arg0 )
|
||||
end
|
||||
LUI.FlowManager.RequestCloseAllMenus( f9_arg0 )
|
||||
end
|
||||
|
||||
local f0_local9 = function ( f10_arg0, f10_arg1 )
|
||||
LUI.FlowManager.RequestLeaveMenu( f10_arg0 )
|
||||
Engine.Exec( "onPlayerQuit" )
|
||||
if Engine.GetDvarBool( "sv_running" ) then
|
||||
f0_local6( f10_arg0 )
|
||||
else
|
||||
f0_local5( f10_arg0 )
|
||||
end
|
||||
LUI.FlowManager.RequestCloseAllMenus( f10_arg0 )
|
||||
end
|
||||
|
||||
local f0_local10 = function ( f11_arg0 )
|
||||
local f11_local0 = Lobby.IsInPrivateParty()
|
||||
if f11_local0 then
|
||||
f11_local0 = Lobby.IsPrivatePartyHost()
|
||||
if f11_local0 then
|
||||
f11_local0 = not Lobby.IsAloneInPrivateParty()
|
||||
end
|
||||
end
|
||||
return f11_local0
|
||||
end
|
||||
|
||||
local f0_local11 = function ( f12_arg0, f12_arg1 )
|
||||
local f12_local0 = Engine.GetDvarBool( "squad_match" )
|
||||
local f12_local1 = Engine.GetDvarBool( "squad_use_hosts_squad" )
|
||||
if f12_local0 and Lobby.IsInPrivateParty() and Lobby.IsPrivatePartyHost() then
|
||||
Engine.NotifyServer( "end_game", 1 )
|
||||
elseif f12_local1 and Lobby.IsPrivatePartyHost() and Lobby.IsAloneInPrivateParty() and Lobby.IsAlone() then
|
||||
Engine.NotifyServer( "end_game", 1 )
|
||||
elseif f0_local10( f12_arg0 ) then
|
||||
LUI.FlowManager.RequestLeaveMenu( f12_arg0, true )
|
||||
LUI.FlowManager.RequestPopupMenu( f12_arg0, "popup_pull_party", false )
|
||||
else
|
||||
Engine.Exec( "onPlayerQuit" )
|
||||
if Engine.GetDvarBool( "sv_running" ) then
|
||||
f0_local6( f12_arg0 )
|
||||
else
|
||||
f0_local5( f12_arg0 )
|
||||
end
|
||||
LUI.FlowManager.RequestCloseAllMenus( f12_arg0 )
|
||||
end
|
||||
end
|
||||
|
||||
local f0_local12 = function ()
|
||||
local self = LUI.UIElement.new()
|
||||
self.id = "end_game_id"
|
||||
self:registerAnimationState( "default", {
|
||||
topAnchor = true,
|
||||
leftAnchor = true,
|
||||
bottomAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = -50,
|
||||
left = 0,
|
||||
bottom = 0,
|
||||
right = 0,
|
||||
alpha = 1
|
||||
} )
|
||||
self:animateToState( "default", 0 )
|
||||
local f13_local1 = Engine.Localize( "@LUA_MENU_END_GAME_DESC" )
|
||||
local f13_local2 = Engine.Localize( "@LUA_MENU_LEAVE_GAME_TITLE" )
|
||||
if Engine.IsAliensMode() and Game.GetOmnvar( "ui_alien_is_solo" ) then
|
||||
f13_local1 = Engine.Localize( "@ALIENS_LEAVE_GAME_DESC" )
|
||||
f13_local2 = Engine.Localize( "@MENU_NOTICE" )
|
||||
end
|
||||
LUI.MenuBuilder.BuildAddChild( self, {
|
||||
type = "generic_yesno_popup",
|
||||
id = "privateGame_options_list_id",
|
||||
properties = {
|
||||
message_text_alignment = LUI.Alignment.Center,
|
||||
message_text = f13_local1,
|
||||
popup_title = f13_local2,
|
||||
padding_top = 12,
|
||||
yes_action = f0_local7
|
||||
}
|
||||
} )
|
||||
local f13_local3 = LUI.UIBindButton.new()
|
||||
f13_local3.id = "endBackToGameStartButton"
|
||||
f13_local3:registerEventHandler( "button_start", f0_local0 )
|
||||
self:addElement( f13_local3 )
|
||||
return self
|
||||
end
|
||||
|
||||
local f0_local13 = function ()
|
||||
local self = LUI.UIElement.new()
|
||||
self.id = "leave_game_id"
|
||||
self:registerAnimationState( "default", {
|
||||
topAnchor = true,
|
||||
leftAnchor = true,
|
||||
bottomAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = -50,
|
||||
left = 0,
|
||||
bottom = 0,
|
||||
right = 0,
|
||||
alpha = 1
|
||||
} )
|
||||
self:animateToState( "default", 0 )
|
||||
LUI.MenuBuilder.BuildAddChild( self, {
|
||||
type = "generic_yesno_popup",
|
||||
id = "publicGame_options_list_id",
|
||||
properties = {
|
||||
message_text_alignment = LUI.Alignment.Center,
|
||||
message_text = Engine.IsAliensMode() and Engine.Localize( "@ALIENS_LEAVE_GAME_DESC" ) or Engine.Localize( "@LUA_MENU_LEAVE_GAME_DESC" ),
|
||||
popup_title = Engine.IsAliensMode() and Engine.Localize( "@MENU_NOTICE" ) or Engine.Localize( "@LUA_MENU_LEAVE_GAME_TITLE" ),
|
||||
padding_top = 12,
|
||||
yes_action = f0_local11
|
||||
}
|
||||
} )
|
||||
local f14_local1 = LUI.UIBindButton.new()
|
||||
f14_local1.id = "leaveBackToGameStartButton"
|
||||
f14_local1:registerEventHandler( "button_start", f0_local0 )
|
||||
self:addElement( f14_local1 )
|
||||
return self
|
||||
end
|
||||
|
||||
local f0_local14 = function ()
|
||||
local self = LUI.UIElement.new()
|
||||
self.id = "pull_party_out_id"
|
||||
self:registerAnimationState( "default", {
|
||||
topAnchor = true,
|
||||
leftAnchor = true,
|
||||
bottomAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = -50,
|
||||
left = 0,
|
||||
bottom = 0,
|
||||
right = 0,
|
||||
alpha = 1
|
||||
} )
|
||||
self:animateToState( "default", 0 )
|
||||
LUI.MenuBuilder.BuildAddChild( self, {
|
||||
type = "generic_yesno_popup",
|
||||
id = "party_pullout_list_id",
|
||||
properties = {
|
||||
message_text_alignment = LUI.Alignment.Center,
|
||||
message_text = Engine.Localize( "@LUA_MENU_PULL_PARTY_DESC" ),
|
||||
popup_title = Engine.Localize( "@LUA_MENU_LEAVE_GAME_TITLE" ),
|
||||
padding_top = 12,
|
||||
yes_action = f0_local8,
|
||||
no_action = f0_local9,
|
||||
cancel_means_no = false
|
||||
}
|
||||
} )
|
||||
local f15_local1 = LUI.UIBindButton.new()
|
||||
f15_local1.id = "leavePullPartyButton"
|
||||
f15_local1:registerEventHandler( "button_start", f0_local0 )
|
||||
self:addElement( f15_local1 )
|
||||
return self
|
||||
end
|
||||
|
||||
LUI.MenuBuilder.m_types["popup_end_game"] = f0_local12
|
||||
LUI.MenuBuilder.m_types["popup_leave_game"] = f0_local13
|
||||
LUI.MenuBuilder.m_types["popup_pull_party"] = f0_local14
|
250
ui_scripts/main_menu/__init__.lua
Normal file
250
ui_scripts/main_menu/__init__.lua
Normal file
@ -0,0 +1,250 @@
|
||||
if (game:issingleplayer() or not Engine.InFrontend()) then
|
||||
return
|
||||
end
|
||||
|
||||
local SquadsModeButtonAction = function( f4_arg1 , f4_arg0)
|
||||
controller = f4_arg0.controller
|
||||
Engine.ExecNow( "forcenosplitscreencontrol main_XBOXLIVE_1", controller )
|
||||
local f4_local0, f4_local1 = Engine.UserCanPlayOnline( controller )
|
||||
if not f4_local0 then
|
||||
Engine.Exec( "xrequirelivesignin", controller )
|
||||
Engine.Exec( "forcenosplitscreencontrol main_XBOXLIVE_2", controller )
|
||||
else
|
||||
if SvS.IsSvS() then
|
||||
Engine.Exec( "profile_SetHasEverPlayed_SP", controller )
|
||||
end
|
||||
Engine.ExecNow( "resetSplitscreenSignIn", controller )
|
||||
Engine.ExecNow( "forcenosplitscreencontrol main_XBOXLIVE_3", controller )
|
||||
Engine.SetDvarBool( "systemlink", false )
|
||||
Engine.SetDvarBool( "splitscreen", false )
|
||||
Engine.SetDvarBool( "onlinegame", true )
|
||||
Engine.SetDvarBool( "xblive_privatematch", false )
|
||||
Engine.SetDvarBool( "ui_opensummary", false )
|
||||
Engine.SetDvarBool( "squad_match", false )
|
||||
Engine.SetDvarInt( "allow_online_squads", 1 )
|
||||
if Engine.GetDvarBool( "xblive_competitionmatch" ) then
|
||||
Engine.SetDvarBool( "xblive_competitionmatch", false )
|
||||
Engine.Exec( "set remove_mlg_rules 1" )
|
||||
end
|
||||
Engine.ExecNow( MPConfig.default_xboxlive, controller )
|
||||
if not SvS.IsSvS() then
|
||||
Engine.ExecNow( "xstartprivateparty", controller )
|
||||
end
|
||||
Engine.Exec( "startentitlements", controller )
|
||||
Engine.CacheUserDataForController( controller )
|
||||
if SvS.IsSvS() then
|
||||
LUI.FlowManager.RequestAddMenu( nil, "squads_mode_select_menu", false, controller, false )
|
||||
else
|
||||
LUI.FlowManager.RequestAddMenu( nil, "menu_xboxlive", false, controller, false )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local main_menu_options_feeder = function( f17_arg0 )
|
||||
local f17_local0 = Engine.IsAliensMode()
|
||||
local f17_local1 = SvS.IsSvS()
|
||||
local f17_local2 = false
|
||||
if Engine.GetDvarInt( "allow_online_squads" ) == 1 or not Engine.IsConsoleGame() then
|
||||
f17_local2 = true
|
||||
end
|
||||
local f17_local3 = Engine.DoWeNeedCompatibilityPacks()
|
||||
if f17_local1 then
|
||||
local f17_local4 = f17_local2
|
||||
end
|
||||
local f17_local5 = f17_local4 or not f17_local1
|
||||
local f17_local6 = {}
|
||||
if Engine.AllowOnline() and f17_local5 then
|
||||
local f17_local7, f17_local8 = nil
|
||||
if f17_local1 then
|
||||
f17_local8 = Engine.Localize( "@PLATFORM_PLAY_ONLINE_SQUADS_CAPS" )
|
||||
f17_local7 = Engine.Localize( "@LUA_MENU_SQUADS_INTRO" )
|
||||
elseif f17_local0 then
|
||||
f17_local8 = Engine.Localize( "@PLATFORM_PLAY_ONLINE_CAPS" )
|
||||
f17_local7 = Engine.Localize( "@LUA_MENU_PLAY_EXTINCTION_ONLINE_DESC" )
|
||||
else
|
||||
f17_local8 = Engine.Localize( "@PLATFORM_PLAY_ONLINE_CAPS" )
|
||||
f17_local7 = Engine.Localize( "@PLATFORM_PLAY_ONLINE_DESC" )
|
||||
end
|
||||
f17_local6[#f17_local6 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "btn_MPMain_0",
|
||||
disabled = f17_local3,
|
||||
disabledFunc = Engine.DoWeNeedCompatibilityPacks,
|
||||
properties = {
|
||||
button_text = f17_local8,
|
||||
button_action_func = LUI.mp_menus.MPMainMenu.xboxLiveButtonAction,
|
||||
desc_text = f17_local7,
|
||||
button_over_func = function ( f18_arg0, f18_arg1 )
|
||||
PersistentBackground.SetToDefault()
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
if SvS.IsSvS() then
|
||||
local f17_local7 = "@PLATFORM_PLAY_ONLINE_SQUADS_CAPS"
|
||||
local f17_local8 = #f17_local6 + 1
|
||||
local f17_local9 = {
|
||||
type = "UIGenericButton",
|
||||
id = "btn_MPMain_1",
|
||||
disabled = f17_local3,
|
||||
disabledFunc = Engine.DoWeNeedCompatibilityPacks
|
||||
}
|
||||
local f17_local10 = {
|
||||
button_text = Engine.Localize( f17_local7 ),
|
||||
button_action_func = SquadsModeButtonAction
|
||||
}
|
||||
local f17_local11
|
||||
if f17_local1 then
|
||||
f17_local11 = Engine.Localize( "@LUA_MENU_SQUADS_INTRO" )
|
||||
if not f17_local11 then
|
||||
|
||||
else
|
||||
f17_local10.desc_text = f17_local11
|
||||
f17_local10.button_over_func = function ( f19_arg0, f19_arg1 )
|
||||
PersistentBackground.SetToDefault()
|
||||
end
|
||||
|
||||
f17_local9.properties = f17_local10
|
||||
f17_local6[f17_local8] = f17_local9
|
||||
end
|
||||
end
|
||||
f17_local11 = Engine.Localize( "@LUA_MENU_SPLITSCREEN_DESC" )
|
||||
end
|
||||
f17_local6[#f17_local6 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "btn_MPMain_6",
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_OPTIONS_CAPS" ),
|
||||
button_action_func = LUI.mp_menus.MPMainMenu.optionsButtonAction,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_OPTIONS_DESC" ),
|
||||
button_over_func = function ( f22_arg0, f22_arg1 )
|
||||
PersistentBackground.SetToDefault()
|
||||
end
|
||||
}
|
||||
}
|
||||
f17_local6[#f17_local6 + 1] = {
|
||||
type = "generic_separator",
|
||||
id = "main_menu_spacer_id"
|
||||
}
|
||||
if not Engine.IsCoreMode() then
|
||||
f17_local6[#f17_local6 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "btn_MPMain_7",
|
||||
properties = {
|
||||
text = Engine.Localize( "@LUA_MENU_MULTIPLAYER_CAPS" ),
|
||||
button_action_func = function ( f23_arg0, f23_arg1 )
|
||||
Engine.StopMusic( 200 )
|
||||
Engine.SwitchToCoreMode()
|
||||
Engine.PlayMusic( CoD.Music.MainMPMusic )
|
||||
Engine.SetActiveMenu( ActiveMenus.None )
|
||||
Engine.SetActiveMenu( ActiveMenus.Main )
|
||||
end,
|
||||
button_over_func = function ( f24_arg0, f24_arg1 )
|
||||
PersistentBackground.Set( PersistentBackground.Variants.MPBackground )
|
||||
end,
|
||||
desc_text = Engine.Localize( "@PLATFORM_PLAY_ONLINE_DESC" )
|
||||
}
|
||||
}
|
||||
end
|
||||
if not SvS.IsSvS() then
|
||||
f17_local6[#f17_local6 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "btn_MPMain_8",
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_SQUAD_MODE_CAP" ),
|
||||
button_action_func = function ( f25_arg0, f25_arg1 )
|
||||
Engine.StopMusic( 200 )
|
||||
Engine.SwitchToSquadVsSquadMode()
|
||||
Engine.PlayMusic( CoD.Music.MainSquadMusic )
|
||||
Engine.SetActiveMenu( ActiveMenus.None )
|
||||
Engine.SetActiveMenu( ActiveMenus.Main )
|
||||
end,
|
||||
button_over_func = function ( f26_arg0, f26_arg1 )
|
||||
PersistentBackground.Set( PersistentBackground.Variants.SvSBackground )
|
||||
end,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_SVS_MAIN_MENU_DESC" )
|
||||
}
|
||||
}
|
||||
end
|
||||
if not Engine.IsAliensMode() and Engine.UnlockedAliens() then
|
||||
f17_local6[#f17_local6 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "btn_MPMain_9",
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_ALIENS_CAPS" ),
|
||||
button_action_func = function ( f27_arg0, f27_arg1 )
|
||||
Engine.StopMusic( 200 )
|
||||
Engine.SwitchToAliensMode()
|
||||
Engine.PlayMusic( CoD.Music.MainExtinctMusic )
|
||||
Engine.SetActiveMenu( ActiveMenus.None )
|
||||
Engine.SetActiveMenu( ActiveMenus.Main )
|
||||
end,
|
||||
button_over_func = function ( f28_arg0, f28_arg1 )
|
||||
PersistentBackground.Set( PersistentBackground.Variants.AliensBackground )
|
||||
end,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_ALIENS_MAIN_MENU_DESC" ),
|
||||
additional_handlers = {
|
||||
menu_create = LUI.mp_menus.MPMainMenu.AddExtinctionGlowBackground
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
f17_local6[#f17_local6 + 1] = {
|
||||
type = "button_desc_text",
|
||||
id = "mp_menu_button_description_id",
|
||||
properties = {
|
||||
lines = SvS.IsSvS() and 8 or nil
|
||||
}
|
||||
}
|
||||
return f17_local6
|
||||
end
|
||||
|
||||
-- Remove social button
|
||||
LUI.MenuBuilder.m_definitions["online_friends_widget"] = function()
|
||||
return {
|
||||
type = "UIElement"
|
||||
}
|
||||
end
|
||||
|
||||
f0_local0 = function ()
|
||||
return {
|
||||
type = "UIVerticalList",
|
||||
id = "mp_main_menu_id",
|
||||
childrenFeeder = main_menu_options_feeder,
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = true,
|
||||
bottomAnchor = false,
|
||||
leftAnchor = true,
|
||||
rightAnchor = false,
|
||||
top = GenericMenuDims.menu_top,
|
||||
bottom = GenericMenuDims.menu_bottom,
|
||||
left = GenericMenuDims.menu_left,
|
||||
right = GenericMenuDims.menu_right,
|
||||
alignment = LUI.Alignment.Top
|
||||
}
|
||||
},
|
||||
handlers = {
|
||||
dlc_mount_complete = function ( f30_arg0, f30_arg1 )
|
||||
f30_arg0:processEvent( {
|
||||
name = "menu_refresh"
|
||||
} )
|
||||
end
|
||||
,
|
||||
dlc_mount_fail = function ( f31_arg0, f31_arg1 )
|
||||
f31_arg0:processEvent( {
|
||||
name = "menu_refresh"
|
||||
} )
|
||||
end
|
||||
,
|
||||
dlc_download_fail = function ( f32_arg0, f32_arg1 )
|
||||
f32_arg0:processEvent( {
|
||||
name = "menu_refresh"
|
||||
} )
|
||||
end
|
||||
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
LUI.MenuBuilder.m_definitions[ "main_mp_menu_options"] = f0_local0
|
275
ui_scripts/menu_xboxlive/__init__.lua
Normal file
275
ui_scripts/menu_xboxlive/__init__.lua
Normal file
@ -0,0 +1,275 @@
|
||||
if (game:issingleplayer() or not Engine.InFrontend()) then
|
||||
return
|
||||
end
|
||||
|
||||
local Lobby = luiglobals.Lobby
|
||||
|
||||
local FindMatchAfterThrottleEvent = function( f4_arg0, f4_arg1 )
|
||||
local f4_local0 = false
|
||||
local f4_local1 = -1
|
||||
for f4_local2 = 0, Engine.GetMaxControllerCount() - 1, 1 do
|
||||
if Engine.HasActiveLocalClient( f4_local2 ) and IsFirstTimeFlowRequired( f4_local2 ) then
|
||||
f4_local0 = true
|
||||
if f4_local1 < 0 then
|
||||
f4_local1 = f4_local2
|
||||
end
|
||||
end
|
||||
end
|
||||
if f4_local0 then
|
||||
LUI.FlowManager.RequestAddMenu( f4_arg0, "cac_member_select_main", true, f4_local1, false, {
|
||||
next_screen = "cac_edit_main",
|
||||
squad_location = "squadMembers",
|
||||
class_location = "loadouts",
|
||||
findMatch = true
|
||||
} )
|
||||
elseif not LUI.mp_menus.MPXboxLiveMenu.disableCreateGameButtons() then
|
||||
Engine.Exec( "xblive_privatematch 0" )
|
||||
if Engine.IsAliensMode() then
|
||||
LUI.mp_menus.Aliens.AliensRunConfig( f4_arg1.controller )
|
||||
end
|
||||
if LUI.mp_menus.MPXboxLiveMenu.CheckHasRequiredDLC( f4_arg0 ) then
|
||||
if LUI.mp_menus.MPXboxLiveMenu.DisplayLowRepWarning( f4_arg0, f4_arg1 ) then
|
||||
return
|
||||
elseif SvS.IsSvS() then
|
||||
local f4_local3 = SvS.GetCurrentSquadModeInfo()
|
||||
local f4_local4, f4_local5 = SvS.GetPlaylistFromSquadMode( f4_local3 )
|
||||
local f4_local6 = false
|
||||
if f4_arg1.squadsPlayNow then
|
||||
f4_local6 = true
|
||||
end
|
||||
if not f4_arg1.squadsPlayNow and f4_local3.DynamicMatchmaking then
|
||||
Playlist.DoAction( f4_local4, f4_local5, true, f4_local6 )
|
||||
else
|
||||
Playlist.DoAction( f4_local4, f4_local5, false, f4_local6 )
|
||||
end
|
||||
if Engine.GetDvarBool( "squad_match" ) then
|
||||
Squad.StartMatch( f4_arg1.controller, true )
|
||||
Engine.SetDvarBool( "squad_find_match", true )
|
||||
end
|
||||
LUI.FlowManager.RequestAddMenu( f4_arg0, "menu_xboxlive_lobby", false, f4_arg1.controller, false )
|
||||
else
|
||||
LUI.FlowManager.RequestPopupMenu( f4_arg0, "menu_systemlink_join" ) -- open server list instead of playlist_main
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local FindMatchAction = function( f5_arg0, f5_arg1 )
|
||||
if Lobby.EnteringLobby() == true then
|
||||
LUI.FlowManager.RequestPopupMenu( f5_arg0, "popup_throttling", true, f5_arg1.controller, false, {
|
||||
eventData = f5_arg1
|
||||
} )
|
||||
else
|
||||
FindMatchAfterThrottleEvent( f5_arg0, f5_arg1 )
|
||||
end
|
||||
end
|
||||
|
||||
local BarracksAction = function( f9_arg0, f9_arg1 )
|
||||
LUI.FlowManager.RequestAddMenu( f9_arg0, "menu_stats", true, f9_arg1.controller ) -- custom stats menu
|
||||
end
|
||||
|
||||
package.loaded["LUI.mp_menus.MPXboxLiveMenu"].XboxLiveOptionsFeeder = function( f29_arg0 )
|
||||
local f29_local0 = Engine.IsAliensMode()
|
||||
local f29_local1 = SvS.IsSvS()
|
||||
local f29_local2 = SvS.IsSvS()
|
||||
if f29_local2 then
|
||||
f29_local2 = SvS.GetCurrentSquadModeInfo()
|
||||
end
|
||||
local f29_local3 = {}
|
||||
local f29_local4 = nil
|
||||
if f29_local0 then
|
||||
f29_local4 = Engine.Localize( "@LUA_MENU_STORE_CAPS" ) -- Orginally @LUA_MENU_PUBLIC_MATCH_CAPS but we need to use @LUA_MENU_STORE_CAPS
|
||||
elseif f29_local1 then
|
||||
f29_local4 = Engine.Localize( "@PLATFORM_FIND_GAME_CAPS" )
|
||||
else
|
||||
f29_local4 = Engine.Localize( "@LUA_MENU_STORE_CAPS" ) -- Orginally @PLATFORM_FIND_GAME_CAPS but we need to use @LUA_MENU_STORE_CAPS
|
||||
end
|
||||
f29_local3[#f29_local3 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "find_match_button_id",
|
||||
disabled = LUI.mp_menus.MPXboxLiveMenu.disableCreateGameButtons(),
|
||||
properties = {
|
||||
button_text = f29_local4,
|
||||
button_action_func = FindMatchAction,
|
||||
desc_text = SvS.IsSvS() and Engine.Localize( "@LUA_MENU_SQUADS_FIND_MATCH_DESC" ) or Engine.Localize( "@LUA_MENU_STORE_DESC" ), -- Orginally @PLATFORM_DESC_FIND_GAME but we need to use @LUA_MENU_STORE_DESC
|
||||
disabledFunc = LUI.mp_menus.MPXboxLiveMenu.disableCreateGameButtons,
|
||||
additional_handlers = {
|
||||
check_buttons = LUI.mp_menus.MPLivePrivateLobby.RefreshButtonDisable
|
||||
}
|
||||
}
|
||||
}
|
||||
if f29_local0 then
|
||||
f29_local3[#f29_local3 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "solo_match_button_id",
|
||||
disabled = LUI.mp_menus.MPXboxLiveMenu.shouldDisableSoloMatch(),
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_SOLO_MATCH_CAPS" ),
|
||||
button_action_func = LUI.mp_menus.MPXboxLiveMenu.SoloMatchAction,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_SOLO_MATCH_DESC" ),
|
||||
disabledFunc = LUI.mp_menus.MPXboxLiveMenu.shouldDisableSoloMatch,
|
||||
additional_handlers = {
|
||||
check_buttons = LUI.mp_menus.MPLivePrivateLobby.RefreshButtonDisable
|
||||
}
|
||||
}
|
||||
}
|
||||
f29_local3[#f29_local3 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "private_match_button_id",
|
||||
disabled = LUI.mp_menus.MPXboxLiveMenu.disableCreateGameButtons(),
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_CUSTOM_MATCH_CAPS" ),
|
||||
button_action_func = LUI.mp_menus.MPXboxLiveMenu.PrivateMatchAction,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_DESC_PRIVATE_MATCH" ),
|
||||
disabledFunc = LUI.mp_menus.MPXboxLiveMenu.disableCreateGameButtons,
|
||||
additional_handlers = {
|
||||
check_buttons = LUI.mp_menus.MPLivePrivateLobby.RefreshButtonDisable
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
if not f29_local0 then
|
||||
f29_local3[#f29_local3 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "create_squad_button_id",
|
||||
disabled = false,
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_CREATE_A_CLASS_CAPS" ),
|
||||
button_action_func = LUI.mp_menus.MPXboxLiveMenu.CreateSquadAction,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_A_CLASS" ),
|
||||
additional_handlers = {
|
||||
refresh_new_icons = function ( f30_arg0, f30_arg1 )
|
||||
if Cac.AnyUnseenMDLCItems( Engine.GetFirstActiveController(), NewIconsTable.CACItemTypes ) then
|
||||
f30_arg0:processEvent( {
|
||||
name = "show_new_icon"
|
||||
} )
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
f29_local3[#f29_local3 + 1] = LUI.mp_menus.AliensLoadout.GetAliensLoadoutButton()
|
||||
end
|
||||
|
||||
-- Disable Leaderboard (Code Removed)
|
||||
-- Disable Squad Reports (Code Removed)
|
||||
|
||||
if not f29_local0 and not f29_local1 then
|
||||
f29_local3[#f29_local3 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "operations_button_id",
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_OPERATIONS_TITLE" ),
|
||||
button_action_func = LUI.mp_menus.MPBarracks.BarrackOperationsAction,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_DESC_CHALLENGES" )
|
||||
}
|
||||
}
|
||||
end
|
||||
if not f29_local0 then
|
||||
if not f29_local1 then
|
||||
f29_local3[#f29_local3 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "barracks_button_id",
|
||||
disabled = false,
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_BARRACKS_CAPS" ),
|
||||
button_action_func = BarracksAction,
|
||||
desc_text = Clan.IsEnabled() and Engine.Localize( "@LUA_MENU_DESC_BARRACKS" ) or Engine.Localize( "@LUA_MENU_DESC_BARRACKS_PRIVATE" )
|
||||
}
|
||||
}
|
||||
end
|
||||
if not f29_local1 or f29_local2 ~= SvS.SquadModes.SquadVsSquad then
|
||||
f29_local3[#f29_local3 + 1] = {
|
||||
type = "generic_separator"
|
||||
}
|
||||
end
|
||||
if not f29_local1 then
|
||||
f29_local3[#f29_local3 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "private_match_button_id",
|
||||
disabled = LUI.mp_menus.MPXboxLiveMenu.disableCreateGameButtons(),
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_PRIVATE_MATCH_CAPS" ),
|
||||
button_action_func = LUI.mp_menus.MPXboxLiveMenu.PrivateMatchAction,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_DESC_PRIVATE_MATCH" ),
|
||||
disabledFunc = LUI.mp_menus.MPXboxLiveMenu.disableCreateGameButtons,
|
||||
additional_handlers = {
|
||||
check_buttons = LUI.mp_menus.MPLivePrivateLobby.RefreshButtonDisable
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
-- Add Combat Training Button
|
||||
if not f29_local0 and not f29_local1 then
|
||||
game:addlocalizedstring("LUA_MENU_COMBAT", "COMBAT TRAINING");
|
||||
game:addlocalizedstring("LUA_MENU_COMBAT_DESC", "Rank up offline with bots.");
|
||||
|
||||
f29_local3[#f29_local3 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "find_match_button_id2",
|
||||
disabled = LUI.mp_menus.MPXboxLiveMenu.disableCreateGameButtons(),
|
||||
properties = {
|
||||
button_text = Engine.Localize("@LUA_MENU_COMBAT"), -- Engine.Localize( "@PLATFORM_FIND_GAME_CAPS" ),
|
||||
button_action_func = LUI.mp_menus.MPXboxLiveMenu.FindMatchAction,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_COMBAT_DESC" ), -- Engine.Localize( "@LUA_MENU_SQUADS_FIND_MATCH_DESC" )
|
||||
disabledFunc = LUI.mp_menus.MPXboxLiveMenu.disableCreateGameButtons,
|
||||
additional_handlers = {
|
||||
check_buttons = LUI.mp_menus.MPLivePrivateLobby.RefreshButtonDisable
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
if f29_local1 then
|
||||
-- Disable Challenge Friend Button (Code Removed)
|
||||
if f29_local2 then
|
||||
f29_local3[#f29_local3 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "play_now_button_id",
|
||||
disabled = LUI.mp_menus.MPXboxLiveMenu.disableCreateGameButtons(),
|
||||
properties = {
|
||||
button_text = Engine.Localize( "LUA_MENU_PLAY_NOW_CAPS" ),
|
||||
button_action_func = function ( f36_arg0, f36_arg1 )
|
||||
f36_arg1.squadsPlayNow = true
|
||||
FindMatchAction( f36_arg0, f36_arg1 )
|
||||
end,
|
||||
desc_text = Engine.Localize( "LUA_MENU_PLAY_NOW_DESC" ),
|
||||
disabledFunc = LUI.mp_menus.MPXboxLiveMenu.disableCreateGameButtons,
|
||||
additional_handlers = {
|
||||
check_buttons = LUI.mp_menus.MPLivePrivateLobby.RefreshButtonDisable
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
local f29_local6 = #f29_local3 + 1
|
||||
local f29_local7 = {
|
||||
type = "button_desc_text",
|
||||
id = "prelobby_description_id"
|
||||
}
|
||||
local f29_local8 = {}
|
||||
local f29_local9
|
||||
if (SvS.IsSvS() or f29_local2 ~= SvS.SquadModes.SquadAssault) or Engine.IsAliensMode() or Engine.IsCoreMode() then
|
||||
f29_local9 = 1
|
||||
if f29_local9 then
|
||||
f29_local8.lines = f29_local9
|
||||
f29_local7.properties = f29_local8
|
||||
f29_local3[f29_local6] = f29_local7
|
||||
f29_local3[#f29_local3 + 1] = {
|
||||
type = "UITimer",
|
||||
id = "bnt_lock_tmr",
|
||||
properties = {
|
||||
event = "check_buttons",
|
||||
interval = 500,
|
||||
disposable = false,
|
||||
broadcastToRoot = true
|
||||
}
|
||||
}
|
||||
return f29_local3
|
||||
end
|
||||
end
|
||||
f29_local9 = nil
|
||||
end
|
305
ui_scripts/mp_live_public_lobby/__init__.lua
Normal file
305
ui_scripts/mp_live_public_lobby/__init__.lua
Normal file
@ -0,0 +1,305 @@
|
||||
if (game:issingleplayer() or not Engine.InFrontend()) then
|
||||
return
|
||||
end
|
||||
|
||||
package.loaded["LUI.mp_menus.MPLivePublicLobby"].LivePublicLobbyOptionsFeeder = function( f18_arg0 )
|
||||
local f18_local0 = Lobby.GetVoteMapName( MapVoting.MapA.refNum )
|
||||
local f18_local1 = Lobby.GetVoteMapName( MapVoting.MapB.refNum )
|
||||
local f18_local2 = Lobby.GetVoteMapImage( MapVoting.MapA.refNum )
|
||||
local f18_local3 = Lobby.GetVoteMapImage( MapVoting.MapB.refNum )
|
||||
local f18_local4 = LUI.mp_menus.Aliens.FixGameModeTextForChaos( Lobby.GetVoteMapGametype( MapVoting.MapA.refNum ) )
|
||||
local f18_local5 = LUI.mp_menus.Aliens.FixGameModeTextForChaos( Lobby.GetVoteMapGametype( MapVoting.MapB.refNum ) )
|
||||
local f18_local6 = LUI.mp_menus.MPLivePublicLobby.IsVotingFinished()
|
||||
local f18_local7 = not LUI.mp_menus.MPLivePublicLobby.GetLobbyLeaderboardStatus()
|
||||
local f18_local8 = Engine.IsAliensMode()
|
||||
local f18_local9 = SvS.IsSvS()
|
||||
if not f18_local9 then
|
||||
f18_local9 = Engine.GetDvarBool( "squad_match" )
|
||||
end
|
||||
local f18_local10 = 14
|
||||
local f18_local11 = {}
|
||||
if not f18_arg0.slot then
|
||||
DebugPrint( "[WARNING] CAC: using cac slot index 0, this is only ok if you are editing a menu" )
|
||||
local f18_local12 = 0
|
||||
end
|
||||
local f18_local13 = Cac.GetCustomClassLoc( f18_arg0.classLocation )
|
||||
|
||||
|
||||
-- Add Start Button to Public Match Menu
|
||||
function ReadyUpAction( f11_arg0, f11_arg1 )
|
||||
Engine.SetDvarInt( "party_minplayers", 1)
|
||||
end
|
||||
|
||||
if not f18_local9 then
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "ready_up_button_id",
|
||||
disabledFunc = false,
|
||||
properties = {
|
||||
disabledFunc = false,
|
||||
button_text = Engine.Localize( "@LUA_MENU_START_GAME_CAPS" ),
|
||||
button_action_func = ReadyUpAction,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_DESC_READY_UP" ),
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
if f18_local8 then
|
||||
local f18_local14 = Engine.GetDvarInt( "pt_AliensReadyUpPublicInUse" )
|
||||
if f18_local14 ~= nil and f18_local14 ~= 0 then
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "ready_up_button_id",
|
||||
disabledFunc = LUI.mp_menus.MPLivePublicLobby.GetReadyUpDisableValue,
|
||||
properties = {
|
||||
disabledFunc = LUI.mp_menus.MPLivePublicLobby.GetReadyUpDisableValue,
|
||||
button_text = "",
|
||||
button_action_func = LUI.mp_menus.MPLivePublicLobby.ReadyUpAction,
|
||||
desc_text = LUI.mp_menus.MPLivePublicLobby.GetReadyUpDescText,
|
||||
additional_handlers = {
|
||||
recheck_start_button_lock = LUI.mp_menus.MPLivePublicLobby.RefreshButtonDisable,
|
||||
element_refresh = LUI.mp_menus.MPLivePublicLobby.UpdateReadyUpText,
|
||||
menu_create = LUI.mp_menus.MPLivePublicLobby.UpdateReadyUpText,
|
||||
ready_up_button_refresh = LUI.mp_menus.MPLivePublicLobby.UpdateReadyUpText
|
||||
}
|
||||
},
|
||||
children = {
|
||||
{
|
||||
type = "UITimer",
|
||||
id = "ready_up_button_refresh_timer_id",
|
||||
properties = {
|
||||
event = "ready_up_button_refresh",
|
||||
interval = 100,
|
||||
disposable = false,
|
||||
broadcastToRoot = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
if not f18_local8 then
|
||||
if not SvS.IsSvS() or SvS.GetCurrentSquadModeInfo() ~= SvS.SquadModes.SquadAssault then
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "create_squad_button_id",
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_CREATE_A_CLASS_CAPS" ),
|
||||
button_action_func = LUI.mp_menus.MPLivePublicLobby.CreateSquadAction,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_A_CLASS" )
|
||||
}
|
||||
}
|
||||
end
|
||||
else
|
||||
f18_local11[#f18_local11 + 1] = LUI.mp_menus.AliensLoadout.GetAliensLoadoutButton()
|
||||
end
|
||||
if not f18_local8 and not f18_local9 then
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "operations_button_id",
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_OPERATIONS_TITLE" ),
|
||||
button_action_func = LUI.mp_menus.MPBarracks.BarrackOperationsAction,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_DESC_CHALLENGES" )
|
||||
}
|
||||
}
|
||||
end
|
||||
if not f18_local9 and not f18_local8 then
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "barracks_button_id",
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_BARRACKS_CAPS" ),
|
||||
button_action_func = LUI.mp_menus.MPLivePublicLobby.BarracksAction,
|
||||
desc_text = Clan.IsEnabled() and Engine.Localize( "@LUA_MENU_DESC_BARRACKS" ) or Engine.Localize( "@LUA_MENU_DESC_BARRACKS_PRIVATE" )
|
||||
}
|
||||
}
|
||||
end
|
||||
-- Disable Leaderboard (Code Removed)
|
||||
if f18_local9 then
|
||||
local f18_local14 = SvS.GetCurrentSquadModeInfo()
|
||||
if f18_local14 and f18_local14.HasReports then
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "squad_reports_button_id",
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_SQUAD_REPORTS" ),
|
||||
desc_text = Engine.Localize( "@LUA_MENU_SQUAD_REPORTS_DESC" ),
|
||||
button_action_func = function ( f19_arg0, f19_arg1 )
|
||||
LUI.FlowManager.RequestAddMenu( f19_arg0, "squad_reports_menu", false, f19_arg1.controller, false, {
|
||||
controller = f19_arg1.controller,
|
||||
fromLiveLobby = true
|
||||
} )
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
if f18_local14 and f18_local14.HasCompare then
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "squad_compare_button_id",
|
||||
disabled = LUI.mp_menus.MPLivePublicLobby.CheckSquadCompareDisabled(),
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_SQUAD_COMPARE" ),
|
||||
desc_text = Engine.Localize( "@LUA_MENU_SQUAD_COMPARE_DESC" ),
|
||||
button_action_func = function ( f20_arg0, f20_arg1 )
|
||||
if Squad.FoundMatch() then
|
||||
local f20_local0 = SvS.BuildSquadCompareData( f20_arg1.controller )
|
||||
if f20_local0 then
|
||||
LUI.FlowManager.RequestAddMenu( f20_arg0, "squad_report_detail_menu", false, f20_arg1.controller, false, {
|
||||
reportData = f20_local0,
|
||||
controller = f20_arg1.controller,
|
||||
isCompare = true
|
||||
} )
|
||||
end
|
||||
end
|
||||
end
|
||||
},
|
||||
handlers = {
|
||||
check_button_disable_status = function ( f21_arg0, f21_arg1 )
|
||||
local f21_local0 = f21_arg0
|
||||
local f21_local1 = f21_arg0.processEvent
|
||||
local f21_local2 = {}
|
||||
local f21_local3
|
||||
if not LUI.mp_menus.MPLivePublicLobby.CheckSquadCompareDisabled() then
|
||||
f21_local3 = "enable"
|
||||
if not f21_local3 then
|
||||
|
||||
else
|
||||
f21_local2.name = f21_local3
|
||||
f21_local1( f21_local0, f21_local2 )
|
||||
end
|
||||
end
|
||||
f21_local3 = "disable"
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
if f18_local9 then
|
||||
local f18_local14 = SvS.GetCurrentSquadModeInfo()
|
||||
if not f18_local14.HasLeaderboard then
|
||||
|
||||
else
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "leaderboards_button_id",
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_LEADERBOARDS_CAPS" ),
|
||||
desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARDS" ),
|
||||
button_action_func = function ( f22_arg0, f22_arg1 )
|
||||
if Engine.IsUserAGuest( f22_arg1.controller ) then
|
||||
LUI.FlowManager.RequestPopupMenu( f22_arg0, "popup_no_guest", true, f22_arg1.controller )
|
||||
else
|
||||
LUI.FlowManager.RequestAddMenu( f22_arg0, "leaderboards", true, f22_arg1.controller )
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
if f18_local8 then
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "leaderboards_button_id",
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_LEADERBOARDS_CAPS" ),
|
||||
desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARDS" ),
|
||||
button_action_func = function ( f22_arg0, f22_arg1 )
|
||||
if Engine.IsUserAGuest( f22_arg1.controller ) then
|
||||
LUI.FlowManager.RequestPopupMenu( f22_arg0, "popup_no_guest", true, f22_arg1.controller )
|
||||
else
|
||||
LUI.FlowManager.RequestAddMenu( f22_arg0, "leaderboards", true, f22_arg1.controller )
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
if f18_local8 and LUI.mp_menus.Aliens.CanAccessIntelMenu() then
|
||||
f18_local11[#f18_local11 + 1] = LUI.mp_menus.AliensIntel.GetAliensIntelButton()
|
||||
end
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "button_desc_text",
|
||||
id = "public_lobby_description_id",
|
||||
properties = {
|
||||
lines = 1
|
||||
}
|
||||
}
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "UIElement",
|
||||
id = "just_a_spacer_id",
|
||||
focusable = false,
|
||||
states = {
|
||||
default = {
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
topAnchor = true,
|
||||
bottomAnchor = false,
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = f18_local10
|
||||
}
|
||||
}
|
||||
}
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "UITimer",
|
||||
id = "check_status_tmr",
|
||||
properties = {
|
||||
event = "check_button_disable_status",
|
||||
interval = 500,
|
||||
disposable = false,
|
||||
broadcastToRoot = true
|
||||
}
|
||||
}
|
||||
if not f18_local9 and not f18_local6 then
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "map_button",
|
||||
id = "map_button_1",
|
||||
properties = {
|
||||
mapVoteIndex = MapVoting.MapA.refNum,
|
||||
mapImage = RegisterMaterial( f18_local2 ),
|
||||
mapName = f18_local0,
|
||||
gamemode = f18_local4,
|
||||
votesText = Engine.GetDvarString( "party_nextMapVoteStatus" ),
|
||||
votesDvarName = "party_nextMapVoteStatus",
|
||||
action = function ( f23_arg0, f23_arg1 )
|
||||
LUI.mp_menus.MPLivePublicLobby.VoteForMap( f23_arg0, f23_arg1.controller, MapVoting.MapA.voteIndex )
|
||||
end
|
||||
}
|
||||
}
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "UIElement",
|
||||
id = "just_another_spacer_id",
|
||||
focusable = false,
|
||||
states = {
|
||||
default = {
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
topAnchor = true,
|
||||
bottomAnchor = false,
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 40
|
||||
}
|
||||
}
|
||||
}
|
||||
f18_local11[#f18_local11 + 1] = {
|
||||
type = "map_button",
|
||||
id = "map_button_2",
|
||||
properties = {
|
||||
mapVoteIndex = MapVoting.MapB.refNum,
|
||||
mapImage = RegisterMaterial( f18_local3 ),
|
||||
mapName = f18_local1,
|
||||
gamemode = f18_local5,
|
||||
votesText = Engine.GetDvarString( "party_alternateMapVoteStatus" ),
|
||||
votesDvarName = "party_alternateMapVoteStatus",
|
||||
action = function ( f24_arg0, f24_arg1 )
|
||||
LUI.mp_menus.MPLivePublicLobby.VoteForMap( f24_arg0, f24_arg1.controller, MapVoting.MapB.voteIndex )
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
return f18_local11
|
||||
end
|
436
ui_scripts/server_filter/__init__.lua
Normal file
436
ui_scripts/server_filter/__init__.lua
Normal file
@ -0,0 +1,436 @@
|
||||
if (game:issingleplayer() or not Engine.InFrontend()) then
|
||||
return
|
||||
end
|
||||
|
||||
local Lobby = luiglobals.Lobby
|
||||
|
||||
game:addlocalizedstring("LUA_MENU_SERVER_FILTER_POPUP_INSTR", "Change how the servers are filtered")
|
||||
|
||||
function FiltersPopupClose(f1_arg0, f1_arg1)
|
||||
local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement(f1_arg0)
|
||||
local f1_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName("mp_leaderboard_main")
|
||||
local f1_local2 = f1_local1.leaderboardType
|
||||
if f1_local2 and f1_local2 ~= "" then
|
||||
Leaderboards.OpenLeaderboard(f1_arg0, f1_local2, f1_local0.filterKey, f1_local1.filterDurationKey, f1_local1.isHardcore)
|
||||
end
|
||||
end
|
||||
|
||||
function mp_server_filters_popup()
|
||||
return {
|
||||
type = "UIElement",
|
||||
id = "mp_leaderboard_filters_popup_container_id",
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = true,
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
left = 0,
|
||||
right = 0
|
||||
}
|
||||
},
|
||||
children = {
|
||||
{
|
||||
type = "UIImage",
|
||||
id = "darken_bg",
|
||||
states = {
|
||||
default = CoD.ColorizeState(Swatches.Overlay.Color, {
|
||||
topAnchor = true,
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
material = RegisterMaterial("white"),
|
||||
alpha = Swatches.Overlay.AlphaMore
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "UIElement",
|
||||
id = "mp_server_filters_popup_id",
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = false,
|
||||
bottomAnchor = false,
|
||||
leftAnchor = false,
|
||||
rightAnchor = false,
|
||||
top = -1 * Leaderboards.Layout.FilterHeight * 0.6,
|
||||
width = Leaderboards.Layout.FilterWidth,
|
||||
height = 170
|
||||
}
|
||||
},
|
||||
children = {
|
||||
{
|
||||
type = "generic_drop_shadow",
|
||||
properties = {
|
||||
offset_shadow = 0
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "generic_menu_titlebar",
|
||||
id = "server_filters_popup_title_bar_id",
|
||||
properties = {
|
||||
title_bar_text = Engine.Localize("@LUA_MENU_FILTER_CAPS"),
|
||||
fill_alpha = 1
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "generic_menu_background",
|
||||
id = "server_filters_popup_background",
|
||||
properties = {
|
||||
fill_alpha = 1
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "mp_server_filters_popup_page"
|
||||
},
|
||||
{
|
||||
type = "UIBindButton",
|
||||
id = "filters_popup_back_button",
|
||||
handlers = {
|
||||
button_secondary = MBh.DoMultiple({
|
||||
MBh.LeaveMenu(),
|
||||
FiltersPopupClose,
|
||||
ForceRefreshServers
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function ForceRefreshServers(f4_arg0, f4_arg1)
|
||||
local f4_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName("menu_systemlink_join")
|
||||
f4_local0.serverCount = 0
|
||||
if f4_local0.serverList then
|
||||
local f4_local1 = Lobby.RefreshServerList
|
||||
local f4_local2 = f4_arg1.controller
|
||||
if not f4_local2 then
|
||||
f4_local2 = Engine.GetFirstActiveController()
|
||||
end
|
||||
f4_local1(f4_local2)
|
||||
f4_local0.serverList:processEvent({
|
||||
name = "lose_focus",
|
||||
immediate = true
|
||||
})
|
||||
f4_local0.serverList:clearSavedState()
|
||||
f4_local0.serverList:processEvent({
|
||||
name = "menu_refresh",
|
||||
dispatchChildren = true
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function OpenFiltersMenu(f36_arg0, f36_arg1)
|
||||
LUI.FlowManager.RequestPopupMenu(f36_arg0, "mp_server_filters_popup", true, f36_arg1.controller, false, {})
|
||||
end
|
||||
|
||||
LUI.MenuBuilder.registerDef("mp_server_filters_popup", mp_server_filters_popup)
|
||||
|
||||
GameTypeRefCol = 0
|
||||
GameTypeNameCol = 1
|
||||
GameTypeDescCol = 2
|
||||
GameTypeImageCol = 3
|
||||
|
||||
function GetGametypes()
|
||||
if Engine.IsCoreMode() then
|
||||
return { "any", "dm", "war", "sd", "dom", "conf", "sr", "infect", "blitz", "grind", "cranked", "sotf", "sotf_ffa",
|
||||
"horde", "gun", "grnd", "siege" }
|
||||
end
|
||||
return { "aliens" }
|
||||
end
|
||||
|
||||
function GetLocalizedStringFromGametype(gametype)
|
||||
if gametype == "any" then
|
||||
return string.upper(Engine.Localize("LUA_MENU_LB_FILTER_GROUP_ALL"))
|
||||
end
|
||||
local gametype_name = Engine.TableLookup("mp/gameTypesTable.csv", GameTypeRefCol, gametype, GameTypeNameCol)
|
||||
if gametype_name ~= "" then
|
||||
local token = "@"
|
||||
local caps_token = "_CAPS"
|
||||
localized = Engine.Localize(token .. gametype_name .. caps_token)
|
||||
return localized
|
||||
end
|
||||
return "UNKNOWN"
|
||||
end
|
||||
|
||||
function GetMapnameFromID(id)
|
||||
if id == "any" then
|
||||
return string.upper(Engine.Localize("LUA_MENU_LB_FILTER_GROUP_ALL"))
|
||||
end
|
||||
|
||||
if id == "mp_descent_new" then
|
||||
return Engine.Localize("@LUA_MENU_MAPNAME_DESCENT_CAPS")
|
||||
elseif id == "mp_favela_iw6" then
|
||||
return string.upper(Engine.Localize("@PRESENCE_MP_FAVELA_IW6"))
|
||||
elseif id == "mp_conflict" then
|
||||
return string.upper(Engine.Localize("@PRESENCE_MP_CONFLICT"))
|
||||
elseif id == "mp_mine" then
|
||||
return string.upper(Engine.Localize("@PRESENCE_MP_MINE"))
|
||||
elseif id == "mp_shipment_ns" then
|
||||
return string.upper(Engine.Localize("@PRESENCE_MP_SHIPMENT_NS"))
|
||||
elseif id == "mp_zerosub" then
|
||||
return string.upper(Engine.Localize("@PRESENCE_MP_ZEROSUB"))
|
||||
elseif id == "mp_ca_red_river" then
|
||||
return string.upper(Engine.Localize("@PRESENCE_MP_CA_RED_RIVER"))
|
||||
elseif id == "mp_ca_rumble" then
|
||||
return string.upper(Engine.Localize("@PRESENCE_MP_CA_RUMBLE"))
|
||||
end
|
||||
|
||||
if id == "mp_alien_town" then
|
||||
return string.upper(Engine.Localize("@MPUI_ALIEN_TOWN"))
|
||||
elseif id == "mp_alien_armory" then
|
||||
return string.upper(Engine.Localize("@MPUI_ALIEN_ARMORY"))
|
||||
elseif id == "mp_alien_beacon" then
|
||||
return string.upper(Engine.Localize("@MPUI_ALIEN_BEACON"))
|
||||
elseif id == "mp_alien_dlc3" then
|
||||
return string.upper(Engine.Localize("@PRESENCE_MP_ALIEN_DLC3"))
|
||||
elseif id == "mp_alien_last" then
|
||||
return string.upper(Engine.Localize("@PRESENCE_MP_ALIEN_LAST"))
|
||||
end
|
||||
|
||||
return Engine.Localize("@LUA_MENU_MAPNAME_" .. id:sub(4) .. "_CAPS")
|
||||
end
|
||||
|
||||
function GetMaps()
|
||||
if Engine.IsCoreMode() then
|
||||
return {
|
||||
"any",
|
||||
"mp_prisonbreak",
|
||||
"mp_dart",
|
||||
"mp_lonestar",
|
||||
"mp_frag",
|
||||
"mp_snow",
|
||||
"mp_fahrenheit",
|
||||
"mp_hashima",
|
||||
"mp_warhawk",
|
||||
"mp_sovereign",
|
||||
"mp_zebra",
|
||||
"mp_skeleton",
|
||||
"mp_chasm",
|
||||
"mp_flooded",
|
||||
"mp_strikezone",
|
||||
"mp_descent_new",
|
||||
"mp_ca_red_river",
|
||||
"mp_ca_rumble",
|
||||
"mp_swamp",
|
||||
"mp_boneyard_ns",
|
||||
"mp_dome_ns",
|
||||
"mp_battery3",
|
||||
"mp_ca_impact",
|
||||
"mp_ca_behemoth",
|
||||
"mp_dig",
|
||||
"mp_zulu",
|
||||
"mp_pirate",
|
||||
"mp_favela_iw6",
|
||||
"mp_zerosub",
|
||||
"mp_conflict",
|
||||
"mp_mine",
|
||||
"mp_shipment_ns",
|
||||
}
|
||||
elseif Engine.IsAliensMode() then
|
||||
return {
|
||||
"any",
|
||||
"mp_alien_town",
|
||||
"mp_alien_armory",
|
||||
"mp_alien_beacon",
|
||||
"mp_alien_dlc3",
|
||||
"mp_alien_last"
|
||||
}
|
||||
end
|
||||
|
||||
return { "any" }
|
||||
end
|
||||
|
||||
function ServerFiltersPopupItems(f7_arg0)
|
||||
|
||||
local rules = {}
|
||||
if Engine.IsCoreMode() then
|
||||
local gametype = {
|
||||
type = "UIGenericButton",
|
||||
id = "server_filters_gametype",
|
||||
properties = {
|
||||
style = GenericButtonSettings.Styles.GlassButton,
|
||||
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu,
|
||||
variant = GenericButtonSettings.Variants.Select,
|
||||
content_width = 258,
|
||||
side = "left",
|
||||
button_text = Engine.Localize("@LUA_MENU_MODE_CAPS"),
|
||||
button_display_func = function(f8_arg0, f8_arg1)
|
||||
local focusedElement = LUI.FlowManager.GetMenuScopedDataFromElement(f8_arg0)
|
||||
if focusedElement.filterGametypeKey == nil then
|
||||
focusedElement.filterGametypeKey = Engine.GetDvarString("ui_mapvote_entrya_gametype")
|
||||
end
|
||||
Engine.SetDvarString("ui_mapvote_entrya_gametype", focusedElement.filterGametypeKey)
|
||||
return Engine.Localize(GetLocalizedStringFromGametype(focusedElement.filterGametypeKey))
|
||||
end,
|
||||
button_left_func = function(f9_arg0, f9_arg1)
|
||||
local focusedElement = LUI.FlowManager.GetMenuScopedDataFromElement(f9_arg0)
|
||||
local keys = GetGametypes()
|
||||
local defaultKeysI = 1
|
||||
for i = 1, #keys, 1 do
|
||||
if keys[i] == focusedElement.filterGametypeKey then
|
||||
defaultKeysI = i
|
||||
break
|
||||
end
|
||||
end
|
||||
defaultKeysI = defaultKeysI - 1
|
||||
if defaultKeysI < 1 then
|
||||
focusedElement.filterGametypeKey = keys[#keys]
|
||||
else
|
||||
focusedElement.filterGametypeKey = keys[defaultKeysI]
|
||||
end
|
||||
end,
|
||||
button_right_func = function(f10_arg0, f10_arg1)
|
||||
local focusedElement = LUI.FlowManager.GetMenuScopedDataFromElement(f10_arg0)
|
||||
local keys = GetGametypes()
|
||||
local defaultKeysI = 1
|
||||
for i = 1, #keys, 1 do
|
||||
if keys[i] == focusedElement.filterGametypeKey then
|
||||
defaultKeysI = i
|
||||
break
|
||||
end
|
||||
end
|
||||
defaultKeysI = defaultKeysI + 1
|
||||
if #keys < defaultKeysI then
|
||||
focusedElement.filterGametypeKey = keys[1]
|
||||
else
|
||||
focusedElement.filterGametypeKey = keys[defaultKeysI]
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
table.insert(rules, gametype)
|
||||
end
|
||||
|
||||
local maps = {
|
||||
type = "UIGenericButton",
|
||||
id = "server_filters_map",
|
||||
properties = {
|
||||
style = GenericButtonSettings.Styles.GlassButton,
|
||||
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu,
|
||||
variant = GenericButtonSettings.Variants.Select,
|
||||
content_width = 258,
|
||||
side = "left",
|
||||
button_text = Engine.Localize("@LUA_MENU_MAPS_CAPS"),
|
||||
button_display_func = function(f8_arg0, f8_arg1)
|
||||
local focusedElement = LUI.FlowManager.GetMenuScopedDataFromElement(f8_arg0)
|
||||
if focusedElement.filterMapnameKey == nil then
|
||||
focusedElement.filterMapnameKey = Engine.GetDvarString("ui_mapvote_entrya_mapname")
|
||||
end
|
||||
Engine.SetDvarString("ui_mapvote_entrya_mapname", focusedElement.filterMapnameKey)
|
||||
return GetMapnameFromID(focusedElement.filterMapnameKey)
|
||||
end,
|
||||
button_left_func = function(f9_arg0, f9_arg1)
|
||||
local focusedElement = LUI.FlowManager.GetMenuScopedDataFromElement(f9_arg0)
|
||||
local keys = GetMaps()
|
||||
local defaultKeysI = 1
|
||||
for i = 1, #keys, 1 do
|
||||
if keys[i] == focusedElement.filterMapnameKey then
|
||||
defaultKeysI = i
|
||||
break
|
||||
end
|
||||
end
|
||||
defaultKeysI = defaultKeysI - 1
|
||||
if defaultKeysI < 1 then
|
||||
focusedElement.filterMapnameKey = keys[#keys]
|
||||
else
|
||||
focusedElement.filterMapnameKey = keys[defaultKeysI]
|
||||
end
|
||||
end,
|
||||
button_right_func = function(f10_arg0, f10_arg1)
|
||||
local focusedElement = LUI.FlowManager.GetMenuScopedDataFromElement(f10_arg0)
|
||||
local keys = GetMaps()
|
||||
local defaultKeysI = 1
|
||||
for i = 1, #keys, 1 do
|
||||
if keys[i] == focusedElement.filterMapnameKey then
|
||||
defaultKeysI = i
|
||||
break
|
||||
end
|
||||
end
|
||||
defaultKeysI = defaultKeysI + 1
|
||||
if #keys < defaultKeysI then
|
||||
focusedElement.filterMapnameKey = keys[1]
|
||||
else
|
||||
focusedElement.filterMapnameKey = keys[defaultKeysI]
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
table.insert(rules, maps)
|
||||
|
||||
return rules
|
||||
end
|
||||
|
||||
function mp_server_filters_popup_page()
|
||||
return {
|
||||
type = "UIElement",
|
||||
id = "mp_server_filters_popup_page_id",
|
||||
properties = {},
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = true,
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = AAR.Layout.TitleBarHeight + 1,
|
||||
bottom = -1,
|
||||
left = 1,
|
||||
right = -1,
|
||||
}
|
||||
},
|
||||
children = {
|
||||
{
|
||||
type = "UIText",
|
||||
id = "leaderboard_filters_instruction",
|
||||
properties = {
|
||||
text = Engine.Localize("@LUA_MENU_SERVER_FILTER_POPUP_INSTR")
|
||||
},
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = true,
|
||||
bottomAnchor = false,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = 10,
|
||||
bottom = 10 + CoD.TextSettings.NormalFont.Height,
|
||||
left = 75,
|
||||
right = -75,
|
||||
alignment = LUI.Alignment.Center,
|
||||
font = CoD.TextSettings.NormalFont.Font,
|
||||
red = Colors.white.r,
|
||||
green = Colors.white.g,
|
||||
blue = Colors.white.b
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "UIVerticalList",
|
||||
id = "server_filters_popup_vlist",
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = false,
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = -75,
|
||||
bottom = 0,
|
||||
left = 2,
|
||||
right = -2,
|
||||
spacing = 5
|
||||
}
|
||||
},
|
||||
childrenFeeder = ServerFiltersPopupItems
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
LUI.MenuBuilder.registerDef("mp_server_filters_popup_page", mp_server_filters_popup_page)
|
636
ui_scripts/server_list/__init__.lua
Normal file
636
ui_scripts/server_list/__init__.lua
Normal file
@ -0,0 +1,636 @@
|
||||
if (game:issingleplayer() or not Engine.InFrontend()) then
|
||||
return
|
||||
end
|
||||
|
||||
local Lobby = luiglobals.Lobby
|
||||
local SystemLinkJoinMenu = LUI.mp_menus.SystemLinkJoinMenu
|
||||
|
||||
local controller = nil
|
||||
local server = nil
|
||||
|
||||
COLUMN_0 = 0
|
||||
COLUMN_1 = 460
|
||||
COLUMN_2 = 660
|
||||
COLUMN_3 = 800
|
||||
COLUMN_4 = 985
|
||||
COLUMN_5 = 500
|
||||
|
||||
SystemLinkJoinMenu.UpdateGameList = function(f3_arg0, f3_arg1)
|
||||
local f3_local0 = f3_arg1.controller
|
||||
if not f3_local0 then
|
||||
f3_local0 = Engine.GetFirstActiveController()
|
||||
end
|
||||
local f3_local1 = LUI.FlowManager.GetMenuScopedDataFromElement(f3_arg0)
|
||||
Lobby.UpdateServerDisplayList(f3_local0)
|
||||
local f3_local2 = Lobby.GetServerCount(f3_local0)
|
||||
if f3_local2 ~= f3_local1.serverCount then
|
||||
f3_local1.serverCount = f3_local2
|
||||
f3_arg0:processEvent({
|
||||
name = "menu_refresh",
|
||||
immediate = true
|
||||
})
|
||||
f3_arg0:processEvent({
|
||||
name = "gain_focus",
|
||||
immediate = true
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
SystemLinkJoinMenu.RefreshServers = function(f4_arg0, f4_arg1)
|
||||
local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement(f4_arg0)
|
||||
f4_local0.serverCount = 0
|
||||
if f4_local0.serverList then
|
||||
local f4_local1 = Lobby.RefreshServerList
|
||||
local f4_local2 = f4_arg1.controller
|
||||
if not f4_local2 then
|
||||
f4_local2 = Engine.GetFirstActiveController()
|
||||
end
|
||||
f4_local1(f4_local2)
|
||||
f4_local0.serverList:processEvent({
|
||||
name = "lose_focus",
|
||||
immediate = true
|
||||
})
|
||||
f4_local0.serverList:clearSavedState()
|
||||
f4_local0.serverList:processEvent({
|
||||
name = "menu_refresh",
|
||||
dispatchChildren = true
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function CreateColumnImage(id, shader, leftAnchor, rightAnchor, left, alpha)
|
||||
return {
|
||||
type = "UIImage",
|
||||
id = id,
|
||||
states = {
|
||||
default = {
|
||||
font = CoD.TextSettings.NormalFont.Font,
|
||||
alignment = LUI.Alignment.right,
|
||||
height = 20,
|
||||
width = 20,
|
||||
left = left,
|
||||
red = Colors.cac_label_text.r,
|
||||
green = Colors.cac_label_text.g,
|
||||
blue = Colors.cac_label_text.b,
|
||||
alpha = alpha,
|
||||
material = RegisterMaterial(shader)
|
||||
},
|
||||
},
|
||||
handlers = {
|
||||
button_over = MBh.AnimateToState("over"),
|
||||
button_up = MBh.AnimateToState("default"),
|
||||
button_disable = MBh.AnimateToState("disabled")
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
SystemLinkJoinMenu.CreateHeaderDef = function()
|
||||
local header = {
|
||||
type = "UIElement",
|
||||
id = "header_row_id",
|
||||
states = {
|
||||
default = CoD.ColorizeState(Swatches.Overlay.Color, {
|
||||
topAnchor = true,
|
||||
bottomAnchor = false,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = 2,
|
||||
left = 2,
|
||||
right = -2,
|
||||
height = GenericTitleBarDims.TitleBarHeight,
|
||||
material = RegisterMaterial("white"),
|
||||
alpha = Swatches.Overlay.AlphaMore
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
local columns = {}
|
||||
table.insert(columns, SystemLinkJoinMenu.CreateRowBackground(SystemLinkJoinMenu.Colors.generic_menu_bg_color))
|
||||
table.insert(columns, SystemLinkJoinMenu.CreateColumnShade("column_shade_rect_id", false, COLUMN_1, COLUMN_2))
|
||||
table.insert(columns, SystemLinkJoinMenu.CreateColumnShade("column_shade_rect_2_id", true, COLUMN_3, -1))
|
||||
table.insert(columns, SystemLinkJoinMenu.CreateColumnText("host_header", Engine.Localize("@MENU_HOST_NAME"), true, false, COLUMN_0, COLUMN_1))
|
||||
table.insert(columns, SystemLinkJoinMenu.CreateColumnText("map_header", Engine.Localize("@MENU_MAP"), true, false, COLUMN_1, COLUMN_2))
|
||||
table.insert(columns, SystemLinkJoinMenu.CreateColumnText("players_header", Engine.Localize("@MENU_NUMPLAYERS"), true, false, COLUMN_2, COLUMN_3))
|
||||
table.insert(columns, SystemLinkJoinMenu.CreateColumnText("type_header", Engine.Localize("@MENU_TYPE1"), true, true, COLUMN_3, COLUMN_4))
|
||||
table.insert(columns, SystemLinkJoinMenu.CreateColumnText("ping_header", Engine.Localize("@MENU_PING"), true, true, COLUMN_4, COLUMN_5))
|
||||
table.insert(columns, SystemLinkJoinMenu.CreateColumnImage("protected_header", "icon_lock", true, true, COLUMN_5, 1))
|
||||
header.children = columns
|
||||
return header
|
||||
end
|
||||
|
||||
SystemLinkJoinMenu.CreateRowDef = function(f6_arg0, f6_arg1, f6_arg2, f6_arg3)
|
||||
local option = {
|
||||
type = "UIButton",
|
||||
id = "row_" .. f6_arg1,
|
||||
disabled = f6_arg2,
|
||||
focusable = not f6_arg2,
|
||||
properties = {
|
||||
button_height = GenericButtonDims.button_height
|
||||
},
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = true,
|
||||
bottomAnchor = false,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = 0,
|
||||
bottom = MBh.Property("button_height"),
|
||||
left = 0,
|
||||
right = 0
|
||||
}
|
||||
},
|
||||
handlers = {
|
||||
button_action = MBh.EmitEventToRoot({
|
||||
name = "select_game",
|
||||
idx = f6_arg1
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
local columns = {}
|
||||
table.insert(columns, SystemLinkJoinMenu.CreateRowBackground(f6_arg3))
|
||||
table.insert(columns, SystemLinkJoinMenu.CreateColumnShade("column_shade_rect_id", false, COLUMN_1, COLUMN_2))
|
||||
local shade = SystemLinkJoinMenu.CreateColumnShade("column_shade_rect_2_id", true, COLUMN_3, -1)
|
||||
table.insert(columns, shade)
|
||||
local hostname = SystemLinkJoinMenu.CreateColumnText("host_text", Lobby.GetServerData(f6_arg0, f6_arg1, SystemLinkJoinMenu.GameDataColumn.Host), true, false, COLUMN_0, COLUMN_1)
|
||||
table.insert(columns, hostname)
|
||||
local mapname = SystemLinkJoinMenu.CreateColumnText("map_text", Lobby.GetServerData(f6_arg0, f6_arg1, SystemLinkJoinMenu.GameDataColumn.Map), true, false, COLUMN_1, COLUMN_2)
|
||||
table.insert(columns, mapname)
|
||||
local players = SystemLinkJoinMenu.CreateColumnText("players_text", Lobby.GetServerData(f6_arg0, f6_arg1, SystemLinkJoinMenu.GameDataColumn.Clients), true, false, COLUMN_2, COLUMN_3)
|
||||
table.insert(columns, players)
|
||||
local gametype = SystemLinkJoinMenu.CreateColumnText("type_text", Lobby.GetServerData(f6_arg0, f6_arg1, SystemLinkJoinMenu.GameDataColumn.Game), true, true, COLUMN_3, COLUMN_4)
|
||||
table.insert(columns, gametype)
|
||||
local ping = SystemLinkJoinMenu.CreateColumnText("ping_text", Lobby.GetServerData(f6_arg0, f6_arg1, SystemLinkJoinMenu.GameDataColumn.Ping), true, true, COLUMN_4, COLUMN_5)
|
||||
table.insert(columns, ping)
|
||||
local is_private = SystemLinkJoinMenu.CreateColumnImage("protected_header", "icon_lock", true, true, COLUMN_5, Lobby.GetServerData(f6_arg0, f6_arg1, 5) == "1" and 1 or 0)
|
||||
table.insert(columns, is_private)
|
||||
option.children = columns
|
||||
return option
|
||||
end
|
||||
|
||||
SystemLinkJoinMenu.OnCreate = function(f1_arg0, f1_arg1)
|
||||
local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement(f1_arg0)
|
||||
f1_local0.serverCount = 0
|
||||
f1_arg0:processEvent(LUI.ButtonHelperText.CommonEvents.addBackButton)
|
||||
f1_arg0:processEvent({
|
||||
name = "add_button_helper_text",
|
||||
button_ref = "button_action",
|
||||
helper_text = Engine.Localize("@MENU_JOIN_GAME1"),
|
||||
side = "left",
|
||||
clickable = true
|
||||
})
|
||||
f1_arg0:processEvent({
|
||||
name = "add_button_helper_text",
|
||||
button_ref = "button_alt1",
|
||||
helper_text = Engine.Localize("@MENU_SB_TOOLTIP_BTN_REFRESH"),
|
||||
side = "left",
|
||||
clickable = true
|
||||
})
|
||||
f1_arg0:processEvent({
|
||||
name = "add_button_helper_text",
|
||||
button_ref = "button_alt2",
|
||||
helper_text = Engine.Localize("@LUA_MENU_FILTER"),
|
||||
side = "right",
|
||||
clickable = true
|
||||
})
|
||||
local f1_local1 = Lobby.BuildServerList
|
||||
local f1_local2 = f1_arg1.controller
|
||||
if not f1_local2 then
|
||||
f1_local2 = Engine.GetFirstActiveController()
|
||||
end
|
||||
f1_local1(f1_local2)
|
||||
end
|
||||
|
||||
function ServerListBackground()
|
||||
if Engine.IsAliensMode() then
|
||||
return {
|
||||
image = "frontend_aliens_art",
|
||||
fill_color = {
|
||||
r = 1,
|
||||
g = 1,
|
||||
b = 1
|
||||
},
|
||||
fill_alpha = 1
|
||||
}
|
||||
end
|
||||
|
||||
if Engine.IsCoreMode() then
|
||||
return {
|
||||
image = "white",
|
||||
fill_color = {
|
||||
r = 0.07,
|
||||
g = 0.1,
|
||||
b = 0.11
|
||||
},
|
||||
fill_alpha = 1
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function JoinGame(f2_arg0, f2_arg1)
|
||||
server = f2_arg1
|
||||
controller = server.controller
|
||||
if not f2_local1 then
|
||||
controller = Engine.GetFirstActiveController()
|
||||
end
|
||||
|
||||
local is_private = Lobby.GetServerData(controller, server.idx, 5)
|
||||
if is_private == "1" then
|
||||
LUI.FlowManager.RequestPopupMenu(server, "server_password_field", false, controller, false)
|
||||
else
|
||||
Lobby.JoinServer(controller, server.idx)
|
||||
end
|
||||
end
|
||||
|
||||
SystemLinkJoinMenu.menu_systemlink_join = function()
|
||||
if Engine.IsCoreMode() then
|
||||
Engine.SetDvarString("ui_customModeName", "mp")
|
||||
elseif Engine.IsAliensMode() then
|
||||
Engine.SetDvarString("ui_customModeName", "aliens")
|
||||
end
|
||||
|
||||
if Engine.GetDvarString("ui_mapvote_entrya_gametype") == nil
|
||||
or Engine.GetDvarString("ui_mapvote_entrya_gametype") then
|
||||
Engine.SetDvarString("ui_mapvote_entrya_gametype", "any")
|
||||
end
|
||||
|
||||
if Engine.GetDvarString("ui_mapvote_entrya_mapname") == nil
|
||||
or Engine.GetDvarString("ui_mapvote_entrya_mapname") == ""
|
||||
or (string.match(Engine.GetDvarString("ui_mapvote_entrya_mapname"), "alien") == nil and Engine.IsAliensMode())
|
||||
or (string.match(Engine.GetDvarString("ui_mapvote_entrya_mapname"), "alien") == "alien" and Engine.IsCoreMode()) then
|
||||
Engine.SetDvarString("ui_mapvote_entrya_mapname", "any")
|
||||
end
|
||||
|
||||
return {
|
||||
type = "UIElement",
|
||||
id = "menu_systemlink_join_root",
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = true,
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
left = 0,
|
||||
right = 0
|
||||
}
|
||||
},
|
||||
handlers = {
|
||||
menu_create = SystemLinkJoinMenu.OnCreate,
|
||||
select_game = JoinGame
|
||||
},
|
||||
children = {
|
||||
{
|
||||
type = "UIImage",
|
||||
states = {
|
||||
default = CoD.ColorizeState(Swatches.Overlay.Color, {
|
||||
topAnchor = true,
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
left = 0,
|
||||
right = 0,
|
||||
material = RegisterMaterial("white"),
|
||||
alpha = Swatches.Overlay.AlphaMore,
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "UIElement",
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = false,
|
||||
bottomAnchor = false,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
left = 200,
|
||||
right = -200,
|
||||
height = 550
|
||||
}
|
||||
},
|
||||
children = {
|
||||
{
|
||||
type = "generic_drop_shadow",
|
||||
properties = {
|
||||
offset_shadow = 0
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "generic_menu_titlebar",
|
||||
id = "menu_systemlink_join_title_id",
|
||||
properties = {
|
||||
fill_alpha = 1,
|
||||
font = CoD.TextSettings.BoldFont,
|
||||
title_bar_text = Engine.Localize("@PLATFORM_SYSTEM_LINK_TITLE"),
|
||||
title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth,
|
||||
title_bar_alignment = LUI.Alignment.Left
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "generic_menu_background",
|
||||
id = "menu_systemlink_join_bg_id",
|
||||
properties = {
|
||||
fill_alpha = Swatches.Overlay.AlphaMore,
|
||||
},
|
||||
children = {
|
||||
SystemLinkJoinMenu.CreateHeaderDef(),
|
||||
{
|
||||
type = "UIVerticalList",
|
||||
id = "menu_systemlink_join_game_list_id",
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = true,
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = GenericTitleBarDims.TitleBarHeight + 4,
|
||||
bottom = 600,
|
||||
left = 2,
|
||||
right = -2
|
||||
}
|
||||
},
|
||||
childrenFeeder = SystemLinkJoinMenu.LinkGamesFeeder,
|
||||
handlers = {
|
||||
update_game_list = SystemLinkJoinMenu.UpdateGameList,
|
||||
menu_create = function(f12_arg0, f12_arg1)
|
||||
local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement(f12_arg0)
|
||||
f12_local0.serverList = f12_arg0
|
||||
SystemLinkJoinMenu.RefreshServers(f12_arg0, f12_arg1)
|
||||
end
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "button_helper_text_main",
|
||||
id = "online_vault_helper_text_id",
|
||||
properties = {
|
||||
left_inset = 10,
|
||||
right_inset = -10,
|
||||
top_margin = GenericFooterDims.TopMargin_WithoutBackground,
|
||||
height = 42,
|
||||
spacing = 12,
|
||||
background_alpha = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "UITimer",
|
||||
id = "menu_systemlink_join_update_timer",
|
||||
properties = {
|
||||
event = "update_game_list",
|
||||
interval = 250,
|
||||
disposable = false,
|
||||
broadcastToRoot = true
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "UIBindButton",
|
||||
id = "menu_systemlink_join_bind_button_id",
|
||||
handlers = {
|
||||
button_secondary = MBh.LeaveMenu(),
|
||||
button_alt1 = SystemLinkJoinMenu.RefreshServers,
|
||||
button_alt2 = OpenFiltersMenu
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
LUI.MenuBuilder.m_definitions["menu_systemlink_join"] = function()
|
||||
local menu = SystemLinkJoinMenu.menu_systemlink_join()
|
||||
|
||||
local rows = menu.children[2].children[3].children
|
||||
local header = rows[1]
|
||||
|
||||
|
||||
-- Increase server list width
|
||||
menu.children[2].states.default.left = 100
|
||||
menu.children[2].states.default.right = -100
|
||||
|
||||
menu.children[3].properties.interval = 10 -- 250
|
||||
|
||||
return menu
|
||||
end
|
||||
|
||||
ServerPasswordListFeeder = function()
|
||||
return {
|
||||
{
|
||||
type = "UIVerticalList",
|
||||
id = "password_field_items",
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = true,
|
||||
leftAnchor = true,
|
||||
bottomAnchor = false,
|
||||
rightAnchor = true,
|
||||
}
|
||||
},
|
||||
children = {
|
||||
{
|
||||
type = "UIGenericButton",
|
||||
id = "password_button_id",
|
||||
properties = {
|
||||
variant = GenericButtonSettings.Variants.Plain,
|
||||
button_text = Engine.Localize("PATCH_MENU_CHANGE_PASSWORD_CAPS"),
|
||||
button_display_func = function()
|
||||
local f31_local0 = Engine.GetDvarString("password")
|
||||
if f31_local0 then
|
||||
f31_local0 = Engine.GetDvarString("password") ~= ""
|
||||
end
|
||||
local f31_local1
|
||||
if f31_local0 then
|
||||
f31_local1 = Engine.Localize("PATCH_MENU_PASSWORD_SET")
|
||||
if not f31_local1 then
|
||||
|
||||
else
|
||||
return f31_local1
|
||||
end
|
||||
end
|
||||
f31_local1 = Engine.Localize("MENU_NONE")
|
||||
end,
|
||||
button_action_func = function(f32_arg0, f32_arg1)
|
||||
Engine.ExecNow("setfromdvar ui_password password")
|
||||
Engine.OpenScreenKeyboard(f32_arg1.controller, Engine.Localize("MENU_PASSWORD"), Engine.GetDvarString("ui_password") or "", Lobby.PasswordLength, false, false, CoD.KeyboardInputTypes.Password)
|
||||
end
|
||||
},
|
||||
handlers = {
|
||||
text_input_complete = function(f33_arg0, f33_arg1)
|
||||
if f33_arg1.text then
|
||||
Engine.SetDvarString("password", f33_arg1.text)
|
||||
f33_arg0:processEvent({
|
||||
name = "content_refresh"
|
||||
})
|
||||
end
|
||||
end
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "UIGenericButton",
|
||||
id = "connect_button_id",
|
||||
properties = {
|
||||
variant = GenericButtonSettings.Variants.Plain,
|
||||
button_text = Engine.Localize("MENU_JOIN_GAME"), button_action_func = function()
|
||||
Lobby.JoinServer(controller, server.idx)
|
||||
end
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
password_field = function(f50_arg0, f50_arg1)
|
||||
return {
|
||||
type = "UIElement",
|
||||
id = "server_popup_container_id",
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = true,
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
left = 0,
|
||||
right = 0
|
||||
}
|
||||
},
|
||||
children = {
|
||||
{
|
||||
type = "UIImage",
|
||||
id = "darken_bg",
|
||||
states = {
|
||||
default = CoD.ColorizeState(Swatches.Overlay.Color, {
|
||||
topAnchor = true,
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
material = RegisterMaterial("white"),
|
||||
alpha = Swatches.Overlay.AlphaMore
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "UIElement",
|
||||
id = "mp_server_filters_popup_id",
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = false,
|
||||
bottomAnchor = false,
|
||||
leftAnchor = false,
|
||||
rightAnchor = false,
|
||||
top = -1 * Leaderboards.Layout.FilterHeight * 0.6,
|
||||
width = Leaderboards.Layout.FilterWidth,
|
||||
height = 145
|
||||
}
|
||||
},
|
||||
children = {
|
||||
{
|
||||
type = "generic_drop_shadow",
|
||||
properties = {
|
||||
offset_shadow = 0
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "generic_menu_titlebar",
|
||||
id = "server_filters_popup_title_bar_id",
|
||||
properties = {
|
||||
title_bar_text = Engine.Localize("@LUA_MENU_LOBBY_JOINING"),
|
||||
fill_alpha = 1
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "generic_menu_background",
|
||||
id = "server_filters_popup_background",
|
||||
properties = {
|
||||
fill_alpha = 1
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "UIElement",
|
||||
id = "mp_server_password_popup_page_id",
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = true,
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = AAR.Layout.TitleBarHeight + 1,
|
||||
bottom = -1,
|
||||
left = 1,
|
||||
right = -1,
|
||||
}
|
||||
},
|
||||
children = {
|
||||
{
|
||||
type = "generic_border",
|
||||
properties = {
|
||||
thickness = 2,
|
||||
border_red = Colors.generic_menu_frame_color.r,
|
||||
border_green = Colors.generic_menu_frame_color.g,
|
||||
border_blue = Colors.generic_menu_frame_color.b
|
||||
},
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = true,
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
left = 0,
|
||||
right = 0,
|
||||
alpha = 0.6
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "UIVerticalList",
|
||||
id = "server_filters_popup_vlist",
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = false,
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = -90,
|
||||
bottom = 0,
|
||||
left = 0,
|
||||
right = 0,
|
||||
spacing = 5
|
||||
}
|
||||
},
|
||||
childrenFeeder = ServerPasswordListFeeder
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "UIBindButton",
|
||||
id = "filters_popup_back_button",
|
||||
handlers = {
|
||||
button_secondary = MBh.DoMultiple({
|
||||
MBh.LeaveMenu(),
|
||||
FiltersPopupClose,
|
||||
ForceRefreshServers
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
LUI.MenuBuilder.registerDef("server_password_field", password_field)
|
167
ui_scripts/stats/__init__.lua
Normal file
167
ui_scripts/stats/__init__.lua
Normal file
@ -0,0 +1,167 @@
|
||||
if (game:issingleplayer() or not Engine.InFrontend()) then
|
||||
return
|
||||
end
|
||||
|
||||
game:addlocalizedstring("LUA_MENU_UNLOCKALL", "UNLOCK ALL")
|
||||
game:addlocalizedstring("LUA_MENU_UNLOCKALL_DESC",
|
||||
"Whether all items should be unlocked.")
|
||||
|
||||
function UnlockAllAction( f1_arg0, f1_arg1 )
|
||||
Engine.Exec("unlockstats")
|
||||
end
|
||||
|
||||
function StatsButtonHelper( f2_arg0, f2_arg1 )
|
||||
f2_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
|
||||
end
|
||||
|
||||
function BarrackPrestigeResetStatsAction( f3_arg0, f3_arg1 )
|
||||
LUI.FlowManager.RequestAddMenu( f3_arg0, "prestige_reset", true, f3_arg1.controller )
|
||||
end
|
||||
|
||||
function menu_stats()
|
||||
return {
|
||||
type = "UIElement",
|
||||
id = "menu_stats_root",
|
||||
states = {
|
||||
default = {
|
||||
topAnchor = true,
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
left = 0,
|
||||
right = 0
|
||||
}
|
||||
},
|
||||
handlers = {
|
||||
menu_create = StatsButtonHelper,
|
||||
},
|
||||
children = {
|
||||
{
|
||||
type = "generic_menu_title",
|
||||
id = "stats_title_text_id",
|
||||
properties = {
|
||||
menu_title = Engine.Localize( "@LUA_MENU_BARRACKS_CAPS" )
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "UIVerticalList",
|
||||
id = "stats_options_vlist_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 = StatsOptionsFeeder
|
||||
},
|
||||
{
|
||||
type = "button_helper_text_main",
|
||||
id = "stats_button_helper_text_id"
|
||||
},
|
||||
{
|
||||
type = "UIBindButton",
|
||||
id = "stats_bind_buttons_id",
|
||||
handlers = {
|
||||
button_secondary = MBh.LeaveMenu()
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function StatsOptionsFeeder( f8_arg0 )
|
||||
local f8_local4 = {}
|
||||
local f8_local0 = Engine.IsAliensMode()
|
||||
local f8_local2 = Engine.InLobby()
|
||||
local f8_local3 = f8_arg0.exclusiveController
|
||||
f8_local4[#f8_local4 + 1] = {
|
||||
type = "UIGenericButton",
|
||||
id = "unlockall_items_button_id",
|
||||
properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_UNLOCKALL" ),
|
||||
button_action_func = UnlockAllAction,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_UNLOCKALL_DESC" )
|
||||
}
|
||||
}
|
||||
if not f8_local2 then
|
||||
local f8_local5 = #f8_local4 + 1
|
||||
local f8_local6 = {
|
||||
type = "UIGenericButton",
|
||||
id = "reset_stats_button_id"
|
||||
}
|
||||
local f8_local7
|
||||
if Cac.GetPrestigeLevel( f8_local3, Cac.GetSquadLoc() ) == 10 then
|
||||
f8_local7 = Engine.IsUserAGuest( f8_local3 )
|
||||
else
|
||||
f8_local7 = true
|
||||
end
|
||||
f8_local6.disabled = f8_local7
|
||||
f8_local6.properties = {
|
||||
button_text = Engine.Localize( "@LUA_MENU_MP_RESET_STATS_CAPS" ),
|
||||
button_action_func = BarrackPrestigeResetStatsAction,
|
||||
desc_text = Engine.Localize( "@LUA_MENU_MP_RESET_STATS_DESC" )
|
||||
}
|
||||
f8_local6.handlers = {
|
||||
element_refresh = function ( f12_arg0, f12_arg1 )
|
||||
local f12_local0
|
||||
if Cac.GetPrestigeLevel( f8_local3, Cac.GetSquadLoc() ) == 10 then
|
||||
f12_local0 = Engine.IsUserAGuest( f8_local3 )
|
||||
else
|
||||
f12_local0 = true
|
||||
end
|
||||
local f12_local1 = f12_arg0
|
||||
local f12_local2 = f12_arg0.processEvent
|
||||
local f12_local3 = {}
|
||||
local f12_local4
|
||||
if f12_local0 then
|
||||
f12_local4 = "disable"
|
||||
if not f12_local4 then
|
||||
|
||||
else
|
||||
f12_local3.name = f12_local4
|
||||
f12_local2( f12_local1, f12_local3 )
|
||||
end
|
||||
end
|
||||
f12_local4 = "enable"
|
||||
end
|
||||
}
|
||||
f8_local4[f8_local5] = f8_local6
|
||||
end
|
||||
f8_local4[#f8_local4 + 1] = {
|
||||
type = "button_desc_text",
|
||||
id = "stats_button_description_id"
|
||||
}
|
||||
return f8_local4
|
||||
end
|
||||
|
||||
function stats_options_vlist()
|
||||
return {
|
||||
type = "UIVerticalList",
|
||||
focusable = true,
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
LUI.MenuBuilder.registerDef( "menu_stats", menu_stats )
|
||||
LUI.MenuBuilder.registerDef( "stats_options_vlist", stats_options_vlist )
|
6
ui_scripts/string_override/__init__.lua
Normal file
6
ui_scripts/string_override/__init__.lua
Normal file
@ -0,0 +1,6 @@
|
||||
if (game:issingleplayer() or not Engine.InFrontend()) then
|
||||
return
|
||||
end
|
||||
|
||||
game:addlocalizedstring("LUA_MENU_MP_SQUADS_DLC_CATEGORY_4_CAPS", "^3SAFEGUARD - BOTS^7");
|
||||
game:addlocalizedstring("LUA_MENU_MP_SQUADS_DLC_DESC_4", "Play Safeguard alongside AI teammates.");
|
101
ui_scripts/team_select/__init__.lua
Normal file
101
ui_scripts/team_select/__init__.lua
Normal file
@ -0,0 +1,101 @@
|
||||
if (game:issingleplayer()) then
|
||||
return
|
||||
end
|
||||
|
||||
if (package.loaded["LUI.mp_hud.OptionsMenu"] == nil) then
|
||||
return
|
||||
end
|
||||
|
||||
package.loaded["LUI.mp_hud.OptionsMenu"].options_def = function()
|
||||
local f14_local0 = GameX.GetGameMode()
|
||||
local f14_local1 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f14_local0, GameTypesTable.Cols.ClassChoice ) == "1"
|
||||
|
||||
if not f14_local1 then
|
||||
f14_local1 = GameX.UsesFakeLoadout()
|
||||
end
|
||||
|
||||
local f14_local2 = LUI.mp_hud.OptionsMenu.checkTeamChoice( f14_local0 )
|
||||
local f14_local3 = GameX.IsRankedMatch()
|
||||
local f14_local4 = Engine.GetDvarBool( "splitscreen_ingame" )
|
||||
local f14_local5 = Game.GetOmnvar( "ui_team_selected" )
|
||||
local f14_local6 = Game.GetOmnvar( "ui_loadout_selected" )
|
||||
local f14_local7 = LUI.mp_hud.OptionsMenu.chooseClassCheck( f14_local3, f14_local5, f14_local2 )
|
||||
local self = LUI.UIVerticalList.new()
|
||||
self.id = "pause_selections_Id"
|
||||
|
||||
self:registerAnimationState("default", {
|
||||
topAnchor = true,
|
||||
leftAnchor = true,
|
||||
bottomAnchor = false,
|
||||
rightAnchor = false,
|
||||
top = GenericMenuDims.menu_top,
|
||||
left = GenericMenuDims.menu_left,
|
||||
bottom = GenericMenuDims.menu_bottom,
|
||||
right = GenericMenuDims.menu_right,
|
||||
alignment = LUI.Alignment.Top
|
||||
})
|
||||
|
||||
self:animateToState( "default", 0 )
|
||||
self:makeFocusable()
|
||||
|
||||
if f14_local0 ~= "aliens" and false == CoD.IsFireTeamMode() and GameX.IsSpectatingNotOnTeam() == false and f14_local1 == true and f14_local7 == true and not MLG.IsMLGSpectator() then
|
||||
LUI.MenuBuilder.BuildAddChild(self, {
|
||||
type = "UIGenericButton",
|
||||
id = "btn_MPPause_0",
|
||||
properties = {
|
||||
childNum = 1,
|
||||
button_text = Engine.Localize( "@LUA_MENU_CHOOSE_CLASS_CAPS" ),
|
||||
button_action_func = LUI.mp_hud.OptionsMenu.chooseClassButtonAction
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
if f14_local0 ~= "aliens" and false == CoD.IsFireTeamMode() and f14_local2 == true and not MLG.IsMLGSpectator() then
|
||||
LUI.MenuBuilder.BuildAddChild(self, {
|
||||
type = "UIGenericButton",
|
||||
id = "btn_MPPause_1",
|
||||
properties = {
|
||||
childNum = 2,
|
||||
button_text = Engine.Localize( "@LUA_MENU_CHANGE_TEAM_CAPS" ),
|
||||
button_action_func = LUI.mp_hud.OptionsMenu.changeTeamButtonAction
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
LUI.MenuBuilder.BuildAddChild(self, {
|
||||
type = "UIGenericButton",
|
||||
id = "btn_MPPause_2",
|
||||
disabledFunc = LUI.mp_hud.OptionsMenu.optionsLockedUpdate,
|
||||
properties = {
|
||||
childNum = 3,
|
||||
button_text = Engine.Localize( "@LUA_MENU_OPTIONS_CAPS" ),
|
||||
button_action_func = LUI.mp_hud.OptionsMenu.optionsButtonAction
|
||||
},
|
||||
handlers = {
|
||||
refresh_options_button = LUI.mp_hud.OptionsMenu.refreshOptionDisable
|
||||
}
|
||||
})
|
||||
|
||||
if GameX.IsOnlineMatch() and (not Engine.IsAliensMode() or not Game.GetOmnvar( "ui_alien_is_solo" )) and not MLG.IsMLGSpectator() then
|
||||
LUI.MenuBuilder.BuildAddChild(self, {
|
||||
type = "UIGenericButton",
|
||||
id = "btn_MPPause_3",
|
||||
properties = {
|
||||
childNum = 4,
|
||||
button_text = Engine.Localize( "@LUA_MENU_MUTE_PLAYERS_CAPS" ),
|
||||
button_action_func = LUI.mp_hud.OptionsMenu.mutePlayersButtonAction
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
LUI.MenuBuilder.BuildAddChild(self, {
|
||||
type = "UIGenericButton",
|
||||
id = "btn_MPPause_5",
|
||||
properties = {
|
||||
childNum = 6,
|
||||
button_text = Engine.Localize( "@LUA_MENU_END_GAME_CAPS" ),
|
||||
button_action_func = LUI.mp_hud.OptionsMenu.endGameButtonAction
|
||||
}
|
||||
})
|
||||
return self
|
||||
end
|
Reference in New Issue
Block a user