diff --git a/data/cdata/ui_scripts/MainMenu/CPMainMenu.lua b/data/cdata/ui_scripts/MainMenu/CPMainMenu.lua index b5821958..65b9dcc4 100644 --- a/data/cdata/ui_scripts/MainMenu/CPMainMenu.lua +++ b/data/cdata/ui_scripts/MainMenu/CPMainMenu.lua @@ -1,11 +1,11 @@ local CPMainMenu_original = MenuBuilder.m_types["CPMainMenu"] -function CPMainMenuStub( menu, controller ) - ret = CPMainMenu_original( menu, controller ) - - -- play music immediately - Engine.PlayMusic( CoD.Music.MainCPMusic ) +function CPMainMenuStub(menu, controller) + ret = CPMainMenu_original(menu, controller) - return ret + -- play music immediately + Engine.PlayMusic(CoD.Music.MainCPMusic) + + return ret end -MenuBuilder.m_types["CPMainMenu"] = CPMainMenuStub \ No newline at end of file +MenuBuilder.m_types["CPMainMenu"] = CPMainMenuStub diff --git a/data/cdata/ui_scripts/MainMenu/CPMainMenuButtons.lua b/data/cdata/ui_scripts/MainMenu/CPMainMenuButtons.lua index 537b6484..5a2a1140 100644 --- a/data/cdata/ui_scripts/MainMenu/CPMainMenuButtons.lua +++ b/data/cdata/ui_scripts/MainMenu/CPMainMenuButtons.lua @@ -1,201 +1,201 @@ -local f0_local0 = function ( f1_arg0, f1_arg1 ) - Engine.Exec( "xblive_privatematch 0" ) - utils.cp.AliensUtils.AliensRunConfig( f1_arg1.controller ) - LUI.FlowManager.RequestAddMenu( "SystemLinkMenu", false, f1_arg1.controller, false, {}, true ) +local f0_local0 = function(f1_arg0, f1_arg1) + Engine.Exec("xblive_privatematch 0") + utils.cp.AliensUtils.AliensRunConfig(f1_arg1.controller) + LUI.FlowManager.RequestAddMenu("SystemLinkMenu", false, f1_arg1.controller, false, {}, true) end -local f0_local1 = function ( f2_arg0, f2_arg1 ) - f0_local0( f2_arg0, f2_arg1 ) +local f0_local1 = function(f2_arg0, f2_arg1) + f0_local0(f2_arg0, f2_arg1) end -local f0_local2 = function ( f3_arg0, f3_arg1 ) - Engine.Exec( MPConfig.default_xboxlive, f3_arg1.controller ) - Engine.SetDvarBool( "xblive_privatematch", true ) - SetIsAliensSolo( true ) - Engine.SetDvarInt( "party_maxplayers", 1 ) - Engine.Exec( "xstartprivatematch" ) - LUI.FlowManager.RequestAddMenu( "CPPrivateMatchMenu", false, f3_arg1.controller, false, { - showPlayNowButton = true, - isPublicMatch = false - } ) +local f0_local2 = function(f3_arg0, f3_arg1) + Engine.Exec(MPConfig.default_xboxlive, f3_arg1.controller) + Engine.SetDvarBool("xblive_privatematch", true) + SetIsAliensSolo(true) + Engine.SetDvarInt("party_maxplayers", 1) + Engine.Exec("xstartprivatematch") + LUI.FlowManager.RequestAddMenu("CPPrivateMatchMenu", false, f3_arg1.controller, false, { + showPlayNowButton = true, + isPublicMatch = false + }) end -local f0_local3 = function ( f4_arg0, f4_arg1 ) - Engine.Exec( MPConfig.default_xboxlive, f4_arg1.controller ) - Engine.SetDvarBool( "xblive_privatematch", true ) - SetIsAliensSolo( false ) - Engine.Exec( "xstartprivatematch" ) - LUI.FlowManager.RequestAddMenu( "CPPrivateMatchMenu", false, f4_arg1.controller, false, { - showPlayNowButton = true, - isPublicMatch = false - } ) +local f0_local3 = function(f4_arg0, f4_arg1) + Engine.Exec(MPConfig.default_xboxlive, f4_arg1.controller) + Engine.SetDvarBool("xblive_privatematch", true) + SetIsAliensSolo(false) + Engine.Exec("xstartprivatematch") + LUI.FlowManager.RequestAddMenu("CPPrivateMatchMenu", false, f4_arg1.controller, false, { + showPlayNowButton = true, + isPublicMatch = false + }) end -local f0_local4 = function ( f5_arg0, f5_arg1, f5_arg2 ) - assert( f5_arg0.PublicMatch ) - assert( f5_arg0.SoloMatch ) - assert( f5_arg0.CustomMatch ) - local f5_local0 = LUI.DataSourceInGlobalModel.new( "frontEnd.lobby.areWeGameHost" ) - local f5_local1 = DataSources.frontEnd.lobby.memberCount - local f5_local2 = function () - return Lobby.IsInPrivateParty() and not Lobby.IsPrivatePartyHost() - end - - local f5_local3 = function () - local f7_local0 = f5_local2() - f5_arg0.PublicMatch:SetButtonDisabled( f7_local0 ) - f5_arg0.CustomMatch:SetButtonDisabled( f7_local0 ) - end - - f5_arg0:SubscribeToModel( f5_local0:GetModel( f5_arg1 ), f5_local3 ) - f5_arg0:SubscribeToModel( f5_local1:GetModel( f5_arg1 ), f5_local3 ) - f5_arg0:SubscribeToModel( DataSources.frontEnd.lobby.isSolo:GetModel( f5_arg1 ), function () - local f8_local0 = DataSources.frontEnd.lobby.isSolo:GetValue( f5_arg1 ) - if f8_local0 ~= nil then - f5_arg0.SoloMatch:SetButtonDisabled( not f8_local0 ) - end - end ) - f5_arg0.PublicMatch:addEventHandler( "button_action", f0_local1 ) - f5_arg0.SoloMatch:addEventHandler( "button_action", f0_local2 ) - f5_arg0.Loadout:addEventHandler( "button_action", function ( f9_arg0, f9_arg1 ) - LUI.FlowManager.RequestAddMenu( "CPLoadoutMenu", true, f9_arg1.controller ) - end ) - f5_arg0.Barracks:addEventHandler( "button_action", function ( f10_arg0, f10_arg1 ) - LUI.FlowManager.RequestAddMenu( "Headquarters", true, f10_arg1.controller ) - end ) - f5_arg0.Armory:addEventHandler( "button_action", function ( f11_arg0, f11_arg1 ) - if not Engine.IsUserAGuest( f11_arg1.controller ) then - ACTIONS.OpenMenu( "Armory", true, f11_arg1.controller ) - end - end ) - f5_arg0.CustomMatch:addEventHandler( "button_action", f0_local3 ) - f5_arg0.ContractsButton:addEventHandler( "button_action", function ( f12_arg0, f12_arg1 ) - ACTIONS.OpenMenu( "ContractMenu", true, f12_arg1.controller or f5_arg1 ) - end ) +local f0_local4 = function(f5_arg0, f5_arg1, f5_arg2) + assert(f5_arg0.PublicMatch) + assert(f5_arg0.SoloMatch) + assert(f5_arg0.CustomMatch) + local f5_local0 = LUI.DataSourceInGlobalModel.new("frontEnd.lobby.areWeGameHost") + local f5_local1 = DataSources.frontEnd.lobby.memberCount + local f5_local2 = function() + return Lobby.IsInPrivateParty() and not Lobby.IsPrivatePartyHost() + end - f5_arg0.ModsButton:addEventHandler( "button_action", function ( arg0, arg1 ) - LUI.FlowManager.RequestAddMenu( "ModSelectMenu", true, arg1.controller, false ) - end ) + local f5_local3 = function() + local f7_local0 = f5_local2() + f5_arg0.PublicMatch:SetButtonDisabled(f7_local0) + f5_arg0.CustomMatch:SetButtonDisabled(f7_local0) + end + + f5_arg0:SubscribeToModel(f5_local0:GetModel(f5_arg1), f5_local3) + f5_arg0:SubscribeToModel(f5_local1:GetModel(f5_arg1), f5_local3) + f5_arg0:SubscribeToModel(DataSources.frontEnd.lobby.isSolo:GetModel(f5_arg1), function() + local f8_local0 = DataSources.frontEnd.lobby.isSolo:GetValue(f5_arg1) + if f8_local0 ~= nil then + f5_arg0.SoloMatch:SetButtonDisabled(not f8_local0) + end + end) + f5_arg0.PublicMatch:addEventHandler("button_action", f0_local1) + f5_arg0.SoloMatch:addEventHandler("button_action", f0_local2) + f5_arg0.Loadout:addEventHandler("button_action", function(f9_arg0, f9_arg1) + LUI.FlowManager.RequestAddMenu("CPLoadoutMenu", true, f9_arg1.controller) + end) + f5_arg0.Barracks:addEventHandler("button_action", function(f10_arg0, f10_arg1) + LUI.FlowManager.RequestAddMenu("Headquarters", true, f10_arg1.controller) + end) + f5_arg0.Armory:addEventHandler("button_action", function(f11_arg0, f11_arg1) + if not Engine.IsUserAGuest(f11_arg1.controller) then + ACTIONS.OpenMenu("Armory", true, f11_arg1.controller) + end + end) + f5_arg0.CustomMatch:addEventHandler("button_action", f0_local3) + f5_arg0.ContractsButton:addEventHandler("button_action", function(f12_arg0, f12_arg1) + ACTIONS.OpenMenu("ContractMenu", true, f12_arg1.controller or f5_arg1) + end) + + f5_arg0.ModsButton:addEventHandler("button_action", function(arg0, arg1) + LUI.FlowManager.RequestAddMenu("ModSelectMenu", true, arg1.controller, false) + end) end -function CPMainMenuButtons( menu, controller ) - local VNavigator = LUI.UIVerticalNavigator.new() - VNavigator:SetAnchorsAndPosition( 0, 1, 0, 1, 0, 500 * _1080p, 0, 400 * _1080p ) - VNavigator.id = "CPMainMenuButtons" - local f14_local1 = controller and controller.controllerIndex - if not f14_local1 and not Engine.InFrontend() then - f14_local1 = VNavigator:getRootController() - end - assert( f14_local1 ) - local f14_local2 = VNavigator - local ButtonDescription = nil - - ButtonDescription = MenuBuilder.BuildRegisteredType( "ButtonDescriptionText", { - controllerIndex = f14_local1 - } ) - ButtonDescription.id = "ButtonDescription" - ButtonDescription:SetRGBFromTable( SWATCHES.genericButton.textDisabled, 0 ) - ButtonDescription.Description:SetRight( _1080p * 415, 0 ) - ButtonDescription:SetAnchorsAndPosition( 0, 0, 0, 1, 0, 0, _1080p * 336, _1080p * 394 ) - VNavigator:addElement( ButtonDescription ) - VNavigator.ButtonDescription = ButtonDescription - - local PublicMatch = nil - - PublicMatch = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f14_local1 - } ) - PublicMatch.id = "PublicMatch" - PublicMatch.buttonDescription = "Browse for Custom Servers" - PublicMatch.Text:setText( ToUpperCase( "Server Browser" ), 0 ) - PublicMatch:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 340, 0, _1080p * 30 ) - VNavigator:addElement( PublicMatch ) - VNavigator.PublicMatch = PublicMatch - - local SoloMatch = nil - - SoloMatch = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f14_local1 - } ) - SoloMatch.id = "SoloMatch" - SoloMatch.buttonDescription = Engine.Localize( "LUA_MENU_ZM_SOLO_MATCH_DESC" ) - SoloMatch.Text:setText( ToUpperCase( Engine.Localize( "LUA_MENU_SOLO_MATCH_CAPS" ) ), 0 ) - SoloMatch:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 340, _1080p * 40, _1080p * 70 ) - VNavigator:addElement( SoloMatch ) - VNavigator.SoloMatch = SoloMatch - - local CustomMatch = nil - - CustomMatch = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f14_local1 - } ) - CustomMatch.id = "CustomMatch" - CustomMatch.buttonDescription = Engine.Localize( "LUA_MENU_ZM_CUSTOM_MATCH_DESC" ) - CustomMatch.Text:setText( ToUpperCase( Engine.Localize( "LUA_MENU_CUSTOM_GAME_CAPS" ) ), 0 ) - CustomMatch:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 340, _1080p * 80, _1080p * 110 ) - VNavigator:addElement( CustomMatch ) - VNavigator.CustomMatch = CustomMatch - - local Loadout = nil - - Loadout = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f14_local1 - } ) - Loadout.id = "Loadout" - Loadout.buttonDescription = Engine.Localize( "LUA_MENU_ZM_LOADOUT_DESC" ) - Loadout.Text:setText( Engine.Localize( "LUA_MENU_ZM_LOADOUT_CAPS" ), 0 ) - Loadout:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 340, _1080p * 120, _1080p * 150 ) - VNavigator:addElement( Loadout ) - VNavigator.Loadout = Loadout - - local Barracks = nil - - Barracks = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f14_local1 - } ) - Barracks.id = "Barracks" - Barracks.buttonDescription = Engine.Localize( "LUA_MENU_ZM_BARRACKS_DESC" ) - Barracks.Text:setText( ToUpperCase( Engine.Localize( "LUA_MENU_ZM_BARRACKS_CAPS" ) ), 0 ) - Barracks:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 340, _1080p * 160, _1080p * 190 ) - VNavigator:addElement( Barracks ) - VNavigator.Barracks = Barracks - - local Armory = nil - - Armory = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f14_local1 - } ) - Armory.id = "Armory" - Armory.buttonDescription = Engine.Localize( "LUA_MENU_ZM_SURVIVAL_DEPOT_DESC" ) - Armory.Text:setText( ToUpperCase( Engine.Localize( "LUA_MENU_ZM_SURVIVAL_DEPOT" ) ), 0 ) - Armory:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 340, _1080p * 200, _1080p * 230 ) - VNavigator:addElement( Armory ) - VNavigator.Armory = Armory +function CPMainMenuButtons(menu, controller) + local VNavigator = LUI.UIVerticalNavigator.new() + VNavigator:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 400 * _1080p) + VNavigator.id = "CPMainMenuButtons" + local f14_local1 = controller and controller.controllerIndex + if not f14_local1 and not Engine.InFrontend() then + f14_local1 = VNavigator:getRootController() + end + assert(f14_local1) + local f14_local2 = VNavigator + local ButtonDescription = nil - local ModsButton = nil - - ModsButton = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f14_local1 - } ) - ModsButton.id = "ModsButton" - ModsButton.buttonDescription = Engine.Localize( "LUA_MENU_MODS_DESC" ) - ModsButton.Text:setText( ToUpperCase( Engine.Localize( "LUA_MENU_MODS_CAPS" ) ), 0 ) - ModsButton:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 340, _1080p * 240, _1080p * 270 ) - VNavigator:addElement( ModsButton ) - VNavigator.ModsButton = ModsButton - - local ContractsButton = nil - - ContractsButton = MenuBuilder.BuildRegisteredType( "ContractsButtonCP", { - controllerIndex = f14_local1 - } ) - ContractsButton.id = "ContractsButton" - ContractsButton:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 340, _1080p * 280, _1080p * 340 ) - VNavigator:addElement( ContractsButton ) - VNavigator.ContractsButton = ContractsButton + ButtonDescription = MenuBuilder.BuildRegisteredType("ButtonDescriptionText", { + controllerIndex = f14_local1 + }) + ButtonDescription.id = "ButtonDescription" + ButtonDescription:SetRGBFromTable(SWATCHES.genericButton.textDisabled, 0) + ButtonDescription.Description:SetRight(_1080p * 415, 0) + ButtonDescription:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 336, _1080p * 394) + VNavigator:addElement(ButtonDescription) + VNavigator.ButtonDescription = ButtonDescription - f0_local4( VNavigator, f14_local1, controller ) - return VNavigator + local PublicMatch = nil + + PublicMatch = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f14_local1 + }) + PublicMatch.id = "PublicMatch" + PublicMatch.buttonDescription = "Browse for Custom Servers" + PublicMatch.Text:setText(ToUpperCase("Server Browser"), 0) + PublicMatch:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, 0, _1080p * 30) + VNavigator:addElement(PublicMatch) + VNavigator.PublicMatch = PublicMatch + + local SoloMatch = nil + + SoloMatch = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f14_local1 + }) + SoloMatch.id = "SoloMatch" + SoloMatch.buttonDescription = Engine.Localize("LUA_MENU_ZM_SOLO_MATCH_DESC") + SoloMatch.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_SOLO_MATCH_CAPS")), 0) + SoloMatch:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 40, _1080p * 70) + VNavigator:addElement(SoloMatch) + VNavigator.SoloMatch = SoloMatch + + local CustomMatch = nil + + CustomMatch = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f14_local1 + }) + CustomMatch.id = "CustomMatch" + CustomMatch.buttonDescription = Engine.Localize("LUA_MENU_ZM_CUSTOM_MATCH_DESC") + CustomMatch.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_CUSTOM_GAME_CAPS")), 0) + CustomMatch:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 80, _1080p * 110) + VNavigator:addElement(CustomMatch) + VNavigator.CustomMatch = CustomMatch + + local Loadout = nil + + Loadout = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f14_local1 + }) + Loadout.id = "Loadout" + Loadout.buttonDescription = Engine.Localize("LUA_MENU_ZM_LOADOUT_DESC") + Loadout.Text:setText(Engine.Localize("LUA_MENU_ZM_LOADOUT_CAPS"), 0) + Loadout:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 120, _1080p * 150) + VNavigator:addElement(Loadout) + VNavigator.Loadout = Loadout + + local Barracks = nil + + Barracks = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f14_local1 + }) + Barracks.id = "Barracks" + Barracks.buttonDescription = Engine.Localize("LUA_MENU_ZM_BARRACKS_DESC") + Barracks.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_ZM_BARRACKS_CAPS")), 0) + Barracks:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 160, _1080p * 190) + VNavigator:addElement(Barracks) + VNavigator.Barracks = Barracks + + local Armory = nil + + Armory = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f14_local1 + }) + Armory.id = "Armory" + Armory.buttonDescription = Engine.Localize("LUA_MENU_ZM_SURVIVAL_DEPOT_DESC") + Armory.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_ZM_SURVIVAL_DEPOT")), 0) + Armory:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 200, _1080p * 230) + VNavigator:addElement(Armory) + VNavigator.Armory = Armory + + local ModsButton = nil + + ModsButton = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f14_local1 + }) + ModsButton.id = "ModsButton" + ModsButton.buttonDescription = Engine.Localize("LUA_MENU_MODS_DESC") + ModsButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_MODS_CAPS")), 0) + ModsButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 240, _1080p * 270) + VNavigator:addElement(ModsButton) + VNavigator.ModsButton = ModsButton + + local ContractsButton = nil + + ContractsButton = MenuBuilder.BuildRegisteredType("ContractsButtonCP", { + controllerIndex = f14_local1 + }) + ContractsButton.id = "ContractsButton" + ContractsButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 280, _1080p * 340) + VNavigator:addElement(ContractsButton) + VNavigator.ContractsButton = ContractsButton + + f0_local4(VNavigator, f14_local1, controller) + return VNavigator end -MenuBuilder.m_types["CPMainMenuButtons"] = CPMainMenuButtons \ No newline at end of file +MenuBuilder.m_types["CPMainMenuButtons"] = CPMainMenuButtons diff --git a/data/cdata/ui_scripts/MainMenu/CampaignMenuButtons.lua b/data/cdata/ui_scripts/MainMenu/CampaignMenuButtons.lua index 4179af6b..c8100ccd 100644 --- a/data/cdata/ui_scripts/MainMenu/CampaignMenuButtons.lua +++ b/data/cdata/ui_scripts/MainMenu/CampaignMenuButtons.lua @@ -1,178 +1,178 @@ -local f0_local1 = function ( f2_arg0 ) - f2_arg0.ResumeButton:SetButtonDisabled( not Engine.CanResumeGame( f2_arg0._controllerIndex ) ) - if not CONDITIONS.IsTrialLicense( f2_arg0 ) then - local f2_local0 = f2_arg0.MissionSelectButton - local f2_local1 = f2_local0 - f2_local0 = f2_local0.SetButtonDisabled - local f2_local2 = Engine.IsTrialLicense() - if not f2_local2 then - if not Engine.IsDevelopmentBuild() and not Engine.GetDvarBool( "mis_cheat" ) then - f2_local2 = not f0_local0( f2_arg0._controllerIndex ) - else - f2_local2 = false - end - end - f2_local0( f2_local1, f2_local2 ) - end +local f0_local1 = function(f2_arg0) + f2_arg0.ResumeButton:SetButtonDisabled(not Engine.CanResumeGame(f2_arg0._controllerIndex)) + if not CONDITIONS.IsTrialLicense(f2_arg0) then + local f2_local0 = f2_arg0.MissionSelectButton + local f2_local1 = f2_local0 + f2_local0 = f2_local0.SetButtonDisabled + local f2_local2 = Engine.IsTrialLicense() + if not f2_local2 then + if not Engine.IsDevelopmentBuild() and not Engine.GetDvarBool("mis_cheat") then + f2_local2 = not f0_local0(f2_arg0._controllerIndex) + else + f2_local2 = false + end + end + f2_local0(f2_local1, f2_local2) + end end -local f0_local2 = function ( f3_arg0, f3_arg1 ) - LUI.FlowManager.RequestPopupMenu( nil, "FakeLoadingScreenOverlay", true, 0, false, { - onLoadCompleteFunc = function () - Engine.SetDvarString( "ui_char_museum_mode", "credits_1" ) - Engine.Exec( "profile_difficultyLoad" ) - Engine.Exec( "profile_specialistModeLoad" ) - Engine.Exec( "profile_yoloModeLoad" ) - Engine.Exec( "loadgame_continue" ) - Engine.Exec( "updategamerprofile" ) - end - } ) - LUI.FlowManager.RequestLeaveMenu( f3_arg0 ) +local f0_local2 = function(f3_arg0, f3_arg1) + LUI.FlowManager.RequestPopupMenu(nil, "FakeLoadingScreenOverlay", true, 0, false, { + onLoadCompleteFunc = function() + Engine.SetDvarString("ui_char_museum_mode", "credits_1") + Engine.Exec("profile_difficultyLoad") + Engine.Exec("profile_specialistModeLoad") + Engine.Exec("profile_yoloModeLoad") + Engine.Exec("loadgame_continue") + Engine.Exec("updategamerprofile") + end + }) + LUI.FlowManager.RequestLeaveMenu(f3_arg0) end -local f0_local3 = function ( f5_arg0, f5_arg1 ) - LUI.FlowManager.RequestPopupMenu( nil, "FakeLoadingScreenOverlay", true, 0, false, { - onLoadCompleteFunc = function () - Engine.Exec( "set ui_play_credits 1; map shipcrib_epilogue" ) - end - } ) +local f0_local3 = function(f5_arg0, f5_arg1) + LUI.FlowManager.RequestPopupMenu(nil, "FakeLoadingScreenOverlay", true, 0, false, { + onLoadCompleteFunc = function() + Engine.Exec("set ui_play_credits 1; map shipcrib_epilogue") + end + }) end ---MenuBuilder.registerType( "ResumeGamePopup", function ( f7_arg0, f7_arg1 ) +-- MenuBuilder.registerType( "ResumeGamePopup", function ( f7_arg0, f7_arg1 ) -- return MenuBuilder.BuildRegisteredType( "PopupYesNo", { -- message = Engine.Localize( "@MENU_RESUMEGAME_Q" ), -- yesAction = f0_local2 -- } ) ---end ) -local f0_local4 = function ( f8_arg0, f8_arg1, f8_arg2 ) - assert( f8_arg0.ResumeButton ) - assert( f8_arg0.NewButton ) - assert( f8_arg0.CreditsButton ) - if not CONDITIONS.IsTrialLicense( f8_arg0 ) then - assert( f8_arg0.MissionSelectButton ) - end - f8_arg0._controllerIndex = f8_arg1 - f8_arg0.ResumeButton:addEventHandler( "button_action", function ( f9_arg0, f9_arg1 ) - Engine.SetDvarString( "start", "" ) - LUI.FlowManager.RequestPopupMenu( f9_arg0, "ResumeGamePopup", false, f9_arg1.controller, false ) - end ) - f8_arg0.NewButton:addEventHandler( "button_action", function ( f10_arg0, f10_arg1 ) - Engine.SetDvarString( "start", "" ) - if Engine.CanResumeGame( f8_arg1 ) then - LUI.FlowManager.RequestPopupMenu( f8_arg0, "overwrite_warning_menu", true, f10_arg1.controller ) - else - LUI.FlowManager.RequestPopupMenu( f8_arg0, "popmenu_autosave_warning", true, f10_arg1.controller ) - end - end ) - if not CONDITIONS.IsTrialLicense( f8_arg0 ) then - f8_arg0.MissionSelectButton:addEventHandler( "button_action", function ( f11_arg0, f11_arg1 ) - Engine.SetDvarString( "start", "" ) - LUI.FlowManager.RequestAddMenu( "LevelSelectMenu", true, f11_arg1.controller, false ) - end ) - end - f8_arg0.CreditsButton:addEventHandler( "button_action", f0_local3 ) - f0_local1( f8_arg0 ) - f8_arg0:addEventHandler( "update_save_game_available_complete", f0_local1 ) - if Engine.GetDvarFloat( "r_filmGrainAtten" ) == 0.25 then - Engine.SetDvarFloat( "r_filmGrainAtten", 1 ) - Engine.ExecNow( "profile_setFilmGrain " .. tostring( 1 ), f8_arg1 ) - end +-- end ) +local f0_local4 = function(f8_arg0, f8_arg1, f8_arg2) + assert(f8_arg0.ResumeButton) + assert(f8_arg0.NewButton) + assert(f8_arg0.CreditsButton) + if not CONDITIONS.IsTrialLicense(f8_arg0) then + assert(f8_arg0.MissionSelectButton) + end + f8_arg0._controllerIndex = f8_arg1 + f8_arg0.ResumeButton:addEventHandler("button_action", function(f9_arg0, f9_arg1) + Engine.SetDvarString("start", "") + LUI.FlowManager.RequestPopupMenu(f9_arg0, "ResumeGamePopup", false, f9_arg1.controller, false) + end) + f8_arg0.NewButton:addEventHandler("button_action", function(f10_arg0, f10_arg1) + Engine.SetDvarString("start", "") + if Engine.CanResumeGame(f8_arg1) then + LUI.FlowManager.RequestPopupMenu(f8_arg0, "overwrite_warning_menu", true, f10_arg1.controller) + else + LUI.FlowManager.RequestPopupMenu(f8_arg0, "popmenu_autosave_warning", true, f10_arg1.controller) + end + end) + if not CONDITIONS.IsTrialLicense(f8_arg0) then + f8_arg0.MissionSelectButton:addEventHandler("button_action", function(f11_arg0, f11_arg1) + Engine.SetDvarString("start", "") + LUI.FlowManager.RequestAddMenu("LevelSelectMenu", true, f11_arg1.controller, false) + end) + end + f8_arg0.CreditsButton:addEventHandler("button_action", f0_local3) + f0_local1(f8_arg0) + f8_arg0:addEventHandler("update_save_game_available_complete", f0_local1) + if Engine.GetDvarFloat("r_filmGrainAtten") == 0.25 then + Engine.SetDvarFloat("r_filmGrainAtten", 1) + Engine.ExecNow("profile_setFilmGrain " .. tostring(1), f8_arg1) + end - f8_arg0.ModsButton:addEventHandler( "button_action", function ( arg0, arg1 ) - LUI.FlowManager.RequestAddMenu( "ModSelectMenu", true, arg1.controller, false ) - end ) + f8_arg0.ModsButton:addEventHandler("button_action", function(arg0, arg1) + LUI.FlowManager.RequestAddMenu("ModSelectMenu", true, arg1.controller, false) + end) end -function CampaignMenuButtons( menu, controller ) - local self = LUI.UIVerticalList.new() - self:SetAnchorsAndPosition( 0, 1, 0, 1, 0, 500 * _1080p, 0, 440 * _1080p ) - self.id = "CampaignMenuButtons" - local f12_local1 = controller and controller.controllerIndex - if not f12_local1 and not Engine.InFrontend() then - f12_local1 = self:getRootController() - end - assert( f12_local1 ) - local f12_local2 = self - self:SetSpacing( 10 * _1080p ) - local ResumeButton = nil - - ResumeButton = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f12_local1 - } ) - ResumeButton.id = "ResumeButton" - ResumeButton.buttonDescription = Engine.Localize( "LUA_MENU_RESUME_GAME_DESC" ) - ResumeButton.Text:setText( Engine.Localize( "MENU_RESUMEGAME_CAPS" ), 0 ) - ResumeButton:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, 0, _1080p * 30 ) - self:addElement( ResumeButton ) - self.ResumeButton = ResumeButton - - local NewButton = nil - - NewButton = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f12_local1 - } ) - NewButton.id = "NewButton" - NewButton.buttonDescription = Engine.Localize( "LUA_MENU_NEW_GAME_DESC" ) - NewButton.Text:setText( Engine.Localize( "MENU_NEWGAME_CAPS" ), 0 ) - NewButton:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, _1080p * 40, _1080p * 70 ) - self:addElement( NewButton ) - self.NewButton = NewButton - - local f12_local5 = nil - if not CONDITIONS.IsTrialLicense( self ) then - f12_local5 = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f12_local1 - } ) - f12_local5.id = "MissionSelectButton" - if not CONDITIONS.IsTrialLicense( self ) then - - else - - end - if not CONDITIONS.IsTrialLicense( self ) then - f12_local5.buttonDescription = Engine.Localize( "LUA_MENU_MISSION_SELECT_DESC" ) - end - f12_local5.Text:setText( Engine.Localize( "MENU_MISSION_SELECT_CAPS" ), 0 ) - f12_local5:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, _1080p * 80, _1080p * 110 ) - self:addElement( f12_local5 ) - self.MissionSelectButton = f12_local5 - end - local CreditsButton = nil - - CreditsButton = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f12_local1 - } ) - CreditsButton.id = "CreditsButton" - CreditsButton.buttonDescription = Engine.Localize( "LUA_MENU_CREDITS_DESC" ) - CreditsButton.Text:setText( ToUpperCase( Engine.Localize( "MENU_SP_CREDITS_CAPS" ) ), 0 ) - CreditsButton:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, _1080p * 120, _1080p * 150 ) - self:addElement( CreditsButton ) - self.CreditsButton = CreditsButton +function CampaignMenuButtons(menu, controller) + local self = LUI.UIVerticalList.new() + self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 440 * _1080p) + self.id = "CampaignMenuButtons" + local f12_local1 = controller and controller.controllerIndex + if not f12_local1 and not Engine.InFrontend() then + f12_local1 = self:getRootController() + end + assert(f12_local1) + local f12_local2 = self + self:SetSpacing(10 * _1080p) + local ResumeButton = nil + + ResumeButton = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f12_local1 + }) + ResumeButton.id = "ResumeButton" + ResumeButton.buttonDescription = Engine.Localize("LUA_MENU_RESUME_GAME_DESC") + ResumeButton.Text:setText(Engine.Localize("MENU_RESUMEGAME_CAPS"), 0) + ResumeButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, 0, _1080p * 30) + self:addElement(ResumeButton) + self.ResumeButton = ResumeButton + + local NewButton = nil + + NewButton = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f12_local1 + }) + NewButton.id = "NewButton" + NewButton.buttonDescription = Engine.Localize("LUA_MENU_NEW_GAME_DESC") + NewButton.Text:setText(Engine.Localize("MENU_NEWGAME_CAPS"), 0) + NewButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 40, _1080p * 70) + self:addElement(NewButton) + self.NewButton = NewButton + + local f12_local5 = nil + if not CONDITIONS.IsTrialLicense(self) then + f12_local5 = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f12_local1 + }) + f12_local5.id = "MissionSelectButton" + if not CONDITIONS.IsTrialLicense(self) then + + else + + end + if not CONDITIONS.IsTrialLicense(self) then + f12_local5.buttonDescription = Engine.Localize("LUA_MENU_MISSION_SELECT_DESC") + end + f12_local5.Text:setText(Engine.Localize("MENU_MISSION_SELECT_CAPS"), 0) + f12_local5:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 80, _1080p * 110) + self:addElement(f12_local5) + self.MissionSelectButton = f12_local5 + end + local CreditsButton = nil + + CreditsButton = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f12_local1 + }) + CreditsButton.id = "CreditsButton" + CreditsButton.buttonDescription = Engine.Localize("LUA_MENU_CREDITS_DESC") + CreditsButton.Text:setText(ToUpperCase(Engine.Localize("MENU_SP_CREDITS_CAPS")), 0) + CreditsButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 120, _1080p * 150) + self:addElement(CreditsButton) + self.CreditsButton = CreditsButton local ModsButton = nil - - ModsButton = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f12_local1 - } ) - ModsButton.id = "ModsButton" - ModsButton.buttonDescription = Engine.Localize( "LUA_MENU_MODS_DESC" ) - ModsButton.Text:setText( ToUpperCase( Engine.Localize( "LUA_MENU_MODS_CAPS" ) ), 0 ) - ModsButton:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, _1080p * 160, _1080p * 190 ) - self:addElement( ModsButton ) - self.ModsButton = ModsButton - - local ButtonDescription = nil - - ButtonDescription = MenuBuilder.BuildRegisteredType( "ButtonDescriptionText", { - controllerIndex = f12_local1 - } ) - ButtonDescription.id = "ButtonDescription" - ButtonDescription:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 504, _1080p * 200, _1080p * 300 ) - self:addElement( ButtonDescription ) - self.ButtonDescription = ButtonDescription - - f0_local4( self, f12_local1, controller ) - return self + + ModsButton = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f12_local1 + }) + ModsButton.id = "ModsButton" + ModsButton.buttonDescription = Engine.Localize("LUA_MENU_MODS_DESC") + ModsButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_MODS_CAPS")), 0) + ModsButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 160, _1080p * 190) + self:addElement(ModsButton) + self.ModsButton = ModsButton + + local ButtonDescription = nil + + ButtonDescription = MenuBuilder.BuildRegisteredType("ButtonDescriptionText", { + controllerIndex = f12_local1 + }) + ButtonDescription.id = "ButtonDescription" + ButtonDescription:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 504, _1080p * 200, _1080p * 300) + self:addElement(ButtonDescription) + self.ButtonDescription = ButtonDescription + + f0_local4(self, f12_local1, controller) + return self end -MenuBuilder.m_types["CampaignMenuButtons"] = CampaignMenuButtons \ No newline at end of file +MenuBuilder.m_types["CampaignMenuButtons"] = CampaignMenuButtons diff --git a/data/cdata/ui_scripts/MainMenu/MPMainMenuButtons.lua b/data/cdata/ui_scripts/MainMenu/MPMainMenuButtons.lua index a82deaf4..180477d9 100644 --- a/data/cdata/ui_scripts/MainMenu/MPMainMenuButtons.lua +++ b/data/cdata/ui_scripts/MainMenu/MPMainMenuButtons.lua @@ -1,206 +1,208 @@ local buttonSpacing = 40 local f0_local1 = 10 -local f0_local2 = function ( f1_arg0, f1_arg1, f1_arg2 ) - if 0 < f1_arg2 then - local f1_local0, f1_local1, f1_local2, f1_local3 = f1_arg0:getLocalRect() - local f1_local4 = f1_local3 - f1_local1 - f1_arg0:SetTop( f1_local1 - (f1_local4 + f1_arg1) * f1_arg2 ) - f1_arg0:SetBottom( f1_local3 - (f1_local4 + f1_arg1) * f1_arg2 ) - end +local f0_local2 = function(f1_arg0, f1_arg1, f1_arg2) + if 0 < f1_arg2 then + local f1_local0, f1_local1, f1_local2, f1_local3 = f1_arg0:getLocalRect() + local f1_local4 = f1_local3 - f1_local1 + f1_arg0:SetTop(f1_local1 - (f1_local4 + f1_arg1) * f1_arg2) + f1_arg0:SetBottom(f1_local3 - (f1_local4 + f1_arg1) * f1_arg2) + end end -local f0_local3 = function ( f2_arg0, f2_arg1, f2_arg2 ) - assert( f2_arg0.ConquestButton ) - if CONDITIONS.IsStoreAllowed( f2_arg0 ) then - assert( f2_arg0.StoreButton ) - end - local f2_local0 = not CONDITIONS.IsTrialLicense( f2_arg0 ) - if f2_local0 then - assert( f2_arg0.CustomGameButton ) - end - f2_arg0.buttonSpacing = _1080p * buttonSpacing - local f2_local1 = function () - return Lobby.IsInPrivateParty() and not Lobby.IsPrivatePartyHost() - end - - local f2_local2 = function () - local f4_local0 = f2_local1() - f2_arg0.ConquestButton:SetButtonDisabled( f4_local0 ) - if f2_arg0.MLGGameBattlesButton ~= nil then - f2_arg0.MLGGameBattlesButton:SetButtonDisabled( f4_local0 ) - end - if f2_local0 then - f2_arg0.CustomGameButton:SetButtonDisabled( f4_local0 ) - end - end - - local f2_local3 = LUI.DataSourceInGlobalModel.new( "frontEnd.lobby.areWeGameHost" ) - local f2_local4 = DataSources.frontEnd.lobby.memberCount - f2_arg0:SubscribeToModel( f2_local3:GetModel( f2_arg1 ), f2_local2 ) - f2_arg0:SubscribeToModel( f2_local4:GetModel( f2_arg1 ), f2_local2 ) - f2_arg0.ConquestButton:addEventHandler( "button_action", function ( f5_arg0, f5_arg1 ) - Engine.SetDvarBool( "cg_mlg_gamebattles_match", false ) - local f5_local0 = function () - LUI.FlowManager.RequestAddMenu( "Missions", false, f5_arg1.controller, false, {}, true ) - end - - if not Onboarding:BeginFlow( Onboarding.RigTutorial, f2_arg1 ) then - f5_local0() - else - LUI.FlowManager.RequestPopupMenu( nil, "MPFullScreenVideoOverlay", true, f2_arg1, nil, { - videoRef = "mp_wolverines_mission_commander", - allowSkip = true, - doIntroFadeOut = false, - doIntroFadeIn = false, - doOutroFadeIn = true, - doOutroFadeOut = true, - fadeColor = COLORS.black - }, nil, true, true ) - local f5_local1 = f2_arg0:Wait( 500 ) - f5_local1.onComplete = f5_local0 - end - end ) - if CONDITIONS.IsGameBattlesAllowed( f2_arg0 ) then - f2_arg0.MLGGameBattlesButton:addEventHandler( "button_action", function ( f7_arg0, f7_arg1 ) - if Engine.GetDvarBool( "splitscreen" ) then - LUI.FlowManager.RequestPopupMenu( f2_arg0, "MLGGamebattlesSplitscreenPopup", true, f7_arg1.controller, false, { - controllerIndex = f2_arg1 - } ) - elseif Lobby.IsNotAloneInPrivateParty() then - LUI.FlowManager.RequestPopupMenu( f2_arg0, "DisbandPartyEnterGameBattlesLobbyPopup", true, f7_arg1.controller, false, { - controllerIndex = f2_arg1 - } ) - else - OpenGameBattlesLobby( f7_arg1.controller ) - end - end ) - end - if f2_local0 then - f2_arg0.CustomGameButton:addEventHandler( "button_action", function ( f8_arg0, f8_arg1 ) - OpenPrivateMatchLobby( f8_arg1 ) - end ) - end +local f0_local3 = function(f2_arg0, f2_arg1, f2_arg2) + assert(f2_arg0.ConquestButton) + if CONDITIONS.IsStoreAllowed(f2_arg0) then + assert(f2_arg0.StoreButton) + end + local f2_local0 = not CONDITIONS.IsTrialLicense(f2_arg0) + if f2_local0 then + assert(f2_arg0.CustomGameButton) + end + f2_arg0.buttonSpacing = _1080p * buttonSpacing + local f2_local1 = function() + return Lobby.IsInPrivateParty() and not Lobby.IsPrivatePartyHost() + end - f2_arg0.ModsButton:addEventHandler( "button_action", function ( arg0, arg1 ) - LUI.FlowManager.RequestAddMenu( "ModSelectMenu", true, arg1.controller, false ) - end ) + local f2_local2 = function() + local f4_local0 = f2_local1() + f2_arg0.ConquestButton:SetButtonDisabled(f4_local0) + if f2_arg0.MLGGameBattlesButton ~= nil then + f2_arg0.MLGGameBattlesButton:SetButtonDisabled(f4_local0) + end + if f2_local0 then + f2_arg0.CustomGameButton:SetButtonDisabled(f4_local0) + end + end - if CONDITIONS.IsStoreAllowed( f2_arg0 ) then - f2_arg0.StoreButton:addEventHandler( "button_action", function ( f9_arg0, f9_arg1 ) - local f9_local0 = STORE.GoToStore - local f9_local1 = f9_arg1.controller - local f9_local2 = f9_arg0:GetCurrentMenu() - f9_local0( f9_local1, f9_local2.id, f9_arg0.id ) - end ) - end - local f2_local5 = _1080p * f0_local1 - local f2_local6 = 0 - if f2_arg0.MLGGameBattlesButton == nil then - f2_local6 = 1 - end - if f2_arg0.CustomGameButton then - f0_local2( f2_arg0.CustomGameButton, f2_local5, f2_local6 ) - else - f2_local6 = f2_local6 + 1 - end - if f2_arg0.ModsButton then - f0_local2( f2_arg0.ModsButton, f2_local5, f2_local6 ) + local f2_local3 = LUI.DataSourceInGlobalModel.new("frontEnd.lobby.areWeGameHost") + local f2_local4 = DataSources.frontEnd.lobby.memberCount + f2_arg0:SubscribeToModel(f2_local3:GetModel(f2_arg1), f2_local2) + f2_arg0:SubscribeToModel(f2_local4:GetModel(f2_arg1), f2_local2) + f2_arg0.ConquestButton:addEventHandler("button_action", function(f5_arg0, f5_arg1) + Engine.SetDvarBool("cg_mlg_gamebattles_match", false) + local f5_local0 = function() + LUI.FlowManager.RequestAddMenu("Missions", false, f5_arg1.controller, false, {}, true) + end + + if not Onboarding:BeginFlow(Onboarding.RigTutorial, f2_arg1) then + f5_local0() + else + LUI.FlowManager.RequestPopupMenu(nil, "MPFullScreenVideoOverlay", true, f2_arg1, nil, { + videoRef = "mp_wolverines_mission_commander", + allowSkip = true, + doIntroFadeOut = false, + doIntroFadeIn = false, + doOutroFadeIn = true, + doOutroFadeOut = true, + fadeColor = COLORS.black + }, nil, true, true) + local f5_local1 = f2_arg0:Wait(500) + f5_local1.onComplete = f5_local0 + end + end) + if CONDITIONS.IsGameBattlesAllowed(f2_arg0) then + f2_arg0.MLGGameBattlesButton:addEventHandler("button_action", function(f7_arg0, f7_arg1) + if Engine.GetDvarBool("splitscreen") then + LUI.FlowManager.RequestPopupMenu(f2_arg0, "MLGGamebattlesSplitscreenPopup", true, f7_arg1.controller, + false, { + controllerIndex = f2_arg1 + }) + elseif Lobby.IsNotAloneInPrivateParty() then + LUI.FlowManager.RequestPopupMenu(f2_arg0, "DisbandPartyEnterGameBattlesLobbyPopup", true, + f7_arg1.controller, false, { + controllerIndex = f2_arg1 + }) + else + OpenGameBattlesLobby(f7_arg1.controller) + end + end) + end + if f2_local0 then + f2_arg0.CustomGameButton:addEventHandler("button_action", function(f8_arg0, f8_arg1) + OpenPrivateMatchLobby(f8_arg1) + end) + end + + f2_arg0.ModsButton:addEventHandler("button_action", function(arg0, arg1) + LUI.FlowManager.RequestAddMenu("ModSelectMenu", true, arg1.controller, false) + end) + + if CONDITIONS.IsStoreAllowed(f2_arg0) then + f2_arg0.StoreButton:addEventHandler("button_action", function(f9_arg0, f9_arg1) + local f9_local0 = STORE.GoToStore + local f9_local1 = f9_arg1.controller + local f9_local2 = f9_arg0:GetCurrentMenu() + f9_local0(f9_local1, f9_local2.id, f9_arg0.id) + end) + end + local f2_local5 = _1080p * f0_local1 + local f2_local6 = 0 + if f2_arg0.MLGGameBattlesButton == nil then + f2_local6 = 1 + end + if f2_arg0.CustomGameButton then + f0_local2(f2_arg0.CustomGameButton, f2_local5, f2_local6) else f2_local6 = f2_local6 + 1 end - if CONDITIONS.IsStoreAllowed( f2_arg0 ) then - f0_local2( f2_arg0.StoreButton, f2_local5, f2_local6 ) - else - f2_local6 = f2_local6 + 1 - end - if f2_arg0.StoreButton then - f2_arg0.StoreButton:SetButtonDescription( STORE.GetStoreDescription() ) - if CONDITIONS.IsTrialLicense() then - f2_arg0.StoreButton.Text:setText( ToUpperCase( Engine.Localize( "LUA_MENU_BUY_NOW" ) ) ) - end - end + if f2_arg0.ModsButton then + f0_local2(f2_arg0.ModsButton, f2_local5, f2_local6) + else + f2_local6 = f2_local6 + 1 + end + if CONDITIONS.IsStoreAllowed(f2_arg0) then + f0_local2(f2_arg0.StoreButton, f2_local5, f2_local6) + else + f2_local6 = f2_local6 + 1 + end + if f2_arg0.StoreButton then + f2_arg0.StoreButton:SetButtonDescription(STORE.GetStoreDescription()) + if CONDITIONS.IsTrialLicense() then + f2_arg0.StoreButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_BUY_NOW"))) + end + end end -function MPMainMenuButtons( menu, controller ) - local self = LUI.UIVerticalNavigator.new() - self:SetAnchorsAndPosition( 0, 1, 0, 1, 0, 500 * _1080p, 0, 190 * _1080p ) - self.id = "MPMainMenuButtons" - local f11_local1 = controller and controller.controllerIndex - if not f11_local1 and not Engine.InFrontend() then - f11_local1 = self:getRootController() - end - assert( f11_local1 ) - local ConquestButton = nil - - ConquestButton = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f11_local1 - } ) - ConquestButton.id = "ConquestButton" - ConquestButton.buttonDescription = Engine.Localize( "LUA_MENU_PUBLIC_MATCH_DESC" ) - ConquestButton.Text:setText( Engine.Localize( "LUA_MENU_PUBLIC_MATCH_CAPS" ), 0 ) - ConquestButton:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, 0, _1080p * 30 ) - self:addElement( ConquestButton ) - self.ConquestButton = ConquestButton - - local MLGGameBattlesButton = nil - if CONDITIONS.IsGameBattlesAllowed( self ) then - MLGGameBattlesButton = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f11_local1 - } ) - MLGGameBattlesButton.id = "MLGGameBattlesButton" - if CONDITIONS.IsGameBattlesAllowed( self ) then - - else - - end - if CONDITIONS.IsGameBattlesAllowed( self ) then - MLGGameBattlesButton.buttonDescription = Engine.Localize( "LUA_MENU_MLG_GAMEBATTLES_DESC" ) - end - MLGGameBattlesButton.Text:setText( Engine.Localize( "LUA_MENU_MLG_GAMEBATTLES_CAPS" ), 0 ) - MLGGameBattlesButton:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, _1080p * 40, _1080p * 70 ) - self:addElement( MLGGameBattlesButton ) - self.MLGGameBattlesButton = MLGGameBattlesButton - end +function MPMainMenuButtons(menu, controller) + local self = LUI.UIVerticalNavigator.new() + self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 190 * _1080p) + self.id = "MPMainMenuButtons" + local f11_local1 = controller and controller.controllerIndex + if not f11_local1 and not Engine.InFrontend() then + f11_local1 = self:getRootController() + end + assert(f11_local1) + local ConquestButton = nil - local CustomGameButton = nil - - CustomGameButton = MenuBuilder.BuildRegisteredType( "MenuButton", { + ConquestButton = MenuBuilder.BuildRegisteredType("MenuButton", { controllerIndex = f11_local1 - } ) + }) + ConquestButton.id = "ConquestButton" + ConquestButton.buttonDescription = Engine.Localize("LUA_MENU_PUBLIC_MATCH_DESC") + ConquestButton.Text:setText(Engine.Localize("LUA_MENU_PUBLIC_MATCH_CAPS"), 0) + ConquestButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, 0, _1080p * 30) + self:addElement(ConquestButton) + self.ConquestButton = ConquestButton + + local MLGGameBattlesButton = nil + if CONDITIONS.IsGameBattlesAllowed(self) then + MLGGameBattlesButton = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f11_local1 + }) + MLGGameBattlesButton.id = "MLGGameBattlesButton" + if CONDITIONS.IsGameBattlesAllowed(self) then + + else + + end + if CONDITIONS.IsGameBattlesAllowed(self) then + MLGGameBattlesButton.buttonDescription = Engine.Localize("LUA_MENU_MLG_GAMEBATTLES_DESC") + end + MLGGameBattlesButton.Text:setText(Engine.Localize("LUA_MENU_MLG_GAMEBATTLES_CAPS"), 0) + MLGGameBattlesButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 40, _1080p * 70) + self:addElement(MLGGameBattlesButton) + self.MLGGameBattlesButton = MLGGameBattlesButton + end + + local CustomGameButton = nil + + CustomGameButton = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f11_local1 + }) CustomGameButton.id = "CustomGameButton" - CustomGameButton.buttonDescription = Engine.Localize( "LUA_MENU_CUSTOM_GAME_DESC" ) - CustomGameButton.Text:setText( Engine.Localize( "LUA_MENU_CUSTOM_GAME_CAPS" ), 0 ) - CustomGameButton:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, _1080p * 80, _1080p * 110 ) - self:addElement( CustomGameButton ) + CustomGameButton.buttonDescription = Engine.Localize("LUA_MENU_CUSTOM_GAME_DESC") + CustomGameButton.Text:setText(Engine.Localize("LUA_MENU_CUSTOM_GAME_CAPS"), 0) + CustomGameButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 80, _1080p * 110) + self:addElement(CustomGameButton) self.CustomGameButton = CustomGameButton local ModsButton = nil - - ModsButton = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f11_local1 - } ) - ModsButton.id = "ModsButton" - ModsButton.buttonDescription = Engine.Localize( "LUA_MENU_MODS_DESC" ) - ModsButton.Text:setText( ToUpperCase( Engine.Localize( "LUA_MENU_MODS_CAPS" ) ), 0 ) - ModsButton:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, _1080p * 120, _1080p * 150 ) - self:addElement( ModsButton ) - self.ModsButton = ModsButton - local f11_local6 = nil - if CONDITIONS.IsStoreAllowed( self ) then - f11_local6 = MenuBuilder.BuildRegisteredType( "MenuButton", { + ModsButton = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = f11_local1 + }) + ModsButton.id = "ModsButton" + ModsButton.buttonDescription = Engine.Localize("LUA_MENU_MODS_DESC") + ModsButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_MODS_CAPS")), 0) + ModsButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 120, _1080p * 150) + self:addElement(ModsButton) + self.ModsButton = ModsButton + + local f11_local6 = nil + if CONDITIONS.IsStoreAllowed(self) then + f11_local6 = MenuBuilder.BuildRegisteredType("MenuButton", { controllerIndex = f11_local1 - } ) + }) f11_local6.id = "StoreButton" - f11_local6.buttonDescription = Engine.Localize( "LUA_MENU_STORE_DESC" ) - f11_local6.Text:setText( Engine.Localize( "LUA_MENU_STORE_CAPS" ), 0 ) - f11_local6:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, _1080p * 160, _1080p * 190 ) - self:addElement( f11_local6 ) + f11_local6.buttonDescription = Engine.Localize("LUA_MENU_STORE_DESC") + f11_local6.Text:setText(Engine.Localize("LUA_MENU_STORE_CAPS"), 0) + f11_local6:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 160, _1080p * 190) + self:addElement(f11_local6) self.StoreButton = f11_local6 - end - - f0_local3( self, f11_local1, controller ) - return self + end + + f0_local3(self, f11_local1, controller) + return self end -MenuBuilder.m_types["MPMainMenuButtons"] = MPMainMenuButtons \ No newline at end of file +MenuBuilder.m_types["MPMainMenuButtons"] = MPMainMenuButtons diff --git a/data/cdata/ui_scripts/MainMenu/MissionsVerticalLayout.lua b/data/cdata/ui_scripts/MainMenu/MissionsVerticalLayout.lua index f33ad66b..c7a09109 100644 --- a/data/cdata/ui_scripts/MainMenu/MissionsVerticalLayout.lua +++ b/data/cdata/ui_scripts/MainMenu/MissionsVerticalLayout.lua @@ -1,175 +1,160 @@ -local f0_local0 = function ( f1_arg0, f1_arg1, f1_arg2 ) - assert( f1_arg0.CreateAClassButton ) - assert( f1_arg0.MissionSelect ) - local f1_local0 = LUI.DataSourceInGlobalModel.new( "frontEnd.lobby.findMatchButtonWaitStatus" ) - f1_arg0:SubscribeToModel( f1_local0:GetModel( f1_arg1 ), function () - local f2_local0 = f1_local0:GetValue( f1_arg1 ) - local f2_local1 = "Browse for Custom Servers" - if f2_local0 == "" then - f1_arg0.MissionSelect:SetButtonDisabled( false ) - else - f1_arg0.MissionSelect:SetButtonDisabled( true ) - f2_local1 = f2_local0 - end - f1_arg0.MissionSelect.buttonDescription = f2_local1 - f1_arg0.ButtonDescription:processEvent( { - name = "update_button_description", - text = f2_local1 - } ) - end ) - if not Onboarding.RigTutorial:WasCompleted( f1_arg1 ) then - f1_arg0.CreateAClassButton.listDefaultFocus = 0 - end - if not CONDITIONS.IsQuarterMasterAllowed( f1_arg0 ) then - f1_arg0.Barracks:SetAnchorsAndPosition( 0, 0, 0, 1, 0, 0, _1080p * 120, _1080p * 150 ) - f1_arg0.ButtonDescription:SetAnchorsAndPosition( 0, 0, 0, 1, 0, 0, _1080p * 160, _1080p * 190 ) - end +local f0_local0 = function(f1_arg0, f1_arg1, f1_arg2) + assert(f1_arg0.CreateAClassButton) + assert(f1_arg0.MissionSelect) + local f1_local0 = LUI.DataSourceInGlobalModel.new("frontEnd.lobby.findMatchButtonWaitStatus") + f1_arg0:SubscribeToModel(f1_local0:GetModel(f1_arg1), function() + local f2_local0 = f1_local0:GetValue(f1_arg1) + local f2_local1 = "Browse for Custom Servers" + if f2_local0 == "" then + f1_arg0.MissionSelect:SetButtonDisabled(false) + else + f1_arg0.MissionSelect:SetButtonDisabled(true) + f2_local1 = f2_local0 + end + f1_arg0.MissionSelect.buttonDescription = f2_local1 + f1_arg0.ButtonDescription:processEvent({ + name = "update_button_description", + text = f2_local1 + }) + end) + if not Onboarding.RigTutorial:WasCompleted(f1_arg1) then + f1_arg0.CreateAClassButton.listDefaultFocus = 0 + end + if not CONDITIONS.IsQuarterMasterAllowed(f1_arg0) then + f1_arg0.Barracks:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 120, _1080p * 150) + f1_arg0.ButtonDescription:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 160, _1080p * 190) + end end -function MissionsVerticalLayout( menu, controller ) - local self = LUI.UIVerticalList.new() - self:SetAnchorsAndPosition( 0, 1, 0, 1, 0, 500 * _1080p, 0, 330 * _1080p ) - self.id = "MissionsVerticalLayout" - self._animationSets = {} - self._sequences = {} - local f3_local1 = controller and controller.controllerIndex - if not f3_local1 and not Engine.InFrontend() then - f3_local1 = self:getRootController() - end - assert( f3_local1 ) - local f3_local2 = self - self:SetSpacing( 10 * _1080p ) - local MissionSelect = nil - - MissionSelect = MenuBuilder.BuildRegisteredType( "GenericButton", { - controllerIndex = f3_local1 - } ) - MissionSelect.id = "MissionSelect" - MissionSelect.buttonDescription = "Browse for Custom Servers" - MissionSelect.Text:setText( ToUpperCase( "Server Browser" ), 0 ) - MissionSelect:SetAnchorsAndPosition( 0, 0, 0, 1, 0, _1080p * -4, 0, _1080p * 30 ) - self:addElement( MissionSelect ) - self.MissionSelect = MissionSelect - - local MissionTeams = nil - - MissionTeams = MenuBuilder.BuildRegisteredType( "GenericButton", { - controllerIndex = f3_local1 - } ) - MissionTeams.id = "MissionTeams" - MissionTeams.buttonDescription = Engine.Localize( "LUA_MENU_DESC_MISSION_TEAMS" ) - MissionTeams.Text:setText( ToUpperCase( Engine.Localize( "MENU_MISSION_TEAMS" ) ), 0 ) - MissionTeams:SetAnchorsAndPosition( 0, 0, 0, 1, 0, _1080p * -4, _1080p * 40, _1080p * 70 ) - self:addElement( MissionTeams ) - self.MissionTeams = MissionTeams - - local CreateAClassButton = nil - - CreateAClassButton = MenuBuilder.BuildRegisteredType( "CreateAClassButton", { - controllerIndex = f3_local1 - } ) - CreateAClassButton.id = "CreateAClassButton" - CreateAClassButton:SetAnchorsAndPosition( 0, 0, 0, 1, 0, _1080p * -4, _1080p * 80, _1080p * 110 ) - self:addElement( CreateAClassButton ) - self.CreateAClassButton = CreateAClassButton - - local f3_local6 = nil - if CONDITIONS.IsQuarterMasterAllowed( self ) then - f3_local6 = MenuBuilder.BuildRegisteredType( "QuartermasterButton", { - controllerIndex = f3_local1 - } ) - f3_local6.id = "Armory" - f3_local6:SetAnchorsAndPosition( 0, 0, 0, 1, 0, _1080p * -4, _1080p * 120, _1080p * 150 ) - self:addElement( f3_local6 ) - self.Armory = f3_local6 - end - local Barracks = nil - - Barracks = MenuBuilder.BuildRegisteredType( "BarracksButton", { - controllerIndex = f3_local1 - } ) - Barracks.id = "Barracks" - Barracks:SetAnchorsAndPosition( 0, 0, 0, 1, 0, _1080p * -4, _1080p * 160, _1080p * 190 ) - self:addElement( Barracks ) - self.Barracks = Barracks - - local f3_local8 = nil - if CONDITIONS.AreContractsEnabled( self ) then - f3_local8 = MenuBuilder.BuildRegisteredType( "ContractsButton", { - controllerIndex = f3_local1 - } ) - f3_local8.id = "Contracts" - f3_local8:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, _1080p * 200, _1080p * 260 ) - self:addElement( f3_local8 ) - self.Contracts = f3_local8 - end - local ButtonDescription = nil - - ButtonDescription = MenuBuilder.BuildRegisteredType( "ButtonDescriptionText", { - controllerIndex = f3_local1 - } ) - ButtonDescription.id = "ButtonDescription" - ButtonDescription.Description:SetRight( _1080p * 415, 0 ) - ButtonDescription:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 504, _1080p * 270, _1080p * 370 ) - self:addElement( ButtonDescription ) - self.ButtonDescription = ButtonDescription - - self._animationSets.DefaultAnimationSet = function () - self._sequences.DefaultSequence = function () - - end - - CreateAClassButton:RegisterAnimationSequence( "ContractsKillswitched", { - { - function () - return self.CreateAClassButton:SetAnchorsAndPosition( 0, 0, 0, 1, 0, 0, _1080p * 80, _1080p * 110, 0 ) - end - } - } ) - if CONDITIONS.IsQuarterMasterAllowed( self ) then - f3_local6:RegisterAnimationSequence( "ContractsKillswitched", { - { - function () - return self.Armory:SetAnchorsAndPosition( 0, 0, 0, 1, 0, 0, _1080p * 120, _1080p * 150, 0 ) - end - } - } ) - end - Barracks:RegisterAnimationSequence( "ContractsKillswitched", { - { - function () - return self.Barracks:SetAnchorsAndPosition( 0, 0, 0, 1, 0, 0, _1080p * 160, _1080p * 190, 0 ) - end - } - } ) - ButtonDescription:RegisterAnimationSequence( "ContractsKillswitched", { - { - function () - return self.ButtonDescription:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 504, _1080p * 201, _1080p * 301, 0 ) - end - } - } ) - self._sequences.ContractsKillswitched = function () - CreateAClassButton:AnimateSequence( "ContractsKillswitched" ) - if CONDITIONS.IsQuarterMasterAllowed( self ) then - f3_local6:AnimateSequence( "ContractsKillswitched" ) - end - Barracks:AnimateSequence( "ContractsKillswitched" ) - ButtonDescription:AnimateSequence( "ContractsKillswitched" ) - end - - end - - self._animationSets.DefaultAnimationSet() - MissionSelect:addEventHandler( "button_action", function ( f11_arg0, f11_arg1 ) - local f11_local0 = f11_arg1.controller or f3_local1 - ACTIONS.OpenMenu( "SystemLinkMenu", true, f11_local0 ) - end ) - MissionTeams:addEventHandler( "button_action", function ( f12_arg0, f12_arg1 ) - ACTIONS.OpenMenu( "MissionTeamSelect", true, f12_arg1.controller or f3_local1 ) - end ) - f0_local0( self, f3_local1, controller ) - return self +function MissionsVerticalLayout(menu, controller) + local self = LUI.UIVerticalList.new() + self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 330 * _1080p) + self.id = "MissionsVerticalLayout" + self._animationSets = {} + self._sequences = {} + local f3_local1 = controller and controller.controllerIndex + if not f3_local1 and not Engine.InFrontend() then + f3_local1 = self:getRootController() + end + assert(f3_local1) + local f3_local2 = self + self:SetSpacing(10 * _1080p) + local MissionSelect = nil + + MissionSelect = MenuBuilder.BuildRegisteredType("GenericButton", { + controllerIndex = f3_local1 + }) + MissionSelect.id = "MissionSelect" + MissionSelect.buttonDescription = "Browse for Custom Servers" + MissionSelect.Text:setText(ToUpperCase("Server Browser"), 0) + MissionSelect:SetAnchorsAndPosition(0, 0, 0, 1, 0, _1080p * -4, 0, _1080p * 30) + self:addElement(MissionSelect) + self.MissionSelect = MissionSelect + + local MissionTeams = nil + + MissionTeams = MenuBuilder.BuildRegisteredType("GenericButton", { + controllerIndex = f3_local1 + }) + MissionTeams.id = "MissionTeams" + MissionTeams.buttonDescription = Engine.Localize("LUA_MENU_DESC_MISSION_TEAMS") + MissionTeams.Text:setText(ToUpperCase(Engine.Localize("MENU_MISSION_TEAMS")), 0) + MissionTeams:SetAnchorsAndPosition(0, 0, 0, 1, 0, _1080p * -4, _1080p * 40, _1080p * 70) + self:addElement(MissionTeams) + self.MissionTeams = MissionTeams + + local CreateAClassButton = nil + + CreateAClassButton = MenuBuilder.BuildRegisteredType("CreateAClassButton", { + controllerIndex = f3_local1 + }) + CreateAClassButton.id = "CreateAClassButton" + CreateAClassButton:SetAnchorsAndPosition(0, 0, 0, 1, 0, _1080p * -4, _1080p * 80, _1080p * 110) + self:addElement(CreateAClassButton) + self.CreateAClassButton = CreateAClassButton + + local f3_local6 = nil + if CONDITIONS.IsQuarterMasterAllowed(self) then + f3_local6 = MenuBuilder.BuildRegisteredType("QuartermasterButton", { + controllerIndex = f3_local1 + }) + f3_local6.id = "Armory" + f3_local6:SetAnchorsAndPosition(0, 0, 0, 1, 0, _1080p * -4, _1080p * 120, _1080p * 150) + self:addElement(f3_local6) + self.Armory = f3_local6 + end + local Barracks = nil + + Barracks = MenuBuilder.BuildRegisteredType("BarracksButton", { + controllerIndex = f3_local1 + }) + Barracks.id = "Barracks" + Barracks:SetAnchorsAndPosition(0, 0, 0, 1, 0, _1080p * -4, _1080p * 160, _1080p * 190) + self:addElement(Barracks) + self.Barracks = Barracks + + local f3_local8 = nil + if CONDITIONS.AreContractsEnabled(self) then + f3_local8 = MenuBuilder.BuildRegisteredType("ContractsButton", { + controllerIndex = f3_local1 + }) + f3_local8.id = "Contracts" + f3_local8:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 200, _1080p * 260) + self:addElement(f3_local8) + self.Contracts = f3_local8 + end + local ButtonDescription = nil + + ButtonDescription = MenuBuilder.BuildRegisteredType("ButtonDescriptionText", { + controllerIndex = f3_local1 + }) + ButtonDescription.id = "ButtonDescription" + ButtonDescription.Description:SetRight(_1080p * 415, 0) + ButtonDescription:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 504, _1080p * 270, _1080p * 370) + self:addElement(ButtonDescription) + self.ButtonDescription = ButtonDescription + + self._animationSets.DefaultAnimationSet = function() + self._sequences.DefaultSequence = function() + + end + + CreateAClassButton:RegisterAnimationSequence("ContractsKillswitched", {{function() + return self.CreateAClassButton:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 80, _1080p * 110, 0) + end}}) + if CONDITIONS.IsQuarterMasterAllowed(self) then + f3_local6:RegisterAnimationSequence("ContractsKillswitched", {{function() + return self.Armory:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 120, _1080p * 150, 0) + end}}) + end + Barracks:RegisterAnimationSequence("ContractsKillswitched", {{function() + return self.Barracks:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 160, _1080p * 190, 0) + end}}) + ButtonDescription:RegisterAnimationSequence("ContractsKillswitched", {{function() + return self.ButtonDescription:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 504, _1080p * 201, _1080p * 301, + 0) + end}}) + self._sequences.ContractsKillswitched = function() + CreateAClassButton:AnimateSequence("ContractsKillswitched") + if CONDITIONS.IsQuarterMasterAllowed(self) then + f3_local6:AnimateSequence("ContractsKillswitched") + end + Barracks:AnimateSequence("ContractsKillswitched") + ButtonDescription:AnimateSequence("ContractsKillswitched") + end + + end + + self._animationSets.DefaultAnimationSet() + MissionSelect:addEventHandler("button_action", function(f11_arg0, f11_arg1) + local f11_local0 = f11_arg1.controller or f3_local1 + ACTIONS.OpenMenu("SystemLinkMenu", true, f11_local0) + end) + MissionTeams:addEventHandler("button_action", function(f12_arg0, f12_arg1) + ACTIONS.OpenMenu("MissionTeamSelect", true, f12_arg1.controller or f3_local1) + end) + f0_local0(self, f3_local1, controller) + return self end -MenuBuilder.m_types[ "MissionsVerticalLayout"] = MissionsVerticalLayout \ No newline at end of file +MenuBuilder.m_types["MissionsVerticalLayout"] = MissionsVerticalLayout diff --git a/data/cdata/ui_scripts/MainMenu/__init__.lua b/data/cdata/ui_scripts/MainMenu/__init__.lua index 2d2926c8..edd94a68 100644 --- a/data/cdata/ui_scripts/MainMenu/__init__.lua +++ b/data/cdata/ui_scripts/MainMenu/__init__.lua @@ -2,4 +2,4 @@ require("CampaignMenuButtons") require("CPMainMenu") require("CPMainMenuButtons") require("MissionsVerticalLayout") -require("MPMainMenuButtons") \ No newline at end of file +require("MPMainMenuButtons") diff --git a/data/cdata/ui_scripts/Mods/ModDownload.lua b/data/cdata/ui_scripts/Mods/ModDownload.lua index a7a490f6..e7b437c6 100644 --- a/data/cdata/ui_scripts/Mods/ModDownload.lua +++ b/data/cdata/ui_scripts/Mods/ModDownload.lua @@ -1,15 +1,15 @@ -function ModDownloadCancel( arg0, arg1 ) - download.abort() - LUI.FlowManager.RequestLeaveMenu( arg0 ) +function ModDownloadCancel(arg0, arg1) + download.abort() + LUI.FlowManager.RequestLeaveMenu(arg0) end -function ModDownloadPopup( arg0, arg1 ) - local popup = MenuBuilder.BuildRegisteredType( "FenceDialogPopup", { - message = "Downloading files...", - controllerIndex = arg1.controllerIndex, - onCancel = ModDownloadCancel - } ) - popup.id = "ModDownloadPopup" +function ModDownloadPopup(arg0, arg1) + local popup = MenuBuilder.BuildRegisteredType("FenceDialogPopup", { + message = "Downloading files...", + controllerIndex = arg1.controllerIndex, + onCancel = ModDownloadCancel + }) + popup.id = "ModDownloadPopup" local file = "" @@ -26,15 +26,15 @@ function ModDownloadPopup( arg0, arg1 ) LUI.FlowManager.RequestLeaveMenu(popup) end) - return popup + return popup end -MenuBuilder.registerType( "ModDownloadPopup", ModDownloadPopup ) +MenuBuilder.registerType("ModDownloadPopup", ModDownloadPopup) local function reg_func() Engine.GetLuiRoot():registerEventHandler("mod_download_start", function(element, event) - LUI.FlowManager.RequestPopupMenu( element, "ModDownloadPopup", true, event.controller, false ) + LUI.FlowManager.RequestPopupMenu(element, "ModDownloadPopup", true, event.controller, false) end) end -scheduler.once(reg_func) \ No newline at end of file +scheduler.once(reg_func) diff --git a/data/cdata/ui_scripts/Mods/ModSelectButton.lua b/data/cdata/ui_scripts/Mods/ModSelectButton.lua index 4cf12612..701075f3 100644 --- a/data/cdata/ui_scripts/Mods/ModSelectButton.lua +++ b/data/cdata/ui_scripts/Mods/ModSelectButton.lua @@ -1,223 +1,193 @@ -local function PostLoadFunc( f1_arg0, f1_arg1, f1_arg2 ) - assert( f1_arg0.GenericButton ) - - f1_arg0.GenericButton:addEventHandler( "button_action", function ( f3_arg0, f3_arg1 ) - local f3_local0 = f1_arg0:GetDataSource() - f3_local0.buttonOnClickFunction( f3_arg0, f3_arg1 ) - end ) - f1_arg0.GenericButton:addEventHandler( "button_over", function ( f4_arg0, f4_arg1 ) - local f4_local0 = f1_arg0:GetDataSource() - f4_local0.buttonOnHoverFunction( f4_arg0, f4_arg1 ) - f4_local0 = f1_arg0:GetDataSource() - f4_local0 = f4_local0.levelName - end ) - f1_arg0.GenericButton:addEventHandler( "button_up", function ( f5_arg0, f5_arg1 ) - local f5_local0 = f1_arg0:GetDataSource() - f5_local0.buttonOnHoverFunction( f5_arg0, f5_arg1 ) - f5_local0 = f1_arg0:GetDataSource() - f5_local0 = f5_local0.levelName - end ) - f1_arg0:registerEventHandler( "grid_anim", function ( element, event ) - element:SetAlpha( event.value ) - end ) - assert( f1_arg0.MainMissionIcon ) - assert( f1_arg0.SAIcon ) - assert( f1_arg0.JAIcon ) - f1_arg0:SubscribeToDataSourceThroughElement( f1_arg0, nil, function () - local f7_local0 = f1_arg0:GetDataSource() - f7_local0 = f7_local0.levelName - end ) +local function PostLoadFunc(buttonElement, controllerIndex, controller) + assert(buttonElement.GenericButton) + + buttonElement.GenericButton:addEventHandler("button_action", function(clickedElement, eventArgs) + local dataSource = buttonElement:GetDataSource() + dataSource.buttonOnClickFunction(clickedElement, eventArgs) + end) + + buttonElement.GenericButton:addEventHandler("button_over", function(hoveredElement, eventArgs) + local dataSource = buttonElement:GetDataSource() + dataSource.buttonOnHoverFunction(hoveredElement, eventArgs) + dataSource = buttonElement:GetDataSource() + dataSource = dataSource.levelName + end) + + buttonElement.GenericButton:addEventHandler("button_up", function(unhoveredElement, eventArgs) + local dataSource = buttonElement:GetDataSource() + dataSource.buttonOnHoverFunction(unhoveredElement, eventArgs) + dataSource = buttonElement:GetDataSource() + dataSource = dataSource.levelName + end) + + buttonElement:registerEventHandler("grid_anim", function(element, event) + element:SetAlpha(event.value) + end) + + buttonElement:SubscribeToDataSourceThroughElement(buttonElement, nil, function() + local dataSource = buttonElement:GetDataSource() + dataSource = dataSource.levelName + end) end -function ModSelectButton( menu, controller ) - local self = LUI.UIButton.new() - self:SetAnchorsAndPosition( 0, 1, 0, 1, 0, 500 * _1080p, 0, 30 * _1080p ) - self.id = "ModSelectButton" - self._animationSets = {} - self._sequences = {} - local f8_local1 = controller and controller.controllerIndex - if not f8_local1 and not Engine.InFrontend() then - f8_local1 = self:getRootController() - end - assert( f8_local1 ) - local f8_local2 = self - local GenericButton = nil - - GenericButton = MenuBuilder.BuildRegisteredType( "GenericButton", { - controllerIndex = f8_local1 - } ) - GenericButton.id = "GenericButton" - GenericButton:SetAlpha( 0, 0 ) - GenericButton:SetAnchorsAndPosition( 0, 1, 0, 0, 0, _1080p * 500, 0, 0 ) - GenericButton:SubscribeToModelThroughElement( self, "buttonLabel", function () - local f9_local0 = self:GetDataSource() - f9_local0 = f9_local0.buttonLabel:GetValue( f8_local1 ) - if f9_local0 ~= nil then - GenericButton.Text:setText( LocalizeString( ToUpperCase( f9_local0 ) ), 0 ) - end - end ) - self:addElement( GenericButton ) - self.GenericButton = GenericButton - - local GenericListButtonBackground = nil - - GenericListButtonBackground = MenuBuilder.BuildRegisteredType( "GenericListArrowButtonBackground", { - controllerIndex = f8_local1 - } ) - GenericListButtonBackground.id = "GenericListButtonBackground" - GenericListButtonBackground:SetAnchorsAndPosition( 0, 0, 0, 0, 0, 0, 0, 0 ) - self:addElement( GenericListButtonBackground ) - self.GenericListButtonBackground = GenericListButtonBackground - - local Text = nil - - Text = LUI.UIStyledText.new() - Text.id = "Text" - Text:SetRGBFromInt( 14277081, 0 ) - Text:SetFontSize( 22 * _1080p ) - Text:SetFont( FONTS.GetFont( FONTS.MainMedium.File ) ) - Text:SetAlignment( LUI.Alignment.Left ) - Text:SetStartupDelay( 2000 ) - Text:SetLineHoldTime( 400 ) - Text:SetAnimMoveTime( 300 ) - Text:SetEndDelay( 1500 ) - Text:SetCrossfadeTime( 750 ) - Text:SetAutoScrollStyle( LUI.UIStyledText.AutoScrollStyle.ScrollH ) - Text:SetMaxVisibleLines( 1 ) - Text:SetOutlineRGBFromInt( 0, 0 ) - Text:SetAnchorsAndPosition( 0, 0, 0.5, 0.5, _1080p * 44, _1080p * -41, _1080p * -11, _1080p * 11 ) - Text:SubscribeToModelThroughElement( self, "buttonLabel", function () - local f10_local0 = self:GetDataSource() - f10_local0 = f10_local0.buttonLabel:GetValue( f8_local1 ) - if f10_local0 ~= nil then - Text:setText( LocalizeString( ToUpperCase( f10_local0 ) ), 0 ) - end - end ) - self:addElement( Text ) - self.Text = Text - - local Lock = nil - - Lock = LUI.UIImage.new() - Lock.id = "Lock" - Lock:SetRGBFromTable( SWATCHES.genericButton.textDisabled, 0 ) - Lock:SetAlpha( 0, 0 ) - Lock:setImage( RegisterMaterial( "icon_slot_locked" ), 0 ) - Lock:SetAnchorsAndPosition( 1, 0, 0.5, 0.5, _1080p * -32, _1080p * -6, _1080p * -12, _1080p * 14 ) - self:addElement( Lock ) - self.Lock = Lock - - self._animationSets.DefaultAnimationSet = function () - self._sequences.DefaultSequence = function () - - end - - Text:RegisterAnimationSequence( "ButtonOver", { - { - function () - return self.Text:SetRGBFromInt( 0, 0 ) - end - }, - { - function () - return self.Text:SetAlpha( 1, 0 ) - end - } - } ) - Lock:RegisterAnimationSequence( "ButtonOver", { - { - function () - return self.Lock:SetAlpha( 0, 0 ) - end - }, - { - function () - return self.Lock:SetRGBFromTable( SWATCHES.genericButton.textDisabled, 0 ) - end - } - } ) - self._sequences.ButtonOver = function () - Text:AnimateSequence( "ButtonOver" ) - Lock:AnimateSequence( "ButtonOver" ) - end - - Text:RegisterAnimationSequence( "ButtonUp", { - { - function () - return self.Text:SetRGBFromInt( 14277081, 0 ) - end - } - } ) - Lock:RegisterAnimationSequence( "ButtonUp", { - { - function () - return self.Lock:SetAlpha( 0, 0 ) - end - } - } ) - self._sequences.ButtonUp = function () - Text:AnimateSequence( "ButtonUp" ) - Lock:AnimateSequence( "ButtonUp" ) - end - - Text:RegisterAnimationSequence( "ButtonOverDisabled", { - { - function () - return self.Text:SetRGBFromInt( 0, 0 ) - end - }, - { - function () - return self.Text:SetAlpha( 1, 0 ) - end - } - } ) - Lock:RegisterAnimationSequence( "ButtonOverDisabled", { - { - function () - return self.Lock:SetAlpha( 1, 0 ) - end - }, - { - function () - return self.Lock:SetRGBFromInt( 0, 0 ) - end - } - } ) - self._sequences.ButtonOverDisabled = function () - Text:AnimateSequence( "ButtonOverDisabled" ) - Lock:AnimateSequence( "ButtonOverDisabled" ) - end - - Text:RegisterAnimationSequence( "ButtonUpDisabled", { - { - function () - return self.Text:SetRGBFromInt( 14277081, 0 ) - end - } - } ) - Lock:RegisterAnimationSequence( "ButtonUpDisabled", { - { - function () - return self.Lock:SetAlpha( 1, 0 ) - end - }, - { - function () - return self.Lock:SetRGBFromInt( 12566463, 0 ) - end - } - } ) - self._sequences.ButtonUpDisabled = function () - Text:AnimateSequence( "ButtonUpDisabled" ) - Lock:AnimateSequence( "ButtonUpDisabled" ) - end - - end - - self._animationSets.DefaultAnimationSet() - PostLoadFunc( self, f8_local1, controller ) - return self +function ModSelectButton(menu, controller) + local modSelectButton = LUI.UIButton.new() + modSelectButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 30 * _1080p) + modSelectButton.id = "ModSelectButton" + modSelectButton._animationSets = {} + modSelectButton._sequences = {} + + local controllerIndex = controller and controller.controllerIndex + if not controllerIndex and not Engine.InFrontend() then + controllerIndex = modSelectButton:getRootController() + end + assert(controllerIndex) + + local buttonContainer = modSelectButton + local genericButton = nil + + genericButton = MenuBuilder.BuildRegisteredType("GenericButton", { + controllerIndex = controllerIndex + }) + genericButton.id = "GenericButton" + genericButton:SetAlpha(0, 0) + genericButton:SetAnchorsAndPosition(0, 1, 0, 0, 0, _1080p * 500, 0, 0) + + genericButton:SubscribeToModelThroughElement(modSelectButton, "buttonLabel", function() + local dataSource = modSelectButton:GetDataSource() + local buttonLabel = dataSource.buttonLabel:GetValue(controllerIndex) + if buttonLabel ~= nil then + genericButton.Text:setText(LocalizeString(ToUpperCase(buttonLabel)), 0) + end + end) + + modSelectButton:addElement(genericButton) + modSelectButton.GenericButton = genericButton + + local listButtonBackground = nil + + listButtonBackground = MenuBuilder.BuildRegisteredType("GenericListArrowButtonBackground", { + controllerIndex = controllerIndex + }) + listButtonBackground.id = "GenericListButtonBackground" + listButtonBackground:SetAnchorsAndPosition(0, 0, 0, 0, 0, 0, 0, 0) + + modSelectButton:addElement(listButtonBackground) + modSelectButton.GenericListButtonBackground = listButtonBackground + + local buttonText = nil + + buttonText = LUI.UIStyledText.new() + buttonText.id = "Text" + buttonText:SetRGBFromInt(14277081, 0) + buttonText:SetFontSize(22 * _1080p) + buttonText:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) + buttonText:SetAlignment(LUI.Alignment.Left) + buttonText:SetStartupDelay(2000) + buttonText:SetLineHoldTime(400) + buttonText:SetAnimMoveTime(300) + buttonText:SetEndDelay(1500) + buttonText:SetCrossfadeTime(750) + buttonText:SetAutoScrollStyle(LUI.UIStyledText.AutoScrollStyle.ScrollH) + buttonText:SetMaxVisibleLines(1) + buttonText:SetOutlineRGBFromInt(0, 0) + buttonText:SetAnchorsAndPosition(0, 0, 0.5, 0.5, _1080p * 44, _1080p * -41, _1080p * -11, _1080p * 11) + + buttonText:SubscribeToModelThroughElement(modSelectButton, "buttonLabel", function() + local dataSource = modSelectButton:GetDataSource() + local buttonLabel = dataSource.buttonLabel:GetValue(controllerIndex) + if buttonLabel ~= nil then + buttonText:setText(LocalizeString(ToUpperCase(buttonLabel)), 0) + end + end) + + modSelectButton:addElement(buttonText) + modSelectButton.Text = buttonText + + local lockIcon = nil + + lockIcon = LUI.UIImage.new() + lockIcon.id = "Lock" + lockIcon:SetRGBFromTable(SWATCHES.genericButton.textDisabled, 0) + lockIcon:SetAlpha(0, 0) + lockIcon:setImage(RegisterMaterial("icon_slot_locked"), 0) + lockIcon:SetAnchorsAndPosition(1, 0, 0.5, 0.5, _1080p * -32, _1080p * -6, _1080p * -12, _1080p * 14) + + modSelectButton:addElement(lockIcon) + modSelectButton.Lock = lockIcon + + modSelectButton._animationSets.DefaultAnimationSet = function() + modSelectButton._sequences.DefaultSequence = function() + + end + + buttonText:RegisterAnimationSequence("ButtonOver", {{function() + return modSelectButton.Text:SetRGBFromInt(0, 0) + end}, {function() + return modSelectButton.Text:SetAlpha(1, 0) + end}}) + + lockIcon:RegisterAnimationSequence("ButtonOver", {{function() + return modSelectButton.Lock:SetAlpha(0, 0) + end}, {function() + return modSelectButton.Lock:SetRGBFromTable(SWATCHES.genericButton.textDisabled, 0) + end}}) + + modSelectButton._sequences.ButtonOver = function() + buttonText:AnimateSequence("ButtonOver") + lockIcon:AnimateSequence("ButtonOver") + end + + buttonText:RegisterAnimationSequence("ButtonUp", {{function() + return modSelectButton.Text:SetRGBFromInt(14277081, 0) + end}}) + + lockIcon:RegisterAnimationSequence("ButtonUp", {{function() + return modSelectButton.Lock:SetAlpha(0, 0) + end}}) + + modSelectButton._sequences.ButtonUp = function() + buttonText:AnimateSequence("ButtonUp") + lockIcon:AnimateSequence("ButtonUp") + end + + buttonText:RegisterAnimationSequence("ButtonOverDisabled", {{function() + return modSelectButton.Text:SetRGBFromInt(0, 0) + end}, {function() + return modSelectButton.Text:SetAlpha(1, 0) + end}}) + + lockIcon:RegisterAnimationSequence("ButtonOverDisabled", {{function() + return modSelectButton.Lock:SetAlpha(1, 0) + end}, {function() + return modSelectButton.Lock:SetRGBFromInt(0, 0) + end}}) + + modSelectButton._sequences.ButtonOverDisabled = function() + buttonText:AnimateSequence("ButtonOverDisabled") + lockIcon:AnimateSequence("ButtonOverDisabled") + end + + buttonText:RegisterAnimationSequence("ButtonUpDisabled", {{function() + return modSelectButton.Text:SetRGBFromInt(14277081, 0) + end}}) + + lockIcon:RegisterAnimationSequence("ButtonUpDisabled", {{function() + return modSelectButton.Lock:SetAlpha(1, 0) + end}, {function() + return modSelectButton.Lock:SetRGBFromInt(12566463, 0) + end}}) + + modSelectButton._sequences.ButtonUpDisabled = function() + buttonText:AnimateSequence("ButtonUpDisabled") + lockIcon:AnimateSequence("ButtonUpDisabled") + end + + end + + modSelectButton._animationSets.DefaultAnimationSet() + PostLoadFunc(modSelectButton, controllerIndex, controller) + return modSelectButton end -MenuBuilder.registerType( "ModSelectButton", ModSelectButton ) \ No newline at end of file +MenuBuilder.registerType("ModSelectButton", ModSelectButton) \ No newline at end of file diff --git a/data/cdata/ui_scripts/Mods/ModSelectMenu.lua b/data/cdata/ui_scripts/Mods/ModSelectMenu.lua index 20be3f40..5ebdbfd6 100644 --- a/data/cdata/ui_scripts/Mods/ModSelectMenu.lua +++ b/data/cdata/ui_scripts/Mods/ModSelectMenu.lua @@ -1,317 +1,316 @@ -local f0_local0 = "frontEnd.ModSelect" -f0_local1 = function () - WipeGlobalModelsAtPath( f0_local0 ) +local modSelectPath = "frontEnd.ModSelect" + +modSelectPathCleanup = function() + WipeGlobalModelsAtPath(modSelectPath) end -local function getmodname(path) - local name = path - local desc = Engine.Localize("LUA_MENU_MOD_DESC_DEFAULT", name) +local function getModName(path) + local modName = path + local modDesc = Engine.Localize("LUA_MENU_MOD_DESC_DEFAULT", modName) - return name, desc + return modName, modDesc end -local function set_mod( modname ) - Engine.SetDvarString( "fs_game", modname ) - Engine.Exec( "vid_restart" ) +local function setMod(modName) + Engine.SetDvarString("fs_game", modName) + Engine.Exec("vid_restart") end -local unload_mod = function( arg0, arg1 ) - set_mod( "" ) +local unloadMod = function(buttonElement, controllerIndex) + setMod("") end -local f0_local4 = function ( f4_arg0, f4_arg1 ) - LUI.FlowManager.RequestLeaveMenu( f4_arg0 ) +local leaveMenu = function(menuElement, controllerIndex) + LUI.FlowManager.RequestLeaveMenu(menuElement) end -local f0_local8 = function ( f8_arg0, f8_arg1 ) - local f8_local0 = LUI.FlowManager.GetScopedData( f8_arg0 ) - if not f8_local0.currentLabel then - f8_local0.currentLabel = "" - end - if not f8_local0.currentDesc then - f8_local0.currentDesc = "" - end - f8_arg0:processEvent( { - name = "menu_refresh" - } ) - local f8_local2 = f8_arg0:GetCurrentMenu() - assert( f8_local2.ModInfoTitle ) - f8_local2.ModInfoTitle:setText( f8_local0.currentLabel ) - assert( f8_local2.ModInfoText ) - f8_local2.ModInfoText:setText( f8_local0.currentDesc ) +local updateModInfo = function(menuElement, controllerIndex) + local scopedData = LUI.FlowManager.GetScopedData(menuElement) + if not scopedData.currentLabel then + scopedData.currentLabel = "" + end + if not scopedData.currentDesc then + scopedData.currentDesc = "" + end + menuElement:processEvent({ + name = "menu_refresh" + }) + local currentMenu = menuElement:GetCurrentMenu() + assert(currentMenu.ModInfoTitle) + currentMenu.ModInfoTitle:setText(scopedData.currentLabel) + assert(currentMenu.ModInfoText) + currentMenu.ModInfoText:setText(scopedData.currentDesc) end -local f0_local9 = function ( f9_arg0, f9_arg1, f9_arg2 ) - set_mod( f9_arg2 ) +local applyMod = function(buttonElement, controllerIndex, modName) + setMod(modName) end -local f0_local10 = function ( f11_arg0, f11_arg1, f11_arg2 ) - local f11_local0 = LUI.FlowManager.GetScopedData( f11_arg0 ) - f11_local0.currentLabel = f11_arg2.buttonLabel - f11_local0.currentName = f11_arg2.modName - f11_local0.currentDesc = f11_arg2.objectiveText - f0_local8( f11_arg0, f11_arg1 ) - Engine.PlaySound( CoD.SFX.SPMinimap ) +local updateModSelection = function(menuElement, controllerIndex, modData) + local scopedData = LUI.FlowManager.GetScopedData(menuElement) + scopedData.currentLabel = modData.buttonLabel + scopedData.currentName = modData.modName + scopedData.currentDesc = modData.objectiveText + updateModInfo(menuElement, controllerIndex) + Engine.PlaySound(CoD.SFX.SPMinimap) end -local f0_local12 = function ( f13_arg0, f13_arg1 ) - local f13_local0 = {} +local populateModList = function(menuElement, controllerIndex) + local modList = {} local mods = io.listfiles("mods/") - for i = 1, #mods do - local name, desc = getmodname(mods[i]) - f13_local0[#f13_local0 + 1] = { + for i = 1, #mods do + local name, desc = getModName(mods[i]) + modList[#modList + 1] = { buttonLabel = ToUpperCase(name), modName = name, - objectiveText = desc, + objectiveText = desc } - end - local f13_local1 = LUI.DataSourceFromList.new( #f13_local0 ) - f13_local1.MakeDataSourceAtIndex = function ( f14_arg0, f14_arg1, f14_arg2 ) - return { - buttonLabel = LUI.DataSourceInGlobalModel.new( f0_local0 .. ".mods." .. f14_arg1, f13_local0[f14_arg1 + 1].buttonLabel ), - buttonOnClickFunction = function ( f15_arg0, f15_arg1 ) - f0_local9( f15_arg0, f15_arg1, f13_local0[f14_arg1 + 1].modName ) - end - , - buttonOnHoverFunction = function ( f16_arg0, f16_arg1 ) - f0_local10( f16_arg0, f16_arg1, f13_local0[f14_arg1 + 1] ) - end - , - modName = f13_local0[f14_arg1 + 1].modName - } - end + end + local dataSource = LUI.DataSourceFromList.new(#modList) + dataSource.MakeDataSourceAtIndex = function(dataSource, index, controllerIndex) + return { + buttonLabel = LUI.DataSourceInGlobalModel.new(modSelectPath .. ".mods." .. index, + modList[index + 1].buttonLabel), + buttonOnClickFunction = function(buttonElement, controllerIndex) + applyMod(buttonElement, controllerIndex, modList[index + 1].modName) + end, + buttonOnHoverFunction = function(buttonElement, controllerIndex) + updateModSelection(buttonElement, controllerIndex, modList[index + 1]) + end, + modName = modList[index + 1].modName + } + end - assert( f13_arg0.ModSelectionList ) - f13_arg0.ModSelectionList:SetGridDataSource( f13_local1, f13_arg1 ) + assert(menuElement.ModSelectionList) + menuElement.ModSelectionList:SetGridDataSource(dataSource, controllerIndex) end -local function PostLoadFunc( f17_arg0, f17_arg1, f17_arg2 ) - assert( f17_arg0.bindButton ) - f17_arg0.bindButton:addEventHandler( "button_secondary", f0_local4 ) +local function postLoadFunction(menuElement, controllerIndex, controller) + assert(menuElement.bindButton) + menuElement.bindButton:addEventHandler("button_secondary", leaveMenu) - local fs_game = Engine.GetDvarString( "fs_game" ) - if fs_game ~= "" then - f17_arg0.LoadedModName:setText( "^3Loaded mod^7: " .. fs_game ) - f17_arg0.bindButton:addEventHandler( "button_alt2", unload_mod ) - else - f17_arg0.LoadedModName:setText( "" ) - end + local fsGame = Engine.GetDvarString("fs_game") + if fsGame ~= "" then + menuElement.LoadedModName:setText("^3Loaded mod^7: " .. fsGame) + menuElement.bindButton:addEventHandler("button_alt2", unloadMod) + else + menuElement.LoadedModName:setText("") + end - --f17_arg0:addEventHandler( "menu_create", f0_local3 ) - f0_local12( f17_arg0, f17_arg1 ) - f17_arg0:addEventHandler( "gain_focus", function ( f18_arg0, f18_arg1 ) - local f18_local0 = f18_arg0.ModSelectionList - local f18_local1 = f18_local0:GetContentOffset( LUI.DIRECTION.vertical ) - f18_local0:SetFocusedPosition( { - x = 0, - y = f18_local1 - }, true ) - local f18_local2 = f18_local0:GetElementAtPosition( 0, f18_local1 ) - if f18_local2 then - f18_local2:processEvent( { - name = "gain_focus", - controllerIndex = f17_arg1 - } ) - end - end ) + -- menuElement:addEventHandler("menu_create", f0_local3) + populateModList(menuElement, controllerIndex) + menuElement:addEventHandler("gain_focus", function(focusElement, controllerIndex) + local modSelectionList = focusElement.ModSelectionList + local contentOffset = modSelectionList:GetContentOffset(LUI.DIRECTION.vertical) + modSelectionList:SetFocusedPosition({ + x = 0, + y = contentOffset + }, true) + local focusedElement = modSelectionList:GetElementAtPosition(0, contentOffset) + if focusedElement then + focusedElement:processEvent({ + name = "gain_focus", + controllerIndex = controllerIndex + }) + end + end) end -function ModSelectMenu( menu, controller ) - local self = LUI.UIElement.new() - self.id = "ModSelectMenu" +function ModSelectMenu(menu, controller) + local menuElement = LUI.UIElement.new() + menuElement.id = "ModSelectMenu" - local f20_local1 = controller and controller.controllerIndex - if not f20_local1 and not Engine.InFrontend() then - f20_local1 = self:getRootController() - end - assert( f20_local1 ) + local controllerIndex = controller and controller.controllerIndex + if not controllerIndex and not Engine.InFrontend() then + controllerIndex = menuElement:getRootController() + end + assert(controllerIndex) - self:playSound( "menu_open" ) + menuElement:playSound("menu_open") - if Engine.IsSingleplayer() then - local Background = nil - - Background = LUI.UIImage.new() - Background.id = "Background" - Background:setImage( RegisterMaterial( "sp_frontend_bink_background" ), 0 ) - self:addElement( Background ) - self.Background = Background - - local Bink = nil - - Bink = LUI.UIImage.new() - Bink.id = "Bink" - Bink:setImage( RegisterMaterial( "cinematic" ), 0 ) - self:addElement( Bink ) - self.Bink = Bink - end + if Engine.IsSingleplayer() then + local backgroundImage = nil - local ButtonHelperBar = nil - - ButtonHelperBar = MenuBuilder.BuildRegisteredType( "ButtonHelperBar", { - controllerIndex = f61_local1 - } ) - ButtonHelperBar.id = "ButtonHelperBar" - ButtonHelperBar:SetAnchorsAndPosition( 0, 0, 1, 0, 0, 0, _1080p * -85, 0 ) - self:addElement( ButtonHelperBar ) - self.ButtonHelperBar = ButtonHelperBar + backgroundImage = LUI.UIImage.new() + backgroundImage.id = "Background" + backgroundImage:setImage(RegisterMaterial("sp_frontend_bink_background"), 0) + menuElement:addElement(backgroundImage) + menuElement.Background = backgroundImage - MenuTitle = MenuBuilder.BuildRegisteredType( "MenuTitle", { - controllerIndex = f61_local1 - } ) - MenuTitle.id = "MenuTitle" - MenuTitle.MenuTitle:setText( ToUpperCase( Engine.Localize( "LUA_MENU_MODS" ) ), 0 ) - --MenuTitle.MenuTitle:setText( ToUpperCase( "Mods" ), 0 ) - MenuTitle.MenuBreadcrumbs:setText( ToUpperCase( "" ), 0 ) - MenuTitle.Icon:SetTop( _1080p * -28.5, 0 ) - MenuTitle.Icon:SetBottom( _1080p * 61.5, 0 ) - MenuTitle:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 96, _1080p * 1056, _1080p * 54, _1080p * 134 ) - self:addElement( MenuTitle ) - self.MenuTitle = MenuTitle + local binkImage = nil - local ModInfoTitle = nil - - ModInfoTitle = LUI.UIStyledText.new() - ModInfoTitle.id = "ModInfoTitle" - ModInfoTitle:setText( "", 0 ) - ModInfoTitle:SetFontSize( 30 * _1080p ) - ModInfoTitle:SetFont( FONTS.GetFont( FONTS.MainMedium.File ) ) - ModInfoTitle:SetAlignment( LUI.Alignment.Left ) - ModInfoTitle:SetStartupDelay( 2000 ) - ModInfoTitle:SetLineHoldTime( 400 ) - ModInfoTitle:SetAnimMoveTime( 300 ) - ModInfoTitle:SetEndDelay( 1500 ) - ModInfoTitle:SetCrossfadeTime( 750 ) - ModInfoTitle:SetAutoScrollStyle( LUI.UIStyledText.AutoScrollStyle.ScrollH ) - ModInfoTitle:SetMaxVisibleLines( 1 ) - ModInfoTitle:SetDecodeLetterLength( 15 ) - ModInfoTitle:SetDecodeMaxRandChars( 6 ) - ModInfoTitle:SetDecodeUpdatesPerLetter( 4 ) - ModInfoTitle:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 1254, _1080p * 1824, _1080p * 216, _1080p * 246 ) - self:addElement( ModInfoTitle ) - self.ModInfoTitle = ModInfoTitle - - local ModInfoText = nil - - ModInfoText = LUI.UIStyledText.new() - ModInfoText.id = "ModInfoText" - ModInfoText:setText( "", 0 ) - ModInfoText:SetFontSize( 20 * _1080p ) - ModInfoText:SetFont( FONTS.GetFont( FONTS.MainCondensed.File ) ) - ModInfoText:SetAlignment( LUI.Alignment.Left ) - ModInfoText:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 1254, _1080p * 1824, _1080p * 248, _1080p * 268 ) - self:addElement( ModInfoText ) - self.ModInfoText = ModInfoText + binkImage = LUI.UIImage.new() + binkImage.id = "Bink" + binkImage:setImage(RegisterMaterial("cinematic"), 0) + menuElement:addElement(binkImage) + menuElement.Bink = binkImage + end - local ModSelectionList = nil - - ModSelectionList = LUI.UIDataSourceGrid.new( nil, { - maxVisibleColumns = 1, - maxVisibleRows = 17, - controllerIndex = f20_local1, - buildChild = function () - return MenuBuilder.BuildRegisteredType( "ModSelectButton", { - controllerIndex = f20_local1 - } ) - end, - wrapX = true, - wrapY = true, - spacingX = _1080p * 10, - spacingY = _1080p * 10, - columnWidth = _1080p * 500, - rowHeight = _1080p * 30, - scrollingThresholdX = 1, - scrollingThresholdY = 1, - adjustSizeToContent = false, - horizontalAlignment = LUI.Alignment.Left, - verticalAlignment = LUI.Alignment.Top, - springCoefficient = 600, - maxVelocity = 5000 - } ) - ModSelectionList.id = "ModSelectionList" - ModSelectionList:setUseStencil( false ) - ModSelectionList:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 216, _1080p * 886 ) - self:addElement( ModSelectionList ) - self.ModSelectionList = ModSelectionList + local buttonHelperBar = nil - local ArrowUp = nil - - ArrowUp = MenuBuilder.BuildRegisteredType( "ArrowUp", { - controllerIndex = f20_local1 - } ) - ArrowUp.id = "ArrowUp" - ArrowUp:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 452.5, _1080p * 472.5, _1080p * 887, _1080p * 927 ) - self:addElement( ArrowUp ) - self.ArrowUp = ArrowUp - - local ArrowDown = nil - - ArrowDown = MenuBuilder.BuildRegisteredType( "ArrowDown", { - controllerIndex = f20_local1 - } ) - ArrowDown.id = "ArrowDown" - ArrowDown:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 287.5, _1080p * 307.5, _1080p * 886, _1080p * 926 ) - self:addElement( ArrowDown ) - self.ArrowDown = ArrowDown - - local ListCount = nil - - ListCount = LUI.UIText.new() - ListCount.id = "ListCount" - ListCount:setText( "1/15", 0 ) - ListCount:SetFontSize( 24 * _1080p ) - ListCount:SetFont( FONTS.GetFont( FONTS.MainMedium.File ) ) - ListCount:SetAlignment( LUI.Alignment.Center ) - ListCount:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 307.5, _1080p * 452.5, _1080p * 894, _1080p * 918 ) - self:addElement( ListCount ) - self.ListCount = ListCount + buttonHelperBar = MenuBuilder.BuildRegisteredType("ButtonHelperBar", { + controllerIndex = controllerIndex + }) + buttonHelperBar.id = "ButtonHelperBar" + buttonHelperBar:SetAnchorsAndPosition(0, 0, 1, 0, 0, 0, _1080p * -85, 0) + menuElement:addElement(buttonHelperBar) + menuElement.ButtonHelperBar = buttonHelperBar - local LoadedModName = nil - - LoadedModName = LUI.UIText.new() - LoadedModName.id = "LoadedModName" - LoadedModName:setText( "LOADED MOD NAME", 0 ) - LoadedModName:SetFontSize( 20 * _1080p ) - LoadedModName:SetFont( FONTS.GetFont( FONTS.MainBold.File ) ) - LoadedModName:SetAlignment( LUI.Alignment.Left ) - LoadedModName:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 942, _1080p * 966 ) - self:addElement( LoadedModName ) - self.LoadedModName = LoadedModName + local menuTitle = MenuBuilder.BuildRegisteredType("MenuTitle", { + controllerIndex = controllerIndex + }) + menuTitle.id = "MenuTitle" + menuTitle.MenuTitle:setText(ToUpperCase(Engine.Localize("LUA_MENU_MODS")), 0) + menuTitle.MenuBreadcrumbs:setText(ToUpperCase(""), 0) + menuTitle.Icon:SetTop(_1080p * -28.5, 0) + menuTitle.Icon:SetBottom(_1080p * 61.5, 0) + menuTitle:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 96, _1080p * 1056, _1080p * 54, _1080p * 134) + menuElement:addElement(menuTitle) + menuElement.MenuTitle = menuTitle - ModSelectionList:AddArrow( ArrowUp ) - ModSelectionList:AddArrow( ArrowDown ) - ModSelectionList:AddItemNumbers( ListCount ) + local modInfoTitle = nil - self.addButtonHelperFunction = function ( arg0, arg1 ) - arg0:AddButtonHelperText( { - helper_text = Engine.Localize( "MENU_BACK" ), - button_ref = "button_secondary", - side = "left", - clickable = true - } ) - local fs_game = Engine.GetDvarString( "fs_game" ) - if fs_game ~= "" then - arg0:AddButtonHelperText( { - helper_text = Engine.Localize( "LUA_MENU_UNLOAD" ), - button_ref = "button_alt2", - side = "left", - clickable = true - } ) - end - end - - self:addEventHandler( "menu_create", self.addButtonHelperFunction ) + modInfoTitle = LUI.UIStyledText.new() + modInfoTitle.id = "ModInfoTitle" + modInfoTitle:setText("", 0) + modInfoTitle:SetFontSize(30 * _1080p) + modInfoTitle:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) + modInfoTitle:SetAlignment(LUI.Alignment.Left) + modInfoTitle:SetStartupDelay(2000) + modInfoTitle:SetLineHoldTime(400) + modInfoTitle:SetAnimMoveTime(300) + modInfoTitle:SetEndDelay(1500) + modInfoTitle:SetCrossfadeTime(750) + modInfoTitle:SetAutoScrollStyle(LUI.UIStyledText.AutoScrollStyle.ScrollH) + modInfoTitle:SetMaxVisibleLines(1) + modInfoTitle:SetDecodeLetterLength(15) + modInfoTitle:SetDecodeMaxRandChars(6) + modInfoTitle:SetDecodeUpdatesPerLetter(4) + modInfoTitle:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 1254, _1080p * 1824, _1080p * 216, _1080p * 246) + menuElement:addElement(modInfoTitle) + menuElement.ModInfoTitle = modInfoTitle + + local modInfoText = nil + + modInfoText = LUI.UIStyledText.new() + modInfoText.id = "ModInfoText" + modInfoText:setText("", 0) + modInfoText:SetFontSize(20 * _1080p) + modInfoText:SetFont(FONTS.GetFont(FONTS.MainCondensed.File)) + modInfoText:SetAlignment(LUI.Alignment.Left) + modInfoText:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 1254, _1080p * 1824, _1080p * 248, _1080p * 268) + menuElement:addElement(modInfoText) + menuElement.ModInfoText = modInfoText + + local modSelectionList = nil + + modSelectionList = LUI.UIDataSourceGrid.new(nil, { + maxVisibleColumns = 1, + maxVisibleRows = 17, + controllerIndex = controllerIndex, + buildChild = function() + return MenuBuilder.BuildRegisteredType("ModSelectButton", { + controllerIndex = controllerIndex + }) + end, + wrapX = true, + wrapY = true, + spacingX = _1080p * 10, + spacingY = _1080p * 10, + columnWidth = _1080p * 500, + rowHeight = _1080p * 30, + scrollingThresholdX = 1, + scrollingThresholdY = 1, + adjustSizeToContent = false, + horizontalAlignment = LUI.Alignment.Left, + verticalAlignment = LUI.Alignment.Top, + springCoefficient = 600, + maxVelocity = 5000 + }) + modSelectionList.id = "ModSelectionList" + modSelectionList:setUseStencil(false) + modSelectionList:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 216, _1080p * 886) + menuElement:addElement(modSelectionList) + menuElement.ModSelectionList = modSelectionList + + local arrowUp = nil + + arrowUp = MenuBuilder.BuildRegisteredType("ArrowUp", { + controllerIndex = controllerIndex + }) + arrowUp.id = "ArrowUp" + arrowUp:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 452.5, _1080p * 472.5, _1080p * 887, _1080p * 927) + menuElement:addElement(arrowUp) + menuElement.ArrowUp = arrowUp + + local arrowDown = nil + + arrowDown = MenuBuilder.BuildRegisteredType("ArrowDown", { + controllerIndex = controllerIndex + }) + arrowDown.id = "ArrowDown" + arrowDown:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 287.5, _1080p * 307.5, _1080p * 886, _1080p * 926) + menuElement:addElement(arrowDown) + menuElement.ArrowDown = arrowDown + + local listCount = nil + + listCount = LUI.UIText.new() + listCount.id = "ListCount" + listCount:setText("1/15", 0) + listCount:SetFontSize(24 * _1080p) + listCount:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) + listCount:SetAlignment(LUI.Alignment.Center) + listCount:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 307.5, _1080p * 452.5, _1080p * 894, _1080p * 918) + menuElement:addElement(listCount) + menuElement.ListCount = listCount + + local loadedModName = nil + + loadedModName = LUI.UIText.new() + loadedModName.id = "LoadedModName" + loadedModName:setText("LOADED MOD NAME", 0) + loadedModName:SetFontSize(20 * _1080p) + loadedModName:SetFont(FONTS.GetFont(FONTS.MainBold.File)) + loadedModName:SetAlignment(LUI.Alignment.Left) + loadedModName:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 942, _1080p * 966) + menuElement:addElement(loadedModName) + menuElement.LoadedModName = loadedModName + + modSelectionList:AddArrow(arrowUp) + modSelectionList:AddArrow(arrowDown) + modSelectionList:AddItemNumbers(listCount) + + menuElement.addButtonHelperFunction = function(arg0, arg1) + arg0:AddButtonHelperText({ + helper_text = Engine.Localize("MENU_BACK"), + button_ref = "button_secondary", + side = "left", + clickable = true + }) + local fsGame = Engine.GetDvarString("fs_game") + if fsGame ~= "" then + arg0:AddButtonHelperText({ + helper_text = Engine.Localize("LUA_MENU_UNLOAD"), + button_ref = "button_alt2", + side = "left", + clickable = true + }) + end + end + + menuElement:addEventHandler("menu_create", menuElement.addButtonHelperFunction) local bindButton = LUI.UIBindButton.new() - bindButton.id = "selfBindButton" - self:addElement( bindButton ) - self.bindButton = bindButton + bindButton.id = "selfBindButton" + menuElement:addElement(bindButton) + menuElement.bindButton = bindButton - PostLoadFunc( self, f20_local1, controller ) + postLoadFunction(menuElement, controllerIndex, controller) - return self + return menuElement end -MenuBuilder.registerType( "ModSelectMenu", ModSelectMenu ) -LUI.FlowManager.RegisterStackPushBehaviour( "ModSelectMenu", PushFunc ) -LUI.FlowManager.RegisterStackPopBehaviour( "ModSelectMenu", f0_local1 ) \ No newline at end of file +MenuBuilder.registerType("ModSelectMenu", ModSelectMenu) +LUI.FlowManager.RegisterStackPushBehaviour("ModSelectMenu", PushFunc) +LUI.FlowManager.RegisterStackPopBehaviour("ModSelectMenu", modSelectPathCleanup) \ No newline at end of file diff --git a/data/cdata/ui_scripts/Mods/__init__.lua b/data/cdata/ui_scripts/Mods/__init__.lua index 495f7c52..8fa17032 100644 --- a/data/cdata/ui_scripts/Mods/__init__.lua +++ b/data/cdata/ui_scripts/Mods/__init__.lua @@ -1,6 +1,6 @@ -require( "ModSelectButton" ) -require( "ModSelectMenu" ) +require("ModSelectButton") +require("ModSelectMenu") if (Engine.InFrontend()) then require("ModDownload") -end \ No newline at end of file +end diff --git a/data/cdata/ui_scripts/SystemLinkMenu/ServerButtons.lua b/data/cdata/ui_scripts/SystemLinkMenu/ServerButtons.lua index 905303be..f206b67f 100644 --- a/data/cdata/ui_scripts/SystemLinkMenu/ServerButtons.lua +++ b/data/cdata/ui_scripts/SystemLinkMenu/ServerButtons.lua @@ -1,70 +1,66 @@ -function SystemLinkMenuButtons( menu, controller ) - local self = LUI.UIVerticalList.new() - self:SetAnchorsAndPosition( 0, 1, 0, 1, 0, 500 * _1080p, 0, 300 * _1080p ) - self.id = "SystemLinkMenuButtons" - local f1_local1 = controller and controller.controllerIndex - if not f1_local1 and not Engine.InFrontend() then - f1_local1 = self:getRootController() - end - assert( f1_local1 ) - local f1_local2 = self - self:SetSpacing( 10 * _1080p ) +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) - local f1_local5 = nil - if CONDITIONS.IsCoreMultiplayer( self ) then - f1_local5 = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f1_local1 - } ) - f1_local5.id = "CASButton" - if CONDITIONS.IsCoreMultiplayer( self ) then - - else - - end - if CONDITIONS.IsCoreMultiplayer( self ) then - f1_local5.buttonDescription = Engine.Localize( "LUA_MENU_DESC_CREATE_A_CLASS" ) - end - f1_local5.Text:setText( ToUpperCase( Engine.Localize( "LUA_MENU_CREATE_A_CLASS" ) ), 0 ) - f1_local5:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, _1080p * 80, _1080p * 110 ) - self:addElement( f1_local5 ) - self.CASButton = f1_local5 - end - local f1_local6 = nil - if CONDITIONS.IsThirdGameMode( self ) then - f1_local6 = MenuBuilder.BuildRegisteredType( "MenuButton", { - controllerIndex = f1_local1 - } ) - f1_local6.id = "LoadoutButton" - if CONDITIONS.IsThirdGameMode( self ) then - - else - - end - if CONDITIONS.IsThirdGameMode( self ) then - f1_local6.buttonDescription = Engine.Localize( "LUA_MENU_ZM_LOADOUT_DESC" ) - end - f1_local6.Text:setText( ToUpperCase( Engine.Localize( "LUA_MENU_ZM_LOADOUT_CAPS" ) ), 0 ) - f1_local6:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, _1080p * 120, _1080p * 150 ) - self:addElement( f1_local6 ) - self.LoadoutButton = f1_local6 - end + local casButton = nil + if CONDITIONS.IsCoreMultiplayer(SystemLinkMenuButtons) then + casButton = MenuBuilder.BuildRegisteredType("MenuButton", { + controllerIndex = controllerIndex + }) + casButton.id = "CASButton" + + if CONDITIONS.IsCoreMultiplayer(SystemLinkMenuButtons) then + casButton.buttonDescription = Engine.Localize("LUA_MENU_DESC_CREATE_A_CLASS") + end + + 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 + 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 + if CONDITIONS.IsCoreMultiplayer(SystemLinkMenuButtons) then + casButton:addEventHandler("button_action", function(button, event) + 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 + loadoutButton:addEventHandler("button_action", function(button, event) + ACTIONS.OpenMenu("CPLoadoutMenu", true, event.controller or controllerIndex) + end) + end - if CONDITIONS.IsCoreMultiplayer( self ) then - f1_local5:addEventHandler( "button_action", function ( f2_arg0, f2_arg1 ) - local f2_local0 = f2_arg1.controller or f1_local1 - ClientWeapon.SetWeaponVisible( 0, true ) - ClientCharacter.SetCharacterVisible( 0, true ) - ACTIONS.OpenCreateAClass( self, f2_arg1 ) - end ) - end - if CONDITIONS.IsThirdGameMode( self ) then - f1_local6:addEventHandler( "button_action", function ( f3_arg0, f3_arg1 ) - ACTIONS.OpenMenu( "CPLoadoutMenu", true, f3_arg1.controller or f1_local1 ) - end ) - end - - return self + return SystemLinkMenuButtons end MenuBuilder.m_types["SystemLinkMenuButtons"] = SystemLinkMenuButtons \ No newline at end of file diff --git a/data/cdata/ui_scripts/SystemLinkMenu/SysLinkBrowser.lua b/data/cdata/ui_scripts/SystemLinkMenu/SysLinkBrowser.lua index 14b3b428..aee68438 100644 --- a/data/cdata/ui_scripts/SystemLinkMenu/SysLinkBrowser.lua +++ b/data/cdata/ui_scripts/SystemLinkMenu/SysLinkBrowser.lua @@ -1,832 +1,696 @@ -local f0_local0 = "frontEnd.systemLinkMenu.serverBrowser" -serverBrowserOffsets = { - 10, - 240, - 360, - 450 -} +local serverBrowserPath = "frontEnd.systemLinkMenu.serverBrowser" +local serverBrowserOffsets = {10, 240, 360, 450} -local f0_local4 = function ( f5_arg0, f5_arg1 ) - --Engine.StopGameMode() - LUI.FlowManager.RequestLeaveMenu( f5_arg0, true ) +local leaveMenuHandler = function(menu, controller) + -- Engine.StopGameMode() + LUI.FlowManager.RequestLeaveMenu(menu, true) end -local f0_local6 = nil -f0_local6 = function ( menu, controller, index ) - local f9_local0 = menu:Wait( 250 ) - f9_local0.onComplete = function () - return f0_local6( menu, controller ) - end - - Lobby.UpdateServerDisplayList( controller ) - Lobby.CreateServersDataModels( controller ) +local updateServerDisplayListAndCreateModels + +updateServerDisplayListAndCreateModels = function(menu, controller, index) + local waitDuration = menu:Wait(250) + waitDuration.onComplete = function() + return updateServerDisplayListAndCreateModels(menu, controller) + end + + Lobby.UpdateServerDisplayList(controller) + Lobby.CreateServersDataModels(controller) end -local f0_local7 = function ( f11_arg0, f11_arg1, f11_arg2 ) +local setupSystemLinkMenu = function(menu, controller, index) + assert(menu.ServerBrowser) + assert(menu.ServerBrowser.ServerList) + menu:setPriority(-1) + menu.isSignInMenu = true + local isAliensMode = Engine.IsAliensMode() - assert( f11_arg0.ServerBrowser ) - assert( f11_arg0.ServerBrowser.ServerList ) - f11_arg0:setPriority( -1 ) - f11_arg0.isSignInMenu = true - local f11_local0 = Engine.IsAliensMode() - if f11_local0 then - Engine.SetFrontEndSceneSection( "zm_main", 1 ) - end + if isAliensMode then + Engine.SetFrontEndSceneSection("zm_main", 1) + else + menu.MenuTitle.MenuBreadcrumbs:setText(ToUpperCase( + Engine.Localize("LUA_MENU_BREADCRUMB_2_ITEMS", "IW7-Mod", "MULTIPLAYER")), 0) + end - if not f11_local0 then - f11_arg0.MenuTitle.MenuBreadcrumbs:setText( ToUpperCase( Engine.Localize( "LUA_MENU_BREADCRUMB_2_ITEMS", "IW7-Mod", "MULTIPLAYER" ) ), 0 ) - end + menu.addButtonHelperFunction = function(helperMenu, helperController) + menu:AddButtonHelperText({ + helper_text = Engine.Localize("MENU_SB_TOOLTIP_BTN_REFRESH"), + button_ref = "button_alt1", + side = "left", + priority = 2, + clickable = true + }) + end - f11_arg0.addButtonHelperFunction = function ( f12_arg0, f12_arg1 ) - f11_arg0:AddButtonHelperText( { - helper_text = Engine.Localize( "MENU_SB_TOOLTIP_BTN_REFRESH" ), - button_ref = "button_alt1", - side = "left", - priority = 2, - clickable = true - } ) - end - - f11_arg0:addEventHandler( "menu_create", f11_arg0.addButtonHelperFunction ) - - assert( Engine.IsUserSignedIn( f11_arg1 ) ) - if f11_local0 then - Engine.ExecNow( CPConfig.default_systemlink, f11_arg1 ) - else - Engine.ExecNow( MPConfig.default_systemlink, f11_arg1 ) - end + menu:addEventHandler("menu_create", menu.addButtonHelperFunction) - Engine.Exec( MPConfig.default_dvars ) + assert(Engine.IsUserSignedIn(controller)) + if isAliensMode then + Engine.ExecNow(CPConfig.default_systemlink, controller) + else + Engine.ExecNow(MPConfig.default_systemlink, controller) + end - f11_arg0:addEventHandler( "menu_create", function ( f13_arg0, f13_arg1 ) + Engine.Exec(MPConfig.default_dvars) - assert( f11_arg0.bindButton ) + menu:addEventHandler("menu_create", function(menuHandler, eventHandler) + assert(menu.bindButton) - if CONDITIONS.IsThirdGameMode( f11_arg0 ) then - ACTIONS.AnimateSequence( f11_arg0, "DisplayServerBrowser" ) + if CONDITIONS.IsThirdGameMode(menu) then + ACTIONS.AnimateSequence(menu, "DisplayServerBrowser") end - f11_arg0.bindButton:addEventHandler( "button_secondary", function ( f14_arg0, f14_arg1 ) - local f14_local0 = LUI.FlowManager.GetScopedData( f11_arg0 ) - if f14_local0.serverBrowserFocused then - f14_local0.serverBrowserFocused = false - ACTIONS.LoseFocus( f11_arg0, "ServerBrowser", f11_arg1 ) - ACTIONS.GainFocus( f11_arg0.SystemLinkMenuButtons, "JoinGameButton", f11_arg1 ) - else - f0_local4( f14_arg0, f14_arg1 ) - end - end ) + menu.bindButton:addEventHandler("button_secondary", function(buttonHandler, buttonEvent) + local scopedData = LUI.FlowManager.GetScopedData(menu) + if scopedData.serverBrowserFocused then + scopedData.serverBrowserFocused = false + ACTIONS.LoseFocus(menu, "ServerBrowser", controller) + ACTIONS.GainFocus(menu.SystemLinkMenuButtons, "JoinGameButton", controller) + else + leaveMenuHandler(buttonHandler, buttonEvent) + end + end) - f11_arg0.bindButton:addEventHandler( "button_alt1", function ( f15_arg0, f15_arg1 ) - Lobby.RefreshServerList( f11_arg1 ) - ACTIONS.PlaySoundSetSound( f11_arg0, "selectAlt", false ) - end ) - end ) - f11_arg0.SystemLinkMenuButtons:addEventHandler( "gain_focus", function ( f16_arg0, f16_arg1 ) - local f16_local0 = LUI.FlowManager.GetScopedData( f11_arg0 ) - if f16_local0.serverBrowserFocused then - f16_local0.serverBrowserFocused = false - ACTIONS.LoseFocus( f11_arg0, "ServerBrowser", f11_arg1 ) - if CONDITIONS.IsThirdGameMode( f11_arg0 ) then - ACTIONS.AnimateSequence( f11_arg0, "DisplayServerBrowser" ) - f11_arg0:RemoveButtonHelperText( "button_alt1", "left" ) - end - end - end ) - - Engine.PLMRefreshData() - if Engine.IsCoreMode() then - ClientWeapon.SetWeaponVisible( 0, false ) - ClientCharacter.SetCharacterVisible( 0, false ) - end - Lobby.SetPartyUIRoot( PartyUIRoot.SYSTEM_LINK ) - local f11_local1 = LUI.FlowManager.GetScopedData( f11_arg0 ) - if f11_local1.optionsMenuOpened then - f11_local1.optionsMenuOpened = nil - if f11_local1.serverBrowserFocused then - f11_local1.serverBrowserFocused = false - f11_arg0:clearSavedState() - if f11_local0 then - LUI.FlowManager.ClearSavedMenuState( "CPSystemLinkMenu" ) - else - LUI.FlowManager.ClearSavedMenuState( "MPSystemLinkMenu" ) - end - end - else - f11_local1.serverBrowserFocused = false - end - Lobby.BuildServerList( f11_arg1 ) - Lobby.RefreshServerList( f11_arg1 ) + menu.bindButton:addEventHandler("button_alt1", function(buttonHandler, buttonEvent) + Lobby.RefreshServerList(controller) + ACTIONS.PlaySoundSetSound(menu, "selectAlt", false) + end) + end) - assert( f11_arg0.ServerBrowser ) - assert( f11_arg0.ServerBrowser.ServerList ) - local f11_local2 = LUI.DataSourceInGlobalModel.new( f0_local0 .. ".serverCount" ) - f11_arg0:SubscribeToModel( f11_local2:GetModel( f11_arg1 ), function () - local f17_local0 = f11_local2:GetValue( f11_arg1 ) - if f17_local0 ~= nil then - if f17_local0 == 0 then - local f17_local1 = LUI.FlowManager.GetScopedData( f11_arg0 ) - if f17_local1.serverBrowserFocused then - f17_local1.serverBrowserFocused = false - ACTIONS.LoseFocus( f11_arg0, "ServerBrowser", f11_arg1 ) - end - end - f11_arg0.ServerBrowser:SetBlurHeight( f17_local0 ) - end - end ) - local f11_local3 = LUI.DataSourceFromList.new( f11_local2 ) - f11_local3.MakeDataSourceAtIndex = function ( f18_arg0, f18_arg1, f18_arg2 ) - local f18_local0 = f18_arg1 % 2 and COLORS.white or COLORS.black - local f18_local1 = LUI.DataSourceInGlobalModel.new( f0_local0 .. "." .. f18_arg1 .. ".status" ) - return { - index = f18_arg1, - color = f18_local0, - host = LUI.DataSourceInGlobalModel.new( f0_local0 .. "." .. f18_arg1 .. ".host" ), - map = LUI.DataSourceInGlobalModel.new( f0_local0 .. "." .. f18_arg1 .. ".map" ), - players = LUI.DataSourceInGlobalModel.new( f0_local0 .. "." .. f18_arg1 .. ".players" ), - type = LUI.DataSourceInGlobalModel.new( f0_local0 .. "." .. f18_arg1 .. ".type" ), - status = f18_local1:Filter( "status", function ( f19_arg0, f19_arg1 ) - local f19_local0 - if f19_arg0 == 1 then - f19_local0 = Engine.Localize( "MENU_LOBBY" ) - if not f19_local0 then - - else - return f19_local0 - end - end - f19_local0 = Engine.Localize( "MENU_IN_GAME_CAPS" ) - end - ) - } - end - - f11_arg0.ServerBrowser.ServerList:SetGridDataSource( f11_local3 ) - assert( f11_arg0.bindButton ) - f11_arg0.bindButton:addEventHandler( "button_start", function ( f20_arg0, f20_arg1 ) - local f20_local0 = LUI.FlowManager.GetScopedData( f11_arg0 ) - f20_local0.optionsMenuOpened = true - ACTIONS.OpenMenu( "OptionsMenu", true, f20_arg1.controller ) - ACTIONS.PlaySoundSetSound( f11_arg0, "selectAlt", false ) - end ) - - local f11_local4 = f11_arg0:Wait( 250 ) - f11_local4.onComplete = function () - return f0_local6( f11_arg0, f11_arg1 ) - end - - Engine.StopMenuVideo() + menu.SystemLinkMenuButtons:addEventHandler("gain_focus", function(menuHandler, eventHandler) + local scopedData = LUI.FlowManager.GetScopedData(menu) + if scopedData.serverBrowserFocused then + scopedData.serverBrowserFocused = false + ACTIONS.LoseFocus(menu, "ServerBrowser", controller) + if CONDITIONS.IsThirdGameMode(menu) then + ACTIONS.AnimateSequence(menu, "DisplayServerBrowser") + menu:RemoveButtonHelperText("button_alt1", "left") + end + end + end) + + Engine.PLMRefreshData() + if Engine.IsCoreMode() then + ClientWeapon.SetWeaponVisible(0, false) + ClientCharacter.SetCharacterVisible(0, false) + end + + Lobby.SetPartyUIRoot(PartyUIRoot.SYSTEM_LINK) + local scopedData = LUI.FlowManager.GetScopedData(menu) + if scopedData.optionsMenuOpened then + scopedData.optionsMenuOpened = nil + if scopedData.serverBrowserFocused then + scopedData.serverBrowserFocused = false + menu:clearSavedState() + if isAliensMode then + LUI.FlowManager.ClearSavedMenuState("CPSystemLinkMenu") + else + LUI.FlowManager.ClearSavedMenuState("MPSystemLinkMenu") + end + end + else + scopedData.serverBrowserFocused = false + end + + Lobby.BuildServerList(controller) + Lobby.RefreshServerList(controller) + + assert(menu.ServerBrowser) + assert(menu.ServerBrowser.ServerList) + local serverCountDataSource = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. ".serverCount") + menu:SubscribeToModel(serverCountDataSource:GetModel(controller), function() + local serverCount = serverCountDataSource:GetValue(controller) + if serverCount ~= nil then + if serverCount == 0 then + local scopedData = LUI.FlowManager.GetScopedData(menu) + if scopedData.serverBrowserFocused then + scopedData.serverBrowserFocused = false + ACTIONS.LoseFocus(menu, "ServerBrowser", controller) + end + end + menu.ServerBrowser:SetBlurHeight(serverCount) + end + end) + + local serverListDataSource = LUI.DataSourceFromList.new(serverCountDataSource) + serverListDataSource.MakeDataSourceAtIndex = function(dataSource, index, controller) + local color = index % 2 == 0 and COLORS.white or COLORS.black + local statusDataSource = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".status") + return { + index = index, + color = color, + host = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".host"), + map = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".map"), + players = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".players"), + type = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".type"), + status = statusDataSource:Filter("status", function(value, model) + if value == 1 then + return Engine.Localize("MENU_LOBBY") + else + return Engine.Localize("MENU_IN_GAME_CAPS") + end + end) + } + end + + menu.ServerBrowser.ServerList:SetGridDataSource(serverListDataSource) + + assert(menu.bindButton) + menu.bindButton:addEventHandler("button_start", function(buttonHandler, buttonEvent) + local scopedData = LUI.FlowManager.GetScopedData(menu) + scopedData.optionsMenuOpened = true + ACTIONS.OpenMenu("OptionsMenu", true, buttonEvent.controller) + ACTIONS.PlaySoundSetSound(menu, "selectAlt", false) + end) + + local waitDuration = menu:Wait(250) + waitDuration.onComplete = function() + return updateServerDisplayListAndCreateModels(menu, controller) + end + + Engine.StopMenuVideo() end -MenuBuilder.m_types["SystemLinkMenu"] = function ( menu, controller ) - local self = LUI.UIElement.new() - self.id = "SystemLinkMenu" - self._animationSets = {} - self._sequences = {} - local f22_local1 = controller and controller.controllerIndex - if not f22_local1 and not Engine.InFrontend() then - f22_local1 = self:getRootController() - end - assert( f22_local1 ) - self.soundSet = "cpMainMenuDefault" - self:playSound( "menu_open" ) - local f22_local2 = self - local f22_local3 = nil - if CONDITIONS.IsThirdGameMode( self ) then - f22_local3 = MenuBuilder.BuildRegisteredType( "CPMenuOuterMask", { - controllerIndex = f22_local1 - } ) - f22_local3.id = "OuterMaskTop" - f22_local3:SetZRotation( -168, 0 ) - f22_local3:SetAnchorsAndPosition( 0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -320, _1080p * 100 ) - self:addElement( f22_local3 ) - self.OuterMaskTop = f22_local3 - end - local f22_local4 = nil - if CONDITIONS.IsThirdGameMode( self ) then - f22_local4 = MenuBuilder.BuildRegisteredType( "CPMenuOuterMask", { - controllerIndex = f22_local1 - } ) - f22_local4.id = "OuterMaskBottom" - f22_local4:SetZRotation( -168, 0 ) - f22_local4:SetAnchorsAndPosition( 0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -205, _1080p * 215 ) - self:addElement( f22_local4 ) - self.OuterMaskBottom = f22_local4 - end - local f22_local5 = nil - if CONDITIONS.IsCoreMultiplayer( self ) then - f22_local5 = MenuBuilder.BuildRegisteredType( "MenuTitle", { - controllerIndex = f22_local1 - } ) - f22_local5.id = "MenuTitle" - f22_local5.MenuTitle:setText( ToUpperCase( Engine.Localize( "SERVER BROWSER" ) ), 0 ) - f22_local5.MenuBreadcrumbs:setText( ToUpperCase( Engine.Localize( "EXE_LOCAL_PLAY" ) ), 0 ) - f22_local5.Icon:SetTop( _1080p * -28.5, 0 ) - f22_local5.Icon:SetBottom( _1080p * 61.5, 0 ) - f22_local5:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 96, _1080p * 1056, _1080p * 54, _1080p * 134 ) - self:addElement( f22_local5 ) - self.MenuTitle = f22_local5 - end - local ButtonHelperBar = nil - - ButtonHelperBar = MenuBuilder.BuildRegisteredType( "ButtonHelperBar", { - controllerIndex = f22_local1 - } ) - ButtonHelperBar.id = "ButtonHelperBar" - ButtonHelperBar:SetAnchorsAndPosition( 0, 0, 1, 0, 0, 0, _1080p * -85, 0 ) - self:addElement( ButtonHelperBar ) - self.ButtonHelperBar = ButtonHelperBar - - local SocialFeed = nil - - SocialFeed = MenuBuilder.BuildRegisteredType( "SocialFeed", { - controllerIndex = f22_local1 - } ) - SocialFeed.id = "SocialFeed" - SocialFeed:SetAnchorsAndPosition( 0, 0, 1, 0, 0, 0, _1080p * -115, _1080p * -85 ) - self:addElement( SocialFeed ) - self.SocialFeed = SocialFeed - - local SystemLinkMenuButtons = nil - - SystemLinkMenuButtons = MenuBuilder.BuildRegisteredType( "SystemLinkMenuButtons", { - controllerIndex = f22_local1 - } ) - SystemLinkMenuButtons.id = "SystemLinkMenuButtons" - SystemLinkMenuButtons:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 216, _1080p * 438 ) - self:addElement( SystemLinkMenuButtons ) - self.SystemLinkMenuButtons = SystemLinkMenuButtons - - local f22_local9 = nil - if CONDITIONS.IsThirdGameMode( self ) then - f22_local9 = MenuBuilder.BuildRegisteredType( "LobbyMembers", { - controllerIndex = f22_local1 - } ) - f22_local9.id = "LobbyMembers" - f22_local9:SetAlpha( 0, 0 ) - f22_local9:SetAnchorsAndPosition( 1, 0, 0, 1, _1080p * -1790, _1080p * -1090, _1080p * 791.5, _1080p * 1435.5 ) - self:addElement( f22_local9 ) - self.LobbyMembers = f22_local9 - end - local ServerBrowser = nil - - ServerBrowser = MenuBuilder.BuildRegisteredType( "ServerBrowser", { - controllerIndex = f22_local1 - } ) - ServerBrowser.id = "ServerBrowser" - ServerBrowser:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 659, _1080p * 1790, _1080p * 216, _1080p * 885 ) - self:addElement( ServerBrowser ) - self.ServerBrowser = ServerBrowser - - local f22_local11 = nil - if CONDITIONS.IsThirdGameMode( self ) then - f22_local11 = LUI.UIImage.new() - f22_local11.id = "BloodSplat" - f22_local11:SetAlpha( 0.5, 0 ) - f22_local11:setImage( RegisterMaterial( "cp_menu_zombies_blood_splats_large" ), 0 ) - f22_local11:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 48, _1080p * 678, _1080p * -71, _1080p * 441 ) - self:addElement( f22_local11 ) - self.BloodSplat = f22_local11 - end - local f22_local12 = nil - if CONDITIONS.IsThirdGameMode( self ) then - f22_local12 = LUI.UIImage.new() - f22_local12.id = "ZombiesLogo" - f22_local12:setImage( RegisterMaterial( "cp_menu_zombies_logo" ), 0 ) - f22_local12:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 60, _1080p * 740, _1080p * 34, _1080p * 434 ) - self:addElement( f22_local12 ) - self.ZombiesLogo = f22_local12 - end - local f22_local13 = nil - if CONDITIONS.IsThirdGameMode( self ) then - f22_local13 = LUI.UIStyledText.new() - f22_local13.id = "ZomLanPartyShadow" - f22_local13:SetRGBFromInt( 0, 0 ) - f22_local13:setText( Engine.Localize( "Server Browser" ), 0 ) - f22_local13:SetFontSize( 36 * _1080p ) - f22_local13:SetFont( FONTS.GetFont( FONTS.ZmClean.File ) ) - f22_local13:SetAlignment( LUI.Alignment.Center ) - f22_local13:SetOptOutRightToLeftAlignmentFlip( true ) - f22_local13:SetShadowRGBFromInt( 0, 0 ) - f22_local13:SetOutlineRGBFromInt( 0, 0 ) - f22_local13:SetDecodeLetterLength( 25 ) - f22_local13:SetDecodeMaxRandChars( 3 ) - f22_local13:SetDecodeUpdatesPerLetter( 4 ) - f22_local13:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 272, _1080p * 597.5, _1080p * 302, _1080p * 338 ) - self:addElement( f22_local13 ) - self.ZomLanPartyShadow = f22_local13 - end - local f22_local14 = nil - if CONDITIONS.IsThirdGameMode( self ) then - f22_local14 = LUI.UIStyledText.new() - f22_local14.id = "ZomLanParty" - f22_local14:SetRGBFromInt( 14042667, 0 ) - f22_local14:setText( Engine.Localize( "Server Browser" ), 0 ) - f22_local14:SetFontSize( 36 * _1080p ) - f22_local14:SetFont( FONTS.GetFont( FONTS.ZmClean.File ) ) - f22_local14:SetAlignment( LUI.Alignment.Center ) - f22_local14:SetOptOutRightToLeftAlignmentFlip( true ) - f22_local14:SetShadowRGBFromInt( 0, 0 ) - f22_local14:SetOutlineRGBFromInt( 0, 0 ) - f22_local14:SetDecodeLetterLength( 25 ) - f22_local14:SetDecodeMaxRandChars( 3 ) - f22_local14:SetDecodeUpdatesPerLetter( 4 ) - f22_local14:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 272, _1080p * 597.5, _1080p * 302, _1080p * 338 ) - self:addElement( f22_local14 ) - self.ZomLanParty = f22_local14 - end - local MPLobbyMembersPlayercards = nil - - MPLobbyMembersPlayercards = MenuBuilder.BuildRegisteredType( "MPLobbyMembersPlayercards", { - controllerIndex = f22_local1 - } ) - MPLobbyMembersPlayercards.id = "MPLobbyMembersPlayercards" - MPLobbyMembersPlayercards:SetAnchorsAndPosition( 0, 1, 1, 0, _1080p * 130, _1080p * 630, _1080p * -255, _1080p * -189 ) - self:addElement( MPLobbyMembersPlayercards ) - self.MPLobbyMembersPlayercards = MPLobbyMembersPlayercards - - local ButtonDescriptionText = nil - - ButtonDescriptionText = MenuBuilder.BuildRegisteredType( "ButtonDescriptionText", { - controllerIndex = f22_local1 - } ) - ButtonDescriptionText.id = "ButtonDescriptionText" - ButtonDescriptionText:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 130, _1080p * 550, _1080p * 334, _1080p * 366 ) - self:addElement( ButtonDescriptionText ) - self.ButtonDescriptionText = ButtonDescriptionText - - self._animationSets.DefaultAnimationSet = function () - ServerBrowser:RegisterAnimationSequence( "DefaultSequence", { - { - function () - return self.ServerBrowser:SetAlpha( 1, 0 ) - end - }, - { - function () - return self.ServerBrowser:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 659, _1080p * 1790, _1080p * 216, _1080p * 885, 0 ) - end - } - } ) - self._sequences.DefaultSequence = function () - ServerBrowser:AnimateSequence( "DefaultSequence" ) - end - - SystemLinkMenuButtons:RegisterAnimationSequence( "IntroCore", { - { - function () - return self.SystemLinkMenuButtons:SetAlpha( 1, 0 ) - end - }, - { - function () - return self.SystemLinkMenuButtons:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 216, _1080p * 438, 0 ) - end - } - } ) - ServerBrowser:RegisterAnimationSequence( "IntroCore", { - { - function () - return self.ServerBrowser:SetAlpha( 1, 0 ) - end - }, - { - function () - return self.ServerBrowser:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 659, _1080p * 1790, _1080p * 216, _1080p * 885, 0 ) - end - } - } ) - self._sequences.IntroCore = function () - SystemLinkMenuButtons:AnimateSequence( "IntroCore" ) - ServerBrowser:AnimateSequence( "IntroCore" ) - end - - end - - self._animationSets.ThirdGameModeAnimationSet = function () - self._sequences.DefaultSequence = function () - - end - - if CONDITIONS.IsThirdGameMode( self ) then - f22_local3:RegisterAnimationSequence( "Intro", { - { - function () - return self.OuterMaskTop:SetAlpha( 0, 0 ) - end, - function () - return self.OuterMaskTop:SetAlpha( 0.6, 500, LUI.EASING.outBack ) - end - }, - { - function () - return self.OuterMaskTop:SetAnchorsAndPosition( 0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -635, _1080p * -215, 0 ) - end, - function () - return self.OuterMaskTop:SetAnchorsAndPosition( 0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -635, _1080p * -215, 500, LUI.EASING.outBack ) - end, - function () - return self.OuterMaskTop:SetAnchorsAndPosition( 0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -320, _1080p * 100, 500, LUI.EASING.outQuadratic ) - end, - function () - return self.OuterMaskTop:SetAnchorsAndPosition( 0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -320, _1080p * 100, 139 ) - end, - function () - return self.OuterMaskTop:SetAnchorsAndPosition( 0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -280, _1080p * 140, 9 ) - end, - function () - return self.OuterMaskTop:SetAnchorsAndPosition( 0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -320, _1080p * 100, 200, LUI.EASING.outQuadratic ) - end - } - } ) - end - if CONDITIONS.IsThirdGameMode( self ) then - f22_local4:RegisterAnimationSequence( "Intro", { - { - function () - return self.OuterMaskBottom:SetAlpha( 0, 0 ) - end, - function () - return self.OuterMaskBottom:SetAlpha( 0.6, 500, LUI.EASING.outBack ) - end - }, - { - function () - return self.OuterMaskBottom:SetAnchorsAndPosition( 0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * 225, _1080p * 645, 0 ) - end, - function () - return self.OuterMaskBottom:SetAnchorsAndPosition( 0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * 225, _1080p * 645, 500, LUI.EASING.outBack ) - end, - function () - return self.OuterMaskBottom:SetAnchorsAndPosition( 0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -205, _1080p * 215, 500, LUI.EASING.outQuadratic ) - end, - function () - return self.OuterMaskBottom:SetAnchorsAndPosition( 0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -205, _1080p * 215, 139 ) - end, - function () - return self.OuterMaskBottom:SetAnchorsAndPosition( 0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -245, _1080p * 175, 9 ) - end, - function () - return self.OuterMaskBottom:SetAnchorsAndPosition( 0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -205, _1080p * 215, 200, LUI.EASING.outQuadratic ) - end - } - } ) - end - SystemLinkMenuButtons:RegisterAnimationSequence( "Intro", { - { - function () - return self.SystemLinkMenuButtons:SetAlpha( 0, 0 ) - end, - function () - return self.SystemLinkMenuButtons:SetAlpha( 0, 1220 ) - end, - function () - return self.SystemLinkMenuButtons:SetAlpha( 1, 490 ) - end - }, - { - function () - return self.SystemLinkMenuButtons:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 406, _1080p * 628, 0 ) - end - } - } ) - if CONDITIONS.IsThirdGameMode( self ) then - f22_local9:RegisterAnimationSequence( "Intro", { - { - function () - return self.LobbyMembers:SetAlpha( 0, 0 ) - end, - function () - return self.LobbyMembers:SetAlpha( 0, 2000 ) - end - } - } ) - end - ServerBrowser:RegisterAnimationSequence( "Intro", { - { - function () - return self.ServerBrowser:SetAlpha( 0, 0 ) - end - }, - { - function () - return self.ServerBrowser:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 789, _1080p * 1920, _1080p * 133, _1080p * 802, 0 ) - end - } - } ) - if CONDITIONS.IsThirdGameMode( self ) then - f22_local11:RegisterAnimationSequence( "Intro", { - { - function () - return self.BloodSplat:SetAlpha( 0, 0 ) - end, - function () - return self.BloodSplat:SetAlpha( 0, 1000 ) - end, - function () - return self.BloodSplat:SetAlpha( 0, 140 ) - end, - function () - return self.BloodSplat:SetAlpha( 0.5, 10 ) - end, - function () - return self.BloodSplat:SetAlpha( 0.5, 200, LUI.EASING.outQuadratic ) - end, - function () - return self.BloodSplat:SetAlpha( 0.4, 650, LUI.EASING.outQuadratic ) - end - }, - { - function () - return self.BloodSplat:SetZRotation( -5, 1000 ) - end, - function () - return self.BloodSplat:SetZRotation( -5, 150 ) - end, - function () - return self.BloodSplat:SetZRotation( 0, 850, LUI.EASING.outQuadratic ) - end - }, - { - function () - return self.BloodSplat:playSound( "splat", false, 1150 ) - end - }, - { - function () - return self.BloodSplat:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 218.92, _1080p * 547.08, _1080p * 51.65, _1080p * 318.35, 1149 ) - end, - function () - return self.BloodSplat:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 88, _1080p * 718, _1080p * -71, _1080p * 441, 70 ) - end, - function () - return self.BloodSplat:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 80, _1080p * 710, _1080p * -71, _1080p * 441, 129, LUI.EASING.outQuadratic ) - end - } - } ) - end - if CONDITIONS.IsThirdGameMode( self ) then - f22_local12:RegisterAnimationSequence( "Intro", { - { - function () - return self.ZombiesLogo:SetAlpha( 0, 0 ) - end, - function () - return self.ZombiesLogo:SetAlpha( 0, 1000 ) - end, - function () - return self.ZombiesLogo:SetAlpha( 1, 150 ) - end - }, - { - function () - return self.ZombiesLogo:SetZRotation( 5, 1000 ) - end, - function () - return self.ZombiesLogo:SetZRotation( 5, 150 ) - end, - function () - return self.ZombiesLogo:SetZRotation( 0, 850, LUI.EASING.outQuadratic ) - end - }, - { - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * -429.8, _1080p * 1249.8, _1080p * -260, _1080p * 728, 1000 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 80, _1080p * 720, _1080p * 51.65, _1080p * 416.35, 149 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 70, _1080p * 750, _1080p * 34, _1080p * 434, 200 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 70, _1080p * 750, _1080p * 36, _1080p * 436, 49 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 68, _1080p * 748, _1080p * 35.68, _1080p * 435.68, 50 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 70.35, _1080p * 750.35, _1080p * 33.39, _1080p * 433.39, 49 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 70.28, _1080p * 750.28, _1080p * 31.51, _1080p * 431.51, 49 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 68.22, _1080p * 748.22, _1080p * 34.03, _1080p * 434.03, 50 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 70.64, _1080p * 750.64, _1080p * 34.02, _1080p * 434.02, 49 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 70.47, _1080p * 750.47, _1080p * 36.01, _1080p * 436.01, 50 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 68.33, _1080p * 748.33, _1080p * 35.4, _1080p * 435.4, 49 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 68.93, _1080p * 748.93, _1080p * 32.9, _1080p * 432.9, 59 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 69.4, _1080p * 749.4, _1080p * 35.38, _1080p * 435.38, 40 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 69.73, _1080p * 749.73, _1080p * 36.61, _1080p * 436.61, 49 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 71.93, _1080p * 751.93, _1080p * 34.65, _1080p * 434.65, 50 ) - end, - function () - return self.ZombiesLogo:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 70, _1080p * 750, _1080p * 34, _1080p * 434, 49, LUI.EASING.outQuadratic ) - end - } - } ) - end - if CONDITIONS.IsThirdGameMode( self ) then - f22_local13:RegisterAnimationSequence( "Intro", { - { - function () - return self.ZomLanPartyShadow:SetAlpha( 0, 0 ) - end, - function () - return self.ZomLanPartyShadow:SetAlpha( 0, 1710 ) - end, - function () - return self.ZomLanPartyShadow:SetAlpha( 1, 290 ) - end - } - } ) - end - if CONDITIONS.IsThirdGameMode( self ) then - f22_local14:RegisterAnimationSequence( "Intro", { - { - function () - return self.ZomLanParty:SetAlpha( 0, 0 ) - end, - function () - return self.ZomLanParty:SetAlpha( 0, 1220 ) - end, - function () - return self.ZomLanParty:SetAlpha( 1, 490 ) - end - }, - { - function () - return self.ZomLanParty:SetRGBFromInt( 14042667, 0 ) - end - } - } ) - end - MPLobbyMembersPlayercards:RegisterAnimationSequence( "Intro", { - { - function () - return self.MPLobbyMembersPlayercards:SetAlpha( 0, 0 ) - end, - function () - return self.MPLobbyMembersPlayercards:SetAlpha( 0, 700 ) - end, - function () - return self.MPLobbyMembersPlayercards:SetAlpha( 0, 1010 ) - end, - function () - return self.MPLobbyMembersPlayercards:SetAlpha( 1, 290 ) - end - } - } ) - ButtonDescriptionText:RegisterAnimationSequence( "Intro", { - { - function () - return self.ButtonDescriptionText:SetAlpha( 0, 0 ) - end, - function () - return self.ButtonDescriptionText:SetAlpha( 0, 1220 ) - end, - function () - return self.ButtonDescriptionText:SetAlpha( 1, 490 ) - end - }, - { - function () - return self.ButtonDescriptionText:SetRGBFromTable( SWATCHES.text.primaryText, 0 ) - end - }, - { - function () - return self.ButtonDescriptionText:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 132, _1080p * 552, _1080p * 524, _1080p * 556, 0 ) - end - } - } ) - self._sequences.Intro = function () - if CONDITIONS.IsThirdGameMode( self ) then - f22_local3:AnimateSequence( "Intro" ) - end - if CONDITIONS.IsThirdGameMode( self ) then - f22_local4:AnimateSequence( "Intro" ) - end - SystemLinkMenuButtons:AnimateSequence( "Intro" ) - if CONDITIONS.IsThirdGameMode( self ) then - f22_local9:AnimateSequence( "Intro" ) - end - ServerBrowser:AnimateSequence( "Intro" ) - if CONDITIONS.IsThirdGameMode( self ) then - f22_local11:AnimateSequence( "Intro" ) - end - if CONDITIONS.IsThirdGameMode( self ) then - f22_local12:AnimateSequence( "Intro" ) - end - if CONDITIONS.IsThirdGameMode( self ) then - f22_local13:AnimateSequence( "Intro" ) - end - if CONDITIONS.IsThirdGameMode( self ) then - f22_local14:AnimateSequence( "Intro" ) - end - MPLobbyMembersPlayercards:AnimateSequence( "Intro" ) - ButtonDescriptionText:AnimateSequence( "Intro" ) - end - - ServerBrowser:RegisterAnimationSequence( "DisplayServerBrowser", { - { - function () - return self.ServerBrowser:SetAlpha( 0, 0 ) - end, - function () - return self.ServerBrowser:SetAlpha( 1, 80 ) - end - }, - { - function () - return self.ServerBrowser:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 727, _1080p * 1858, _1080p * 216, _1080p * 885, 0 ) - end - } - } ) - self._sequences.DisplayServerBrowser = function () - ServerBrowser:AnimateSequence( "DisplayServerBrowser" ) - end - - ServerBrowser:RegisterAnimationSequence( "HideServerBrowser", { - { - function () - return self.ServerBrowser:SetAlpha( 1, 0 ) - end, - function () - return self.ServerBrowser:SetAlpha( 0, 80 ) - end - } - } ) - self._sequences.HideServerBrowser = function () - ServerBrowser:AnimateSequence( "HideServerBrowser" ) - end - - end - - self._animationSets.DefaultAnimationSet() - self.addButtonHelperFunction = function ( f117_arg0, f117_arg1 ) - f117_arg0:AddButtonHelperText( { - helper_text = Engine.Localize( "LUA_MENU_SELECT" ), - button_ref = "button_primary", - side = "left", - clickable = true - } ) - f117_arg0:AddButtonHelperText( { - helper_text = Engine.Localize( "LUA_MENU_BACK" ), - button_ref = "button_secondary", - side = "left", - priority = 1, - clickable = true - } ) - f117_arg0:AddButtonHelperText( { - helper_text = Engine.Localize( "LUA_MENU_OPTIONS_CAPS" ), - button_ref = "button_start", - side = "left", - priority = 4, - clickable = true - } ) - end - - self:addEventHandler( "menu_create", self.addButtonHelperFunction ) - - local bindButton = LUI.UIBindButton.new() - bindButton.id = "selfBindButton" - self:addElement( bindButton ) - self.bindButton = bindButton - - f0_local7( self, f22_local1, controller ) - ACTIONS.AnimateSequence( self, "DefaultSequence" ) - if CONDITIONS.IsThirdGameMode( self ) then - ACTIONS.SetAnimationSet( self, "ThirdGameModeAnimationSet" ) - ACTIONS.AnimateSequence( self, "Intro" ) - end - if CONDITIONS.IsCoreMultiplayer( self ) then - ACTIONS.SetAnimationSet( self, "DefaultAnimationSet" ) - ACTIONS.AnimateSequence( self, "IntroCore" ) - end +MenuBuilder.m_types["SystemLinkMenu"] = function(menu, controller) + local self = LUI.UIElement.new() + self.id = "SystemLinkMenu" + self._animationSets = {} + self._sequences = {} + local controllerIndex = controller and controller.controllerIndex + if not controllerIndex and not Engine.InFrontend() then + controllerIndex = self:getRootController() + end + assert(controllerIndex) + self.soundSet = "cpMainMenuDefault" + self:playSound("menu_open") + local OuterMaskTop = nil + if CONDITIONS.IsThirdGameMode(self) then + OuterMaskTop = MenuBuilder.BuildRegisteredType("CPMenuOuterMask", { + controllerIndex = controllerIndex + }) + OuterMaskTop.id = "OuterMaskTop" + OuterMaskTop:SetZRotation(-168, 0) + OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -320, _1080p * 100) + self:addElement(OuterMaskTop) + self.OuterMaskTop = OuterMaskTop + end + local OuterMaskBottom = nil + if CONDITIONS.IsThirdGameMode(self) then + OuterMaskBottom = MenuBuilder.BuildRegisteredType("CPMenuOuterMask", { + controllerIndex = controllerIndex + }) + OuterMaskBottom.id = "OuterMaskBottom" + OuterMaskBottom:SetZRotation(-168, 0) + OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -205, _1080p * 215) + self:addElement(OuterMaskBottom) + self.OuterMaskBottom = OuterMaskBottom + end + local MenuTitle = nil + if CONDITIONS.IsCoreMultiplayer(self) then + MenuTitle = MenuBuilder.BuildRegisteredType("MenuTitle", { + controllerIndex = controllerIndex + }) + MenuTitle.id = "MenuTitle" + MenuTitle.MenuTitle:setText(ToUpperCase(Engine.Localize("SERVER BROWSER")), 0) + MenuTitle.MenuBreadcrumbs:setText(ToUpperCase(Engine.Localize("EXE_LOCAL_PLAY")), 0) + MenuTitle.Icon:SetTop(_1080p * -28.5, 0) + MenuTitle.Icon:SetBottom(_1080p * 61.5, 0) + MenuTitle:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 96, _1080p * 1056, _1080p * 54, _1080p * 134) + self:addElement(MenuTitle) + self.MenuTitle = MenuTitle + end + local ButtonHelperBar = nil - return self + ButtonHelperBar = MenuBuilder.BuildRegisteredType("ButtonHelperBar", { + controllerIndex = controllerIndex + }) + ButtonHelperBar.id = "ButtonHelperBar" + ButtonHelperBar:SetAnchorsAndPosition(0, 0, 1, 0, 0, 0, _1080p * -85, 0) + self:addElement(ButtonHelperBar) + self.ButtonHelperBar = ButtonHelperBar + + local SocialFeed = nil + + SocialFeed = MenuBuilder.BuildRegisteredType("SocialFeed", { + controllerIndex = controllerIndex + }) + SocialFeed.id = "SocialFeed" + SocialFeed:SetAnchorsAndPosition(0, 0, 1, 0, 0, 0, _1080p * -115, _1080p * -85) + self:addElement(SocialFeed) + self.SocialFeed = SocialFeed + + local SystemLinkMenuButtons = nil + + SystemLinkMenuButtons = MenuBuilder.BuildRegisteredType("SystemLinkMenuButtons", { + controllerIndex = controllerIndex + }) + SystemLinkMenuButtons.id = "SystemLinkMenuButtons" + SystemLinkMenuButtons:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 216, _1080p * 438) + self:addElement(SystemLinkMenuButtons) + self.SystemLinkMenuButtons = SystemLinkMenuButtons + + local LobbyMembers = nil + if CONDITIONS.IsThirdGameMode(self) then + f22_local9 = MenuBuilder.BuildRegisteredType("LobbyMembers", { + controllerIndex = controllerIndex + }) + LobbyMembers.id = "LobbyMembers" + LobbyMembers:SetAlpha(0, 0) + LobbyMembers:SetAnchorsAndPosition(1, 0, 0, 1, _1080p * -1790, _1080p * -1090, _1080p * 791.5, _1080p * 1435.5) + self:addElement(LobbyMembers) + self.LobbyMembers = LobbyMembers + end + local ServerBrowser = nil + + ServerBrowser = MenuBuilder.BuildRegisteredType("ServerBrowser", { + controllerIndex = controllerIndex + }) + ServerBrowser.id = "ServerBrowser" + ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 659, _1080p * 1790, _1080p * 216, _1080p * 885) + self:addElement(ServerBrowser) + self.ServerBrowser = ServerBrowser + + local BloodSplat = nil + if CONDITIONS.IsThirdGameMode(self) then + BloodSplat = LUI.UIImage.new() + BloodSplat.id = "BloodSplat" + BloodSplat:SetAlpha(0.5, 0) + BloodSplat:setImage(RegisterMaterial("cp_menu_zombies_blood_splats_large"), 0) + BloodSplat:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 48, _1080p * 678, _1080p * -71, _1080p * 441) + self:addElement(BloodSplat) + self.BloodSplat = BloodSplat + end + local ZombiesLogo = nil + if CONDITIONS.IsThirdGameMode(self) then + ZombiesLogo = LUI.UIImage.new() + ZombiesLogo.id = "ZombiesLogo" + ZombiesLogo:setImage(RegisterMaterial("cp_menu_zombies_logo"), 0) + ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 60, _1080p * 740, _1080p * 34, _1080p * 434) + self:addElement(ZombiesLogo) + self.ZombiesLogo = ZombiesLogo + end + local ZomLanPartyShadow = nil + if CONDITIONS.IsThirdGameMode(self) then + ZomLanPartyShadow = LUI.UIStyledText.new() + ZomLanPartyShadow.id = "ZomLanPartyShadow" + ZomLanPartyShadow:SetRGBFromInt(0, 0) + ZomLanPartyShadow:setText(Engine.Localize("Server Browser"), 0) + ZomLanPartyShadow:SetFontSize(36 * _1080p) + ZomLanPartyShadow:SetFont(FONTS.GetFont(FONTS.ZmClean.File)) + ZomLanPartyShadow:SetAlignment(LUI.Alignment.Center) + ZomLanPartyShadow:SetOptOutRightToLeftAlignmentFlip(true) + ZomLanPartyShadow:SetShadowRGBFromInt(0, 0) + ZomLanPartyShadow:SetOutlineRGBFromInt(0, 0) + ZomLanPartyShadow:SetDecodeLetterLength(25) + ZomLanPartyShadow:SetDecodeMaxRandChars(3) + ZomLanPartyShadow:SetDecodeUpdatesPerLetter(4) + ZomLanPartyShadow:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 272, _1080p * 597.5, _1080p * 302, _1080p * 338) + self:addElement(ZomLanPartyShadow) + self.ZomLanPartyShadow = ZomLanPartyShadow + end + local ZomLanParty = nil + if CONDITIONS.IsThirdGameMode(self) then + ZomLanParty = LUI.UIStyledText.new() + ZomLanParty.id = "ZomLanParty" + ZomLanParty:SetRGBFromInt(14042667, 0) + ZomLanParty:setText(Engine.Localize("Server Browser"), 0) + ZomLanParty:SetFontSize(36 * _1080p) + ZomLanParty:SetFont(FONTS.GetFont(FONTS.ZmClean.File)) + ZomLanParty:SetAlignment(LUI.Alignment.Center) + ZomLanParty:SetOptOutRightToLeftAlignmentFlip(true) + ZomLanParty:SetShadowRGBFromInt(0, 0) + ZomLanParty:SetOutlineRGBFromInt(0, 0) + ZomLanParty:SetDecodeLetterLength(25) + ZomLanParty:SetDecodeMaxRandChars(3) + ZomLanParty:SetDecodeUpdatesPerLetter(4) + ZomLanParty:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 272, _1080p * 597.5, _1080p * 302, _1080p * 338) + self:addElement(ZomLanParty) + self.ZomLanParty = ZomLanParty + end + local MPLobbyMembersPlayercards = nil + + MPLobbyMembersPlayercards = MenuBuilder.BuildRegisteredType("MPLobbyMembersPlayercards", { + controllerIndex = controllerIndex + }) + MPLobbyMembersPlayercards.id = "MPLobbyMembersPlayercards" + MPLobbyMembersPlayercards:SetAnchorsAndPosition(0, 1, 1, 0, _1080p * 130, _1080p * 630, _1080p * -255, _1080p * -189) + self:addElement(MPLobbyMembersPlayercards) + self.MPLobbyMembersPlayercards = MPLobbyMembersPlayercards + + local ButtonDescriptionText = nil + + ButtonDescriptionText = MenuBuilder.BuildRegisteredType("ButtonDescriptionText", { + controllerIndex = controllerIndex + }) + ButtonDescriptionText.id = "ButtonDescriptionText" + ButtonDescriptionText:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 550, _1080p * 334, _1080p * 366) + self:addElement(ButtonDescriptionText) + self.ButtonDescriptionText = ButtonDescriptionText + + self._animationSets.DefaultAnimationSet = function() + ServerBrowser:RegisterAnimationSequence("DefaultSequence", {{function() + return self.ServerBrowser:SetAlpha(1, 0) + end}, {function() + return self.ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 659, _1080p * 1790, _1080p * 216, + _1080p * 885, 0) + end}}) + self._sequences.DefaultSequence = function() + ServerBrowser:AnimateSequence("DefaultSequence") + end + + SystemLinkMenuButtons:RegisterAnimationSequence("IntroCore", {{function() + return self.SystemLinkMenuButtons:SetAlpha(1, 0) + end}, {function() + return self.SystemLinkMenuButtons:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 630, + _1080p * 216, _1080p * 438, 0) + end}}) + ServerBrowser:RegisterAnimationSequence("IntroCore", {{function() + return self.ServerBrowser:SetAlpha(1, 0) + end}, {function() + return self.ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 659, _1080p * 1790, _1080p * 216, + _1080p * 885, 0) + end}}) + self._sequences.IntroCore = function() + SystemLinkMenuButtons:AnimateSequence("IntroCore") + ServerBrowser:AnimateSequence("IntroCore") + end + + end + + self._animationSets.ThirdGameModeAnimationSet = function() + self._sequences.DefaultSequence = function() + + end + + if CONDITIONS.IsThirdGameMode(self) then + CPMenuOuterMask:RegisterAnimationSequence("Intro", {{function() + return self.OuterMaskTop:SetAlpha(0, 0) + end, function() + return self.OuterMaskTop:SetAlpha(0.6, 500, LUI.EASING.outBack) + end}, {function() + return self.OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -635, + _1080p * -215, 0) + end, function() + return self.OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -635, + _1080p * -215, 500, LUI.EASING.outBack) + end, function() + return self.OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -320, + _1080p * 100, 500, LUI.EASING.outQuadratic) + end, function() + return self.OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -320, + _1080p * 100, 139) + end, function() + return self.OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -280, + _1080p * 140, 9) + end, function() + return self.OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -320, + _1080p * 100, 200, LUI.EASING.outQuadratic) + end}}) + end + if CONDITIONS.IsThirdGameMode(self) then + f22_local4:RegisterAnimationSequence("Intro", {{function() + return self.OuterMaskBottom:SetAlpha(0, 0) + end, function() + return self.OuterMaskBottom:SetAlpha(0.6, 500, LUI.EASING.outBack) + end}, {function() + return self.OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * 225, + _1080p * 645, 0) + end, function() + return self.OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * 225, + _1080p * 645, 500, LUI.EASING.outBack) + end, function() + return self.OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -205, + _1080p * 215, 500, LUI.EASING.outQuadratic) + end, function() + return self.OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -205, + _1080p * 215, 139) + end, function() + return self.OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -245, + _1080p * 175, 9) + end, function() + return self.OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -205, + _1080p * 215, 200, LUI.EASING.outQuadratic) + end}}) + end + SystemLinkMenuButtons:RegisterAnimationSequence("Intro", {{function() + return self.SystemLinkMenuButtons:SetAlpha(0, 0) + end, function() + return self.SystemLinkMenuButtons:SetAlpha(0, 1220) + end, function() + return self.SystemLinkMenuButtons:SetAlpha(1, 490) + end}, {function() + return self.SystemLinkMenuButtons:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 630, + _1080p * 406, _1080p * 628, 0) + end}}) + if CONDITIONS.IsThirdGameMode(self) then + f22_local9:RegisterAnimationSequence("Intro", {{function() + return self.LobbyMembers:SetAlpha(0, 0) + end, function() + return self.LobbyMembers:SetAlpha(0, 2000) + end}}) + end + ServerBrowser:RegisterAnimationSequence("Intro", {{function() + return self.ServerBrowser:SetAlpha(0, 0) + end}, {function() + return self.ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 789, _1080p * 1920, _1080p * 133, + _1080p * 802, 0) + end}}) + if CONDITIONS.IsThirdGameMode(self) then + controllerIndex1:RegisterAnimationSequence("Intro", {{function() + return self.BloodSplat:SetAlpha(0, 0) + end, function() + return self.BloodSplat:SetAlpha(0, 1000) + end, function() + return self.BloodSplat:SetAlpha(0, 140) + end, function() + return self.BloodSplat:SetAlpha(0.5, 10) + end, function() + return self.BloodSplat:SetAlpha(0.5, 200, LUI.EASING.outQuadratic) + end, function() + return self.BloodSplat:SetAlpha(0.4, 650, LUI.EASING.outQuadratic) + end}, {function() + return self.BloodSplat:SetZRotation(-5, 1000) + end, function() + return self.BloodSplat:SetZRotation(-5, 150) + end, function() + return self.BloodSplat:SetZRotation(0, 850, LUI.EASING.outQuadratic) + end}, {function() + return self.BloodSplat:playSound("splat", false, 1150) + end}, {function() + return self.BloodSplat:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 218.92, _1080p * 547.08, + _1080p * 51.65, _1080p * 318.35, 1149) + end, function() + return self.BloodSplat:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 88, _1080p * 718, _1080p * -71, + _1080p * 441, 70) + end, function() + return self.BloodSplat:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 80, _1080p * 710, _1080p * -71, + _1080p * 441, 129, LUI.EASING.outQuadratic) + end}}) + end + if CONDITIONS.IsThirdGameMode(self) then + controllerIndex2:RegisterAnimationSequence("Intro", {{function() + return self.ZombiesLogo:SetAlpha(0, 0) + end, function() + return self.ZombiesLogo:SetAlpha(0, 1000) + end, function() + return self.ZombiesLogo:SetAlpha(1, 150) + end}, {function() + return self.ZombiesLogo:SetZRotation(5, 1000) + end, function() + return self.ZombiesLogo:SetZRotation(5, 150) + end, function() + return self.ZombiesLogo:SetZRotation(0, 850, LUI.EASING.outQuadratic) + end}, {function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * -429.8, _1080p * 1249.8, + _1080p * -260, _1080p * 728, 1000) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 80, _1080p * 720, _1080p * 51.65, + _1080p * 416.35, 149) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70, _1080p * 750, _1080p * 34, + _1080p * 434, 200) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70, _1080p * 750, _1080p * 36, + _1080p * 436, 49) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 68, _1080p * 748, _1080p * 35.68, + _1080p * 435.68, 50) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70.35, _1080p * 750.35, + _1080p * 33.39, _1080p * 433.39, 49) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70.28, _1080p * 750.28, + _1080p * 31.51, _1080p * 431.51, 49) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 68.22, _1080p * 748.22, + _1080p * 34.03, _1080p * 434.03, 50) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70.64, _1080p * 750.64, + _1080p * 34.02, _1080p * 434.02, 49) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70.47, _1080p * 750.47, + _1080p * 36.01, _1080p * 436.01, 50) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 68.33, _1080p * 748.33, + _1080p * 35.4, _1080p * 435.4, 49) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 68.93, _1080p * 748.93, + _1080p * 32.9, _1080p * 432.9, 59) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 69.4, _1080p * 749.4, _1080p * 35.38, + _1080p * 435.38, 40) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 69.73, _1080p * 749.73, + _1080p * 36.61, _1080p * 436.61, 49) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 71.93, _1080p * 751.93, + _1080p * 34.65, _1080p * 434.65, 50) + end, function() + return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70, _1080p * 750, _1080p * 34, + _1080p * 434, 49, LUI.EASING.outQuadratic) + end}}) + end + if CONDITIONS.IsThirdGameMode(self) then + controllerIndex3:RegisterAnimationSequence("Intro", {{function() + return self.ZomLanPartyShadow:SetAlpha(0, 0) + end, function() + return self.ZomLanPartyShadow:SetAlpha(0, 1710) + end, function() + return self.ZomLanPartyShadow:SetAlpha(1, 290) + end}}) + end + if CONDITIONS.IsThirdGameMode(self) then + controllerIndex4:RegisterAnimationSequence("Intro", {{function() + return self.ZomLanParty:SetAlpha(0, 0) + end, function() + return self.ZomLanParty:SetAlpha(0, 1220) + end, function() + return self.ZomLanParty:SetAlpha(1, 490) + end}, {function() + return self.ZomLanParty:SetRGBFromInt(14042667, 0) + end}}) + end + MPLobbyMembersPlayercards:RegisterAnimationSequence("Intro", {{function() + return self.MPLobbyMembersPlayercards:SetAlpha(0, 0) + end, function() + return self.MPLobbyMembersPlayercards:SetAlpha(0, 700) + end, function() + return self.MPLobbyMembersPlayercards:SetAlpha(0, 1010) + end, function() + return self.MPLobbyMembersPlayercards:SetAlpha(1, 290) + end}}) + ButtonDescriptionText:RegisterAnimationSequence("Intro", {{function() + return self.ButtonDescriptionText:SetAlpha(0, 0) + end, function() + return self.ButtonDescriptionText:SetAlpha(0, 1220) + end, function() + return self.ButtonDescriptionText:SetAlpha(1, 490) + end}, {function() + return self.ButtonDescriptionText:SetRGBFromTable(SWATCHES.text.primaryText, 0) + end}, {function() + return self.ButtonDescriptionText:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 132, _1080p * 552, + _1080p * 524, _1080p * 556, 0) + end}}) + self._sequences.Intro = function() + if CONDITIONS.IsThirdGameMode(self) then + CPMenuOuterMask:AnimateSequence("Intro") + end + if CONDITIONS.IsThirdGameMode(self) then + f22_local4:AnimateSequence("Intro") + end + SystemLinkMenuButtons:AnimateSequence("Intro") + if CONDITIONS.IsThirdGameMode(self) then + f22_local9:AnimateSequence("Intro") + end + ServerBrowser:AnimateSequence("Intro") + if CONDITIONS.IsThirdGameMode(self) then + controllerIndex1:AnimateSequence("Intro") + end + if CONDITIONS.IsThirdGameMode(self) then + controllerIndex2:AnimateSequence("Intro") + end + if CONDITIONS.IsThirdGameMode(self) then + controllerIndex3:AnimateSequence("Intro") + end + if CONDITIONS.IsThirdGameMode(self) then + controllerIndex4:AnimateSequence("Intro") + end + MPLobbyMembersPlayercards:AnimateSequence("Intro") + ButtonDescriptionText:AnimateSequence("Intro") + end + + ServerBrowser:RegisterAnimationSequence("DisplayServerBrowser", {{function() + return self.ServerBrowser:SetAlpha(0, 0) + end, function() + return self.ServerBrowser:SetAlpha(1, 80) + end}, {function() + return self.ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 727, _1080p * 1858, _1080p * 216, + _1080p * 885, 0) + end}}) + self._sequences.DisplayServerBrowser = function() + ServerBrowser:AnimateSequence("DisplayServerBrowser") + end + + ServerBrowser:RegisterAnimationSequence("HideServerBrowser", {{function() + return self.ServerBrowser:SetAlpha(1, 0) + end, function() + return self.ServerBrowser:SetAlpha(0, 80) + end}}) + self._sequences.HideServerBrowser = function() + ServerBrowser:AnimateSequence("HideServerBrowser") + end + + end + + self._animationSets.DefaultAnimationSet() + self.addButtonHelperFunction = function(arg0, arg1) + arg0:AddButtonHelperText({ + helper_text = Engine.Localize("LUA_MENU_SELECT"), + button_ref = "button_primary", + side = "left", + clickable = true + }) + arg0:AddButtonHelperText({ + helper_text = Engine.Localize("LUA_MENU_BACK"), + button_ref = "button_secondary", + side = "left", + priority = 1, + clickable = true + }) + arg0:AddButtonHelperText({ + helper_text = Engine.Localize("LUA_MENU_OPTIONS_CAPS"), + button_ref = "button_start", + side = "left", + priority = 4, + clickable = true + }) + end + + self:addEventHandler("menu_create", self.addButtonHelperFunction) + + local bindButton = LUI.UIBindButton.new() + bindButton.id = "selfBindButton" + self:addElement(bindButton) + self.bindButton = bindButton + + setupSystemLinkMenu(self, controllerIndex, controller) + ACTIONS.AnimateSequence(self, "DefaultSequence") + if CONDITIONS.IsThirdGameMode(self) then + ACTIONS.SetAnimationSet(self, "ThirdGameModeAnimationSet") + ACTIONS.AnimateSequence(self, "Intro") + end + if CONDITIONS.IsCoreMultiplayer(self) then + ACTIONS.SetAnimationSet(self, "DefaultAnimationSet") + ACTIONS.AnimateSequence(self, "IntroCore") + end + + return self end -local f0_local3 = function () - clearMatchData() - WipeGlobalModelsAtPath( f0_local0 ) +local PopFunc = function() + clearMatchData() + WipeGlobalModelsAtPath(f0_local0) end -LUI.FlowManager.RegisterStackPushBehaviour( "SystemLinkMenu", PushFunc ) -LUI.FlowManager.RegisterStackPopBehaviour( "SystemLinkMenu", f0_local3 ) \ No newline at end of file +LUI.FlowManager.RegisterStackPushBehaviour("SystemLinkMenu", PushFunc) +LUI.FlowManager.RegisterStackPopBehaviour("SystemLinkMenu", PopFunc) diff --git a/data/cdata/ui_scripts/SystemLinkMenu/__init__.lua b/data/cdata/ui_scripts/SystemLinkMenu/__init__.lua index 2bcc2729..52cb5df6 100644 --- a/data/cdata/ui_scripts/SystemLinkMenu/__init__.lua +++ b/data/cdata/ui_scripts/SystemLinkMenu/__init__.lua @@ -1,2 +1,2 @@ require("ServerButtons") -require("SysLinkBrowser") \ No newline at end of file +require("SysLinkBrowser")