diff options
5 files changed, 41 insertions, 6 deletions
diff --git a/Northstar.Client/mod.json b/Northstar.Client/mod.json index fbaf1203..d40d7ed0 100644 --- a/Northstar.Client/mod.json +++ b/Northstar.Client/mod.json @@ -58,13 +58,16 @@ "Before": "AddNorthstarCustomMatchSettingsCategoryMenu" } }, - { "Path": "ui/menu_ns_custom_match_settings.nut", "RunOn": "UI", "UICallback": { "Before": "AddNorthstarCustomMatchSettingsMenu" } + }, + { + "Path": "ui/controller_prompts.nut", + "RunOn": "UI" } ], 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 +} |