finalised the minor UI changes

This commit is contained in:
Paul 2024-04-30 17:06:39 +02:00
parent 8cf7577ec7
commit 793d1b6f16
3 changed files with 42 additions and 14 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "pokemon-rogue-battle", "name": "pokemon-rogue-battle",
"version": "1.0.1", "version": "1.0.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "pokemon-rogue-battle", "name": "pokemon-rogue-battle",
"version": "1.0.1", "version": "1.0.3",
"dependencies": { "dependencies": {
"@material/material-color-utilities": "^0.2.7", "@material/material-color-utilities": "^0.2.7",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",

View File

@ -383,6 +383,7 @@ export default class PartyUiHandler extends MessageUiHandler {
} }
const slotCount = this.partySlots.length; const slotCount = this.partySlots.length;
const battlerCount = this.scene.currentBattle.getBattlerCount();
switch (button) { switch (button) {
case Button.UP: 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); success = this.setCursor(this.cursor < 6 ? this.cursor < slotCount - 1 ? this.cursor + 1 : 6 : 0);
break; break;
case Button.LEFT: case Button.LEFT:
if (this.cursor >= this.scene.currentBattle.getBattlerCount() && this.cursor <= 6) if (this.cursor >= battlerCount && this.cursor <= 6)
success = this.setCursor(0); success = this.setCursor(0);
break; break;
case Button.RIGHT: case Button.RIGHT:
const battlerCount = this.scene.currentBattle.getBattlerCount(); if (slotCount === battlerCount){
if (slotCount > battlerCount && this.cursor < battlerCount) success = this.setCursor(6);
success = this.setCursor(this.lastCursor < 6 || this.lastCursor ? battlerCount : battlerCount);
break; 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;
}
} }
} }

View File

@ -364,9 +364,16 @@ export default class SummaryUiHandler extends UiHandler {
case Button.LEFT: case Button.LEFT:
this.moveSelect = false; this.moveSelect = false;
this.setCursor(Page.STATS); this.setCursor(Page.STATS);
this.hideMoveEffect(); if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE){
success = true; this.hideMoveEffect();
break; this.destroyBlinkCursor();
success = true;
break;
} else {
this.hideMoveSelect();
success = true;
break;
}
} }
} }
} else { } else {
@ -376,11 +383,13 @@ export default class SummaryUiHandler extends UiHandler {
success = true; success = true;
} }
} else if (button === Button.CANCEL) { } else if (button === Button.CANCEL) {
if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE){
this.hideMoveSelect(); this.hideMoveSelect();
else success = true;
} else {
ui.setMode(Mode.PARTY); ui.setMode(Mode.PARTY);
success = true; success = true;
}
} else { } else {
const pages = Utils.getEnumValues(Page); const pages = Utils.getEnumValues(Page);
switch (button) { switch (button) {
@ -524,6 +533,11 @@ export default class SummaryUiHandler extends UiHandler {
this.setCursor(0, true); this.setCursor(0, true);
this.showMoveEffect(); this.showMoveEffect();
} }
else if (this.cursor===Page.MOVES) {
this.moveCursorObj = null;
this.showMoveSelect();
this.showMoveEffect();
}
} }
else else
this.summaryPageTransitionContainer.x -= 214; this.summaryPageTransitionContainer.x -= 214;
@ -841,6 +855,7 @@ export default class SummaryUiHandler extends UiHandler {
} }
getSelectedMove(): Move { getSelectedMove(): Move {
console.log("selected moves")
if (this.cursor !== Page.MOVES) if (this.cursor !== Page.MOVES)
return null; return null;
@ -852,6 +867,7 @@ export default class SummaryUiHandler extends UiHandler {
} }
showMoveSelect() { showMoveSelect() {
console.log("show move select")
this.moveSelect = true; this.moveSelect = true;
this.extraMoveRowContainer.setVisible(true); this.extraMoveRowContainer.setVisible(true);
this.selectedMoveIndex = -1; this.selectedMoveIndex = -1;
@ -860,6 +876,7 @@ export default class SummaryUiHandler extends UiHandler {
} }
hideMoveSelect() { hideMoveSelect() {
console.log("hide move select")
if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) { if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) {
this.moveSelectFunction(4); this.moveSelectFunction(4);
return; return;
@ -868,6 +885,12 @@ export default class SummaryUiHandler extends UiHandler {
this.moveSelect = false; this.moveSelect = false;
this.extraMoveRowContainer.setVisible(false); this.extraMoveRowContainer.setVisible(false);
this.moveDescriptionText.setText(''); this.moveDescriptionText.setText('');
this.destroyBlinkCursor();
this.hideMoveEffect();
}
destroyBlinkCursor(){
if (this.moveCursorBlinkTimer) { if (this.moveCursorBlinkTimer) {
this.moveCursorBlinkTimer.destroy(); this.moveCursorBlinkTimer.destroy();
this.moveCursorBlinkTimer = null; this.moveCursorBlinkTimer = null;
@ -880,8 +903,6 @@ export default class SummaryUiHandler extends UiHandler {
this.selectedMoveCursorObj.destroy(); this.selectedMoveCursorObj.destroy();
this.selectedMoveCursorObj = null; this.selectedMoveCursorObj = null;
} }
this.hideMoveEffect();
} }
showMoveEffect(instant?: boolean) { showMoveEffect(instant?: boolean) {