From 793d1b6f16ea3233e0b4dbd6e481ddb41a176d8b Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 30 Apr 2024 17:06:39 +0200 Subject: [PATCH] finalised the minor UI changes --- package-lock.json | 4 ++-- src/ui/party-ui-handler.ts | 15 +++++++++++---- src/ui/summary-ui-handler.ts | 37 ++++++++++++++++++++++++++++-------- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5521dcc86a8..ecaadf378ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pokemon-rogue-battle", - "version": "1.0.1", + "version": "1.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pokemon-rogue-battle", - "version": "1.0.1", + "version": "1.0.3", "dependencies": { "@material/material-color-utilities": "^0.2.7", "crypto-js": "^4.2.0", diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 14be7a17fad..29a4037f12f 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -383,6 +383,7 @@ export default class PartyUiHandler extends MessageUiHandler { } const slotCount = this.partySlots.length; + const battlerCount = this.scene.currentBattle.getBattlerCount(); switch (button) { case Button.UP: @@ -392,14 +393,20 @@ export default class PartyUiHandler extends MessageUiHandler { success = this.setCursor(this.cursor < 6 ? this.cursor < slotCount - 1 ? this.cursor + 1 : 6 : 0); break; case Button.LEFT: - if (this.cursor >= this.scene.currentBattle.getBattlerCount() && this.cursor <= 6) + if (this.cursor >= battlerCount && this.cursor <= 6) success = this.setCursor(0); break; case Button.RIGHT: - const battlerCount = this.scene.currentBattle.getBattlerCount(); - if (slotCount > battlerCount && this.cursor < battlerCount) - success = this.setCursor(this.lastCursor < 6 || this.lastCursor ? battlerCount : battlerCount); + if (slotCount === battlerCount){ + success = this.setCursor(6); break; + } else if (battlerCount >= 2 && slotCount > battlerCount && this.getCursor() === 0 && this.lastCursor === 1){ + success = this.setCursor(2); + break; + } else if (slotCount > battlerCount && this.cursor < battlerCount){ + success = this.setCursor(this.lastCursor < 6 ? this.lastCursor || battlerCount : battlerCount); + break; + } } } diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index d8fa4af91e8..9250c21f7e4 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -364,9 +364,16 @@ export default class SummaryUiHandler extends UiHandler { case Button.LEFT: this.moveSelect = false; this.setCursor(Page.STATS); - this.hideMoveEffect(); - success = true; - break; + if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE){ + this.hideMoveEffect(); + this.destroyBlinkCursor(); + success = true; + break; + } else { + this.hideMoveSelect(); + success = true; + break; + } } } } else { @@ -376,11 +383,13 @@ export default class SummaryUiHandler extends UiHandler { success = true; } } else if (button === Button.CANCEL) { - if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) + if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE){ this.hideMoveSelect(); - else + success = true; + } else { ui.setMode(Mode.PARTY); - success = true; + success = true; + } } else { const pages = Utils.getEnumValues(Page); switch (button) { @@ -524,6 +533,11 @@ export default class SummaryUiHandler extends UiHandler { this.setCursor(0, true); this.showMoveEffect(); } + else if (this.cursor===Page.MOVES) { + this.moveCursorObj = null; + this.showMoveSelect(); + this.showMoveEffect(); + } } else this.summaryPageTransitionContainer.x -= 214; @@ -841,6 +855,7 @@ export default class SummaryUiHandler extends UiHandler { } getSelectedMove(): Move { + console.log("selected moves") if (this.cursor !== Page.MOVES) return null; @@ -852,6 +867,7 @@ export default class SummaryUiHandler extends UiHandler { } showMoveSelect() { + console.log("show move select") this.moveSelect = true; this.extraMoveRowContainer.setVisible(true); this.selectedMoveIndex = -1; @@ -860,6 +876,7 @@ export default class SummaryUiHandler extends UiHandler { } hideMoveSelect() { + console.log("hide move select") if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) { this.moveSelectFunction(4); return; @@ -868,6 +885,12 @@ export default class SummaryUiHandler extends UiHandler { this.moveSelect = false; this.extraMoveRowContainer.setVisible(false); this.moveDescriptionText.setText(''); + + this.destroyBlinkCursor(); + this.hideMoveEffect(); + } + + destroyBlinkCursor(){ if (this.moveCursorBlinkTimer) { this.moveCursorBlinkTimer.destroy(); this.moveCursorBlinkTimer = null; @@ -880,8 +903,6 @@ export default class SummaryUiHandler extends UiHandler { this.selectedMoveCursorObj.destroy(); this.selectedMoveCursorObj = null; } - - this.hideMoveEffect(); } showMoveEffect(instant?: boolean) {