diff options
author | Neoministein <57015772+Neoministein@users.noreply.github.com> | 2022-03-06 23:49:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-06 19:49:22 -0300 |
commit | 544f34caca405614e1ede544c3b3466e9d5566bd (patch) | |
tree | 5ec3ff6fea828c8d947bd1b89821bd0c0ad4f508 /Northstar.Client/mod/scripts | |
parent | 38834a5e89d482f8152071e8341f662020dafea7 (diff) | |
download | NorthstarMods-544f34caca405614e1ede544c3b3466e9d5566bd.tar.gz NorthstarMods-544f34caca405614e1ede544c3b3466e9d5566bd.zip |
Add ability to have custom private match settings menus (#226)
Diffstat (limited to 'Northstar.Client/mod/scripts')
-rw-r--r-- | Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings_categories.nut | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings_categories.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings_categories.nut index be2a1048..7d5953b5 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings_categories.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings_categories.nut @@ -1,4 +1,11 @@ global function AddNorthstarCustomMatchSettingsCategoryMenu +global function AddCustomPrivateMatchSettingsCategory + +struct { + int count = 0 + array< string > customCategoryMenus + array< string > customCategoryLocalization +} file void function AddNorthstarCustomMatchSettingsCategoryMenu() { @@ -30,8 +37,15 @@ void function OnNorthstarCustomMatchSettingsCategoryMenuOpened() Hud_SetEnabled( button, false ) Hud_SetVisible( button, false ) } + + for ( int i = 0; i < file.count && i < buttons.len(); i++ ) + { + Hud_SetText( buttons[ i ], Localize( file.customCategoryLocalization[ i ] ) + " ->" ) + Hud_SetEnabled( buttons[ i ], true ) + Hud_SetVisible( buttons[ i ], true ) + } - for ( int i = 0, j = 0; j < categories.len() && i < buttons.len(); i++, j++ ) + for ( int i = file.count, j = 0; j < categories.len() && i < buttons.len(); i++, j++ ) { Hud_SetText( buttons[ i ], Localize( categories[ j ] ) + " ->" ) Hud_SetEnabled( buttons[ i ], true ) @@ -41,11 +55,26 @@ void function OnNorthstarCustomMatchSettingsCategoryMenuOpened() void function SelectPrivateMatchSettingsCategory( var button ) { - SetNextMatchSettingsCategory( GetPrivateMatchSettingCategories()[ int( Hud_GetScriptID( button ) ) ] ) - AdvanceMenu( GetMenu( "CustomMatchSettingsMenu" ) ) + int buttonId = int( Hud_GetScriptID( button ) ) + if (file.count <= buttonId) + { + SetNextMatchSettingsCategory( GetPrivateMatchSettingCategories()[ int( Hud_GetScriptID( button ) ) - file.count ] ) + AdvanceMenu( GetMenu( "CustomMatchSettingsMenu" ) ) + } + else + { + AdvanceMenu( GetMenu( file.customCategoryMenus[buttonId] ) ) + } } void function ResetMatchSettingsToDefault( var button ) { ClientCommand( "ResetMatchSettingsToDefault" ) +} + +void function AddCustomPrivateMatchSettingsCategory(string menuLocalization, string menuName) +{ + file.count++ + file.customCategoryMenus.append(menuName) + file.customCategoryLocalization.append(menuLocalization) }
\ No newline at end of file |