fix icon position + added cancel sound

pull/685/head
Greenlamp 2024-05-12 01:43:27 +02:00
parent 4c39fd068c
commit 1c17c193c5
2 changed files with 6 additions and 7 deletions

View File

@ -163,9 +163,6 @@ export default class GamepadBindingUiHandler extends UiHandler {
break break
case Button.ACTION: case Button.ACTION:
if (this.cursor === 0) { if (this.cursor === 0) {
success = true;
// Reverts UI to its previous state on cancel.
// this.scene.ui.revertMode();
this.cancelFn(); this.cancelFn();
} else { } else {
success = true; success = true;
@ -178,6 +175,8 @@ export default class GamepadBindingUiHandler extends UiHandler {
// Plays a select sound effect if an action was successfully processed. // Plays a select sound effect if an action was successfully processed.
if (success) if (success)
ui.playSelect(); ui.playSelect();
else
ui.playError();
return success; return success;
} }
@ -189,13 +188,13 @@ export default class GamepadBindingUiHandler extends UiHandler {
this.actionLabel.setShadowColor(this.getTextColor(TextStyle.SETTINGS_SELECTED, true)); this.actionLabel.setShadowColor(this.getTextColor(TextStyle.SETTINGS_SELECTED, true));
this.cancelLabel.setColor(this.getTextColor(TextStyle.WINDOW)); this.cancelLabel.setColor(this.getTextColor(TextStyle.WINDOW));
this.cancelLabel.setShadowColor(this.getTextColor(TextStyle.WINDOW, true)); this.cancelLabel.setShadowColor(this.getTextColor(TextStyle.WINDOW, true));
return; return true;
} }
this.actionLabel.setColor(this.getTextColor(TextStyle.WINDOW)); this.actionLabel.setColor(this.getTextColor(TextStyle.WINDOW));
this.actionLabel.setShadowColor(this.getTextColor(TextStyle.WINDOW, true)); this.actionLabel.setShadowColor(this.getTextColor(TextStyle.WINDOW, true));
this.cancelLabel.setColor(this.getTextColor(TextStyle.SETTINGS_SELECTED)); this.cancelLabel.setColor(this.getTextColor(TextStyle.SETTINGS_SELECTED));
this.cancelLabel.setShadowColor(this.getTextColor(TextStyle.SETTINGS_SELECTED, true)); this.cancelLabel.setShadowColor(this.getTextColor(TextStyle.SETTINGS_SELECTED, true));
return; return true;
} }
clear() { clear() {

View File

@ -105,7 +105,7 @@ export default class SettingsGamepadUiHandler extends UiHandler {
for (const [o, option] of settingGamepadOptions[SettingGamepad[setting]].entries()) { for (const [o, option] of settingGamepadOptions[SettingGamepad[setting]].entries()) {
if (bindingSettings.includes(SettingGamepad[setting])) { if (bindingSettings.includes(SettingGamepad[setting])) {
if (o) { 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); valueLabel.setOrigin(0, 0);
optionsContainer.add(valueLabel); optionsContainer.add(valueLabel);
valueLabels.push(valueLabel); valueLabels.push(valueLabel);
@ -114,7 +114,7 @@ export default class SettingsGamepadUiHandler extends UiHandler {
const key = getKeyForSettingName(config as GamepadConfig, SettingGamepad[setting]); const key = getKeyForSettingName(config as GamepadConfig, SettingGamepad[setting]);
const icon = this.scene.add.sprite(0, 0, config.padType); const icon = this.scene.add.sprite(0, 0, config.padType);
icon.setScale(0.1); icon.setScale(0.1);
icon.setOrigin(0, 0); icon.setOrigin(0, -0.1);
inputsIcons[key] = icon; inputsIcons[key] = icon;
optionsContainer.add(icon); optionsContainer.add(icon);
valueLabels.push(icon); valueLabels.push(icon);