Skip to content

Commit

Permalink
feat: Add Create a Class button to Server Browser
Browse files Browse the repository at this point in the history
  • Loading branch information
Lierrmm committed Aug 2, 2024
1 parent d9b0605 commit 8c29678
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 25 deletions.
24 changes: 1 addition & 23 deletions data/cdata/ui_scripts/MainMenu/MPMainMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -340,29 +340,7 @@ function MPMainMenu( menu, controller )
CODLogo:SetAnchorsAndPosition( 0, 0, 0, 0, _1080p * 108, _1080p * -1272, _1080p * 120, _1080p * -825 )
self:addElement( CODLogo )
self.CODLogo = CODLogo

local MenuTitle = nil

-- MenuTitle = LUI.UIStyledText.new()
-- MenuTitle.id = "MenuTitle"
-- MenuTitle:setText( ToUpperCase( Engine.Localize( "Welcome to IW7-Mod" ) ), 0 )
-- MenuTitle:SetFontSize( 50 * _1080p )
-- MenuTitle:SetFont( FONTS.GetFont( FONTS.MainMedium.File ) )
-- MenuTitle:SetAlignment( LUI.Alignment.Left )
-- MenuTitle:SetStartupDelay( 1250 )
-- MenuTitle:SetLineHoldTime( 400 )
-- MenuTitle:SetAnimMoveTime( 300 )
-- MenuTitle:SetEndDelay( 1000 )
-- MenuTitle:SetCrossfadeTime( 500 )
-- MenuTitle:SetAutoScrollStyle( LUI.UIStyledText.AutoScrollStyle.ScrollH )
-- MenuTitle:SetMaxVisibleLines( 1 )
-- MenuTitle:SetDecodeLetterLength( 25 )
-- MenuTitle:SetDecodeMaxRandChars( 3 )
-- MenuTitle:SetDecodeUpdatesPerLetter( 4 )
-- MenuTitle:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 130, _1080p * 660, _1080p * 296.5, _1080p * 346.5 )
-- self:addElement( MenuTitle )
-- self.MenuTitle = MenuTitle


self.addButtonHelperFunction = function ( f12_arg0, f12_arg1 )
f12_arg0:AddButtonHelperText( {
helper_text = Engine.Localize( "LUA_MENU_SELECT" ),
Expand Down
53 changes: 53 additions & 0 deletions data/cdata/ui_scripts/SystemLinkMenu/ServerButtons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,59 @@ function SystemLinkMenuButtons( menu, controller )
assert( f1_local1 )
local f1_local2 = self
self: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


if CONDITIONS.IsCoreMultiplayer( self ) then
f1_local5:addEventHandler( "button_action", function ( f2_arg0, f2_arg1 )
local f2_local0 = f2_arg1.controller or f1_local1
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
end

Expand Down
2 changes: 0 additions & 2 deletions data/cdata/ui_scripts/SystemLinkMenu/SysLinkBrowser.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
local f0_local0 = "frontEnd.systemLinkMenu.serverBrowser"

serverBrowserOffsets = {
10,
240,
Expand Down

0 comments on commit 8c29678

Please sign in to comment.