From d2a3e4bb2d62164a2564d5799e35069bf2703ae8 Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Wed, 15 Jan 2025 08:23:38 +0100 Subject: [PATCH] [UI/UX] Looping cursor in save slot selection screen (#5109) * Save slot selection allows looping * Removed debug logs --------- Co-authored-by: damocleas --- src/ui/save-slot-select-ui-handler.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ui/save-slot-select-ui-handler.ts b/src/ui/save-slot-select-ui-handler.ts index 13f5020e5ad..fe2ac9e1221 100644 --- a/src/ui/save-slot-select-ui-handler.ts +++ b/src/ui/save-slot-select-ui-handler.ts @@ -157,6 +157,12 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler { success = (this.cursor === 0) ? this.setCursor(this.cursor) : this.setCursor(this.cursor - 1, cursorPosition); } else if (this.scrollCursor) { success = this.setScrollCursor(this.scrollCursor - 1, cursorPosition); + } else if ((this.cursor === 0) && (this.scrollCursor === 0)) { + this.setScrollCursor(SESSION_SLOTS_COUNT - SLOTS_ON_SCREEN); + // Revert to avoid an extra session slot sticking out + this.revertSessionSlot(SESSION_SLOTS_COUNT - SLOTS_ON_SCREEN); + this.setCursor(SLOTS_ON_SCREEN - 1); + success = true; } break; case Button.DOWN: @@ -164,6 +170,11 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler { success = this.setCursor(this.cursor + 1, cursorPosition); } else if (this.scrollCursor < SESSION_SLOTS_COUNT - SLOTS_ON_SCREEN) { success = this.setScrollCursor(this.scrollCursor + 1, cursorPosition); + } else if ((this.cursor === SLOTS_ON_SCREEN - 1) && (this.scrollCursor === SESSION_SLOTS_COUNT - SLOTS_ON_SCREEN)) { + this.setScrollCursor(0); + this.revertSessionSlot(SLOTS_ON_SCREEN - 1); + this.setCursor(0); + success = true; } break; case Button.RIGHT: