diff options
author | Barichello <artur@barichello.me> | 2022-01-17 19:13:02 -0300 |
---|---|---|
committer | Barichello <artur@barichello.me> | 2022-01-17 21:21:45 -0300 |
commit | e0b8ff6ca17a3c8cf8c17ebd33cf109db574dba0 (patch) | |
tree | 5a1777a1dfe0756b00f9e8149449363324185e3a /Northstar.Client/mod/scripts/vscripts/ui | |
parent | 4c2bf1f7519d1164ea66c806f3c0a056f53c87a5 (diff) | |
download | NorthstarMods-e0b8ff6ca17a3c8cf8c17ebd33cf109db574dba0.tar.gz NorthstarMods-e0b8ff6ca17a3c8cf8c17ebd33cf109db574dba0.zip |
Fix controller prompts
Closes #126
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts/ui')
4 files changed, 37 insertions, 5 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/controller_prompts.nut b/Northstar.Client/mod/scripts/vscripts/ui/controller_prompts.nut new file mode 100644 index 00000000..1866f056 --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/ui/controller_prompts.nut @@ -0,0 +1,19 @@ +global function PrependControllerPrompts + +// Returns the string that gets turned into a controller prompt image in the front-end +string function ControllerButtonToStr( int buttonID ) +{ + switch (buttonID) + { + case BUTTON_Y: + return "%[Y_BUTTON|]%" + case BUTTON_X: + return "%[X_BUTTON|]%" + } + unreachable +} + +string function PrependControllerPrompts( int buttonID, string localizationKey ) +{ + return ControllerButtonToStr( buttonID ) + " " + Localize(localizationKey) +} diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut index cc681e95..6964c29d 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -15,7 +15,8 @@ void function AddNorthstarModMenu() void function AddNorthstarModMenu_MainMenuFooter() { - AddMenuFooterOption( GetMenu( "MainMenu" ), BUTTON_Y, "#Y_BUTTON_MENU_TITLE_MODS", "#MENU_TITLE_MODS", AdvanceToModListMenu ) + string controllerStr = PrependControllerPrompts( BUTTON_Y, "#MENU_TITLE_MODS" ) + AddMenuFooterOption( GetMenu( "MainMenu" ), BUTTON_Y, controllerStr, "#MENU_TITLE_MODS", AdvanceToModListMenu ) } void function AdvanceToModListMenu( var button ) @@ -30,8 +31,20 @@ void function InitModMenu() AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnModMenuOpened ) AddMenuEventHandler( menu, eUIEvent.MENU_CLOSE, OnModMenuClosed ) AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) - AddMenuFooterOption( menu, BUTTON_Y, "#Y_BUTTON_RELOAD_MODS", "#RELOAD_MODS", OnReloadModsButtonPressed ) - AddMenuFooterOption( menu, BUTTON_BACK, "#BACK_AUTHENTICATION_AGREEMENT", "#AUTHENTICATION_AGREEMENT", OnAuthenticationAgreementButtonPressed ) + AddMenuFooterOption( + menu, + BUTTON_X, + PrependControllerPrompts( BUTTON_X, "#RELOAD_MODS" ), + "#RELOAD_MODS", + OnReloadModsButtonPressed + ) + AddMenuFooterOption( + menu, + BUTTON_BACK, + PrependControllerPrompts( BUTTON_Y, "#AUTHENTICATION_AGREEMENT" ), + "#AUTHENTICATION_AGREEMENT", + OnAuthenticationAgreementButtonPressed + ) foreach ( var button in GetElementsByClassname( GetMenu( "ModListMenu" ), "ModButton" ) ) { diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut index 7aadce89..7c6c93fd 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -156,7 +156,7 @@ void function InitServerBrowserMenu() AddMenuEventHandler( file.menu, eUIEvent.MENU_CLOSE, OnCloseServerBrowserMenu ) AddMenuEventHandler( file.menu, eUIEvent.MENU_OPEN, OnServerBrowserMenuOpened ) AddMenuFooterOption( file.menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) - AddMenuFooterOption( file.menu, BUTTON_Y, "#Y_BUTTON_REFRESH_SERVERS", "#REFRESH_SERVERS", RefreshServers ) + AddMenuFooterOption( file.menu, BUTTON_Y, PrependControllerPrompts( BUTTON_Y, "#REFRESH_SERVERS" ), "#REFRESH_SERVERS", RefreshServers ) // Setup server buttons var width = 1120.0 * (GetScreenSize()[1] / 1080.0) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut b/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut index 02d77795..d6a7a29a 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut +++ b/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut @@ -631,4 +631,4 @@ void function Hud_SetNavUp( var buttonFrom, var buttonTo ) void function Hud_SetNavDown( var buttonFrom, var buttonTo ) { buttonFrom.SetNavDown( buttonTo ) -}
\ No newline at end of file +} |