pull/558/merge
Robert Antonius 2024-05-14 17:06:52 +10:00 committed by GitHub
commit 935bc11be7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 40 additions and 4 deletions

View File

@ -30,7 +30,8 @@ enum Page {
export enum SummaryUiMode { export enum SummaryUiMode {
DEFAULT, DEFAULT,
LEARN_MOVE LEARN_MOVE,
RENAME,
} }
/** Holds all objects related to an ability for each iteration */ /** Holds all objects related to an ability for each iteration */
@ -100,6 +101,10 @@ export default class SummaryUiHandler extends UiHandler {
private moveCursor: integer; private moveCursor: integer;
private selectedMoveIndex: integer; private selectedMoveIndex: integer;
private renamePokemon: boolean;
private newName: string;
private isCapitalized: boolean;
constructor(scene: BattleScene) { constructor(scene: BattleScene) {
super(scene, Mode.SUMMARY); super(scene, Mode.SUMMARY);
} }
@ -454,11 +459,23 @@ export default class SummaryUiHandler extends UiHandler {
} }
} }
} }
} else if (this.renamePokemon) {
if (button === Button.SUBMIT) {
this.pokemon.name = this.newName;
this.hideRenamePokemon();
success = true;
} else if (button === Button.CANCEL) {
this.hideRenamePokemon();
success = true;
}
} else { } else {
if (button === Button.ACTION) { if (button === Button.ACTION) {
if (this.cursor === Page.MOVES) { if (this.cursor === Page.MOVES) {
this.showMoveSelect(); this.showMoveSelect();
success = true; success = true;
} else if (this.cursor === Page.STATUS) {
this.showRenamePokemon();
success = true;
} }
// if we're on the PROFILE page and this pokemon has a passive unlocked.. // if we're on the PROFILE page and this pokemon has a passive unlocked..
else if (this.cursor === Page.PROFILE && this.pokemon.hasPassive()) { else if (this.cursor === Page.PROFILE && this.pokemon.hasPassive()) {
@ -472,10 +489,13 @@ export default class SummaryUiHandler extends UiHandler {
this.passiveContainer.labelImage.setVisible(!this.passiveContainer.labelImage.visible); this.passiveContainer.labelImage.setVisible(!this.passiveContainer.labelImage.visible);
} }
} 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 } else if (this.summaryUiMode === SummaryUiMode.RENAME) {
this.hideRenamePokemon();
} 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);
@ -987,6 +1007,17 @@ export default class SummaryUiHandler extends UiHandler {
return null; return null;
} }
showRenamePokemon() {
this.renamePokemon = true;
this.newName = this.pokemon.name;
this.isCapitalized = true;
}
hideRenamePokemon() {
this.renamePokemon = false;
this.newName = this.pokemon.name;
this.isCapitalized = true;
}
showMoveSelect() { showMoveSelect() {
this.moveSelect = true; this.moveSelect = true;
this.extraMoveRowContainer.setVisible(true); this.extraMoveRowContainer.setVisible(true);
@ -1071,6 +1102,11 @@ export default class SummaryUiHandler extends UiHandler {
} }
this.hideMoveEffect(true); this.hideMoveEffect(true);
} }
if (this.renamePokemon) {
this.renamePokemon = false;
this.newName = this.pokemon.name;
this.isCapitalized = true;
}
this.summaryContainer.setVisible(false); this.summaryContainer.setVisible(false);
this.summaryPageContainer.setVisible(false); this.summaryPageContainer.setVisible(false);
} }