diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 35f3e34ad..06d740825 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -30,7 +30,8 @@ enum Page { export enum SummaryUiMode { DEFAULT, - LEARN_MOVE + LEARN_MOVE, + RENAME, } /** Holds all objects related to an ability for each iteration */ @@ -100,6 +101,10 @@ export default class SummaryUiHandler extends UiHandler { private moveCursor: integer; private selectedMoveIndex: integer; + private renamePokemon: boolean; + private newName: string; + private isCapitalized: boolean; + constructor(scene: BattleScene) { super(scene, Mode.SUMMARY); } @@ -378,7 +383,7 @@ export default class SummaryUiHandler extends UiHandler { this.status.setFrame(this.pokemon.status ? StatusEffect[this.pokemon.status.effect].toLowerCase() : 'pokerus'); } else this.hideStatus(!fromSummary); - + return true; } @@ -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 { if (button === Button.ACTION) { if (this.cursor === Page.MOVES) { this.showMoveSelect(); 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.. 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); } } else if (button === Button.CANCEL) { - if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) + if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) { this.hideMoveSelect(); - else + } else if (this.summaryUiMode === SummaryUiMode.RENAME) { + this.hideRenamePokemon(); + } else { ui.setMode(Mode.PARTY); + } success = true; } else { const pages = Utils.getEnumValues(Page); @@ -987,6 +1007,17 @@ export default class SummaryUiHandler extends UiHandler { 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() { this.moveSelect = true; this.extraMoveRowContainer.setVisible(true); @@ -1071,6 +1102,11 @@ export default class SummaryUiHandler extends UiHandler { } this.hideMoveEffect(true); } + if (this.renamePokemon) { + this.renamePokemon = false; + this.newName = this.pokemon.name; + this.isCapitalized = true; + } this.summaryContainer.setVisible(false); this.summaryPageContainer.setVisible(false); }