From 1c17c193c593898970806f1c82c8bb343e31130a Mon Sep 17 00:00:00 2001 From: Greenlamp Date: Sun, 12 May 2024 01:43:27 +0200 Subject: [PATCH] fix icon position + added cancel sound --- src/ui/gamepad-binding-ui-handler.ts | 9 ++++----- src/ui/settings-gamepad-ui-handler.ts | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ui/gamepad-binding-ui-handler.ts b/src/ui/gamepad-binding-ui-handler.ts index 1d34c5285..34d106707 100644 --- a/src/ui/gamepad-binding-ui-handler.ts +++ b/src/ui/gamepad-binding-ui-handler.ts @@ -163,9 +163,6 @@ export default class GamepadBindingUiHandler extends UiHandler { break case Button.ACTION: if (this.cursor === 0) { - success = true; - // Reverts UI to its previous state on cancel. - // this.scene.ui.revertMode(); this.cancelFn(); } else { success = true; @@ -178,6 +175,8 @@ export default class GamepadBindingUiHandler extends UiHandler { // Plays a select sound effect if an action was successfully processed. if (success) ui.playSelect(); + else + ui.playError(); return success; } @@ -189,13 +188,13 @@ export default class GamepadBindingUiHandler extends UiHandler { this.actionLabel.setShadowColor(this.getTextColor(TextStyle.SETTINGS_SELECTED, true)); this.cancelLabel.setColor(this.getTextColor(TextStyle.WINDOW)); this.cancelLabel.setShadowColor(this.getTextColor(TextStyle.WINDOW, true)); - return; + return true; } this.actionLabel.setColor(this.getTextColor(TextStyle.WINDOW)); this.actionLabel.setShadowColor(this.getTextColor(TextStyle.WINDOW, true)); this.cancelLabel.setColor(this.getTextColor(TextStyle.SETTINGS_SELECTED)); this.cancelLabel.setShadowColor(this.getTextColor(TextStyle.SETTINGS_SELECTED, true)); - return; + return true; } clear() { diff --git a/src/ui/settings-gamepad-ui-handler.ts b/src/ui/settings-gamepad-ui-handler.ts index 1ea51419f..22e736e11 100644 --- a/src/ui/settings-gamepad-ui-handler.ts +++ b/src/ui/settings-gamepad-ui-handler.ts @@ -105,7 +105,7 @@ export default class SettingsGamepadUiHandler extends UiHandler { for (const [o, option] of settingGamepadOptions[SettingGamepad[setting]].entries()) { if (bindingSettings.includes(SettingGamepad[setting])) { if (o) { - const valueLabel = addTextObject(this.scene, 0, 0, option, settingGamepadDefaults[SettingGamepad[setting]] === o ? TextStyle.SETTINGS_SELECTED : TextStyle.WINDOW); + const valueLabel = addTextObject(this.scene, 0, 0, option, TextStyle.WINDOW); valueLabel.setOrigin(0, 0); optionsContainer.add(valueLabel); valueLabels.push(valueLabel); @@ -114,7 +114,7 @@ export default class SettingsGamepadUiHandler extends UiHandler { const key = getKeyForSettingName(config as GamepadConfig, SettingGamepad[setting]); const icon = this.scene.add.sprite(0, 0, config.padType); icon.setScale(0.1); - icon.setOrigin(0, 0); + icon.setOrigin(0, -0.1); inputsIcons[key] = icon; optionsContainer.add(icon); valueLabels.push(icon);