From 060e10b24a20acd2ba4157d3a49e570d2e38a00d Mon Sep 17 00:00:00 2001 From: Liana P <32243840+liana-p@users.noreply.github.com> Date: Sat, 31 Aug 2024 19:23:46 +0100 Subject: [PATCH] fix: debug jump now working again --- .../src/components/debug/debug-jumping.vue | 2 +- .../src/components/game-splash/game-splash.vue | 2 +- .../src/components/inventory/item-details.vue | 2 +- .../narrat/src/components/utils/alert-modal.vue | 2 +- packages/narrat/src/components/utils/yes-no.vue | 2 +- packages/narrat/src/inputs/useNavigation.ts | 8 ++++---- packages/narrat/src/stores/inputs-store.ts | 17 ++++++++++++++++- 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/packages/narrat/src/components/debug/debug-jumping.vue b/packages/narrat/src/components/debug/debug-jumping.vue index af0c36f5..51023bc0 100644 --- a/packages/narrat/src/components/debug/debug-jumping.vue +++ b/packages/narrat/src/components/debug/debug-jumping.vue @@ -101,7 +101,7 @@ onMounted(() => { } }, }, - continue: { + confirm: { press: () => { if ( matches.value.length > 0 && diff --git a/packages/narrat/src/components/game-splash/game-splash.vue b/packages/narrat/src/components/game-splash/game-splash.vue index 180285b8..3661c88f 100644 --- a/packages/narrat/src/components/game-splash/game-splash.vue +++ b/packages/narrat/src/components/game-splash/game-splash.vue @@ -44,7 +44,7 @@ function goToStartMenu() { } onMounted(() => { inputListener.value = useInputs().registerInputListener('game-splash', { - continue: { + confirm: { press: () => { goToStartMenu(); }, diff --git a/packages/narrat/src/components/inventory/item-details.vue b/packages/narrat/src/components/inventory/item-details.vue index bc672c10..ed0b53d7 100644 --- a/packages/narrat/src/components/inventory/item-details.vue +++ b/packages/narrat/src/components/inventory/item-details.vue @@ -59,7 +59,7 @@ function close() { onMounted(() => { listener.value = useInputs().registerInputListener('item-details', { - continue: { + confirm: { press: () => { if (canUse.value) { use(); diff --git a/packages/narrat/src/components/utils/alert-modal.vue b/packages/narrat/src/components/utils/alert-modal.vue index 308f4a94..315d870d 100644 --- a/packages/narrat/src/components/utils/alert-modal.vue +++ b/packages/narrat/src/components/utils/alert-modal.vue @@ -38,7 +38,7 @@ const inputListener = ref( close(); }, }, - continue: { + confirm: { press: () => { close(); }, diff --git a/packages/narrat/src/components/utils/yes-no.vue b/packages/narrat/src/components/utils/yes-no.vue index c683b8d9..b31c6c1e 100644 --- a/packages/narrat/src/components/utils/yes-no.vue +++ b/packages/narrat/src/components/utils/yes-no.vue @@ -26,7 +26,7 @@ const listener = ref( chosen(false); }, }, - continue: { + confirm: { press: () => { chosen(true); }, diff --git a/packages/narrat/src/inputs/useNavigation.ts b/packages/narrat/src/inputs/useNavigation.ts index 66c97cac..e966589f 100644 --- a/packages/narrat/src/inputs/useNavigation.ts +++ b/packages/narrat/src/inputs/useNavigation.ts @@ -177,7 +177,7 @@ export function useNavigation(options: NavigationOptions) { } } - function buttonContinue() { + function buttonConfirm() { if (options.onChosen) { options.onChosen(selectedIndex.value); } @@ -199,7 +199,7 @@ export function useNavigation(options: NavigationOptions) { delete options.listener.actions.down; } if (!options.noChoosing) { - delete options.listener.actions.continue; + delete options.listener.actions.confirm; } if (changeInputListener.value) { inputs.removeEventListener('change-input', changeInputListener.value); @@ -246,8 +246,8 @@ export function useNavigation(options: NavigationOptions) { }; } if (!options.noChoosing) { - options.listener.actions.continue = { - press: buttonContinue, + options.listener.actions.confirm = { + press: buttonConfirm, }; } select(0); diff --git a/packages/narrat/src/stores/inputs-store.ts b/packages/narrat/src/stores/inputs-store.ts index 258ce0e6..0a090c00 100644 --- a/packages/narrat/src/stores/inputs-store.ts +++ b/packages/narrat/src/stores/inputs-store.ts @@ -103,7 +103,7 @@ const defaultActions: Action[] = [ label: 'Continue', keyboardIcon: 'img/ui/button-prompts/keyboard/key-space.png', gamepadIcon: 'img/ui/button-prompts/gamepad/facebutton-down.png', - showInLegend: true, + showInLegend: false, keybinds: [ { keyboardKey: 'Space', @@ -111,6 +111,21 @@ const defaultActions: Action[] = [ }, ], }, + { + id: 'confirm', + type: 'button', + action: 'press', + label: 'Confirm', + keyboardIcon: 'img/ui/button-prompts/keyboard/key-enter.png', + gamepadIcon: 'img/ui/button-prompts/gamepad/facebutton-down.png', + showInLegend: true, + keybinds: [ + { + keyboardKey: 'Enter', + gamepadButton: 0, + }, + ], + }, { id: 'cancel', type: 'button',