Save slot selection allows looping

This commit is contained in:
Wlowscha 2025-01-10 23:48:45 +01:00
parent 10e0f9f0de
commit 4a4ce3face
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04

View File

@ -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:
@ -174,6 +185,7 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
}
}
console.log(this.cursor, this.scrollCursor);
if (success) {
ui.playSelect();
} else if (error) {