2023-04-05 05:35:15 -07:00
|
|
|
import BattleScene from "../battle-scene";
|
|
|
|
import { Mode } from "./ui";
|
|
|
|
import UiHandler from "./uiHandler";
|
|
|
|
|
2023-04-06 07:05:12 -07:00
|
|
|
enum Page {
|
|
|
|
PROFILE,
|
|
|
|
MOVES
|
|
|
|
}
|
|
|
|
|
2023-04-05 05:35:15 -07:00
|
|
|
export default class SummaryUiHandler extends UiHandler {
|
|
|
|
private summaryContainer: Phaser.GameObjects.Container;
|
2023-04-06 07:05:12 -07:00
|
|
|
private summaryPage: Phaser.GameObjects.Sprite;
|
|
|
|
private summaryPageTransition: Phaser.GameObjects.Sprite;
|
|
|
|
|
|
|
|
private page: integer;
|
2023-04-05 05:35:15 -07:00
|
|
|
|
|
|
|
constructor(scene: BattleScene) {
|
|
|
|
super(scene, Mode.SUMMARY);
|
|
|
|
}
|
|
|
|
|
|
|
|
setup() {
|
|
|
|
const ui = this.getUi();
|
|
|
|
|
|
|
|
this.summaryContainer = this.scene.add.container(0, 0);
|
|
|
|
this.summaryContainer.setVisible(false);
|
|
|
|
ui.add(this.summaryContainer);
|
|
|
|
|
|
|
|
const summaryBg = this.scene.add.image(0, 0, 'summary_bg');
|
2023-04-06 07:05:12 -07:00
|
|
|
summaryBg.setOrigin(0, 1);
|
2023-04-05 05:35:15 -07:00
|
|
|
this.summaryContainer.add(summaryBg);
|
|
|
|
|
2023-04-06 07:05:12 -07:00
|
|
|
this.page = 0;
|
|
|
|
|
|
|
|
this.summaryPage = this.scene.add.sprite(106, 21, this.getPageKey());
|
|
|
|
this.summaryPage.setVisible(false);
|
|
|
|
this.summaryContainer.add(this.summaryPage);
|
|
|
|
}
|
|
|
|
|
|
|
|
setPage(newPage: integer) {
|
|
|
|
this.page = newPage;
|
|
|
|
|
|
|
|
if (this.summaryPage.visible) {
|
|
|
|
|
|
|
|
} else {
|
|
|
|
this.summaryPage.setTexture(this.getPageKey());
|
|
|
|
this.summaryPage.setVisible(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
getPageKey() {
|
|
|
|
return `summary_${Page[this.page].toLowerCase()}`;
|
2023-04-05 05:35:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
show(args: any[]) {
|
|
|
|
super.show(args);
|
|
|
|
|
|
|
|
this.summaryContainer.setVisible(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
processInput(keyCode: integer) {
|
|
|
|
const ui = this.getUi();
|
|
|
|
const keyCodes = Phaser.Input.Keyboard.KeyCodes;
|
2023-04-06 07:05:12 -07:00
|
|
|
|
|
|
|
if (keyCode === keyCodes.X) {
|
|
|
|
ui.setMode(Mode.PARTY);
|
|
|
|
ui.playSelect();
|
|
|
|
}
|
2023-04-05 05:35:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
setCursor(cursor: integer): boolean {
|
|
|
|
const changed = this.cursor !== cursor;
|
|
|
|
if (changed) {
|
|
|
|
}
|
|
|
|
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
|
|
|
clear() {
|
|
|
|
super.clear();
|
|
|
|
this.summaryContainer.setVisible(false);
|
2023-04-06 07:05:12 -07:00
|
|
|
this.summaryPage.setVisible(false);
|
2023-04-05 05:35:15 -07:00
|
|
|
}
|
|
|
|
}
|