Added rename pokemon hook
When Action is pressed on the Status tab, switch to Rename mode. For now, it just locks the menu until you press submit or cancel.pull/558/head
parent
bde7620ac0
commit
efe35774fe
|
|
@ -29,7 +29,8 @@ enum Page {
|
||||||
|
|
||||||
export enum SummaryUiMode {
|
export enum SummaryUiMode {
|
||||||
DEFAULT,
|
DEFAULT,
|
||||||
LEARN_MOVE
|
LEARN_MOVE,
|
||||||
|
RENAME,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class SummaryUiHandler extends UiHandler {
|
export default class SummaryUiHandler extends UiHandler {
|
||||||
|
|
@ -79,6 +80,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);
|
||||||
}
|
}
|
||||||
|
|
@ -265,6 +270,7 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
this.pokemon.cry();
|
this.pokemon.cry();
|
||||||
|
|
||||||
this.nameText.setText(this.pokemon.name);
|
this.nameText.setText(this.pokemon.name);
|
||||||
|
this.newName = this.pokemon.name;
|
||||||
|
|
||||||
const isFusion = this.pokemon.isFusion();
|
const isFusion = this.pokemon.isFusion();
|
||||||
|
|
||||||
|
|
@ -415,17 +421,31 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (this.renamePokemon) {
|
||||||
|
if (button === Button.SUBMIT) {
|
||||||
|
this.pokemon.name = this.newName;
|
||||||
|
this.hideRenamePokemon();
|
||||||
|
} else if (button === Button.CANCEL) {
|
||||||
|
this.newName = this.pokemon.name;
|
||||||
|
this.hideRenamePokemon();
|
||||||
|
}
|
||||||
} 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;
|
||||||
}
|
}
|
||||||
} 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);
|
||||||
|
|
@ -902,6 +922,13 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showRenamePokemon() {
|
||||||
|
this.renamePokemon = true;
|
||||||
|
}
|
||||||
|
hideRenamePokemon() {
|
||||||
|
this.renamePokemon = false;
|
||||||
|
}
|
||||||
|
|
||||||
showMoveSelect() {
|
showMoveSelect() {
|
||||||
this.moveSelect = true;
|
this.moveSelect = true;
|
||||||
this.extraMoveRowContainer.setVisible(true);
|
this.extraMoveRowContainer.setVisible(true);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue