feat: fastdl, mod menus (#291)

* fastdl init

* ui_scripting fixes

* fastfile loading changes

* delete test ui script

* add mod select button

* Create iw7mod_code_post_gfx.ff

* fastdl progress

* fix download

* remove debug print
This commit is contained in:
quaK
2024-08-06 12:15:59 +03:00
committed by GitHub
parent 131196cd7a
commit 7835bb0477
26 changed files with 1874 additions and 329 deletions

View File

@ -1,188 +1,4 @@
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 )
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
} )
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
} )
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 )
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
local ContractsButton = nil
ContractsButton = MenuBuilder.BuildRegisteredType( "ContractsButtonCP", {
controllerIndex = f14_local1
} )
ContractsButton.id = "ContractsButton"
ContractsButton:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 340, _1080p * 240, _1080p * 300 )
VNavigator:addElement( ContractsButton )
VNavigator.ContractsButton = ContractsButton
f0_local4( VNavigator, f14_local1, controller )
return VNavigator
end
CPMainMenu_original = MenuBuilder.m_types["CPMainMenu"]
local CPMainMenu_original = MenuBuilder.m_types["CPMainMenu"]
function CPMainMenuStub( menu, controller )
ret = CPMainMenu_original( menu, controller )
@ -192,6 +8,4 @@ function CPMainMenuStub( menu, controller )
return ret
end
MenuBuilder.m_types["CPMainMenu"] = CPMainMenuStub
MenuBuilder.m_types["CPMainMenuButtons"] = CPMainMenuButtons
MenuBuilder.m_types["CPMainMenu"] = CPMainMenuStub

View File

@ -0,0 +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 )
end
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
} )
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
} )
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 )
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
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

View File

@ -0,0 +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
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 )
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 )
-- 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
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
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
end
MenuBuilder.m_types["CampaignMenuButtons"] = CampaignMenuButtons

View File

@ -0,0 +1,206 @@
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
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
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 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
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 )
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", {
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 )
self.StoreButton = f11_local6
end
f0_local3( self, f11_local1, controller )
return self
end
MenuBuilder.m_types["MPMainMenuButtons"] = MPMainMenuButtons

View File

@ -1,2 +1,5 @@
require("MPMainMenu")
require("CampaignMenuButtons")
require("CPMainMenu")
require("CPMainMenuButtons")
require("MissionsVerticalLayout")
require("MPMainMenuButtons")