Changes to summary UI
This commit is contained in:
1 parent
0287904371
commit
b77fd1755c
6 files changed
+42
-3
No files matched your search
@@ -2,8 +2,17 @@ import BattleScene from "../battle-scene";
|
||||
import { Mode } from "./ui";
|
||||
import UiHandler from "./uiHandler";
|
||||
|
||||
enum Page {
|
||||
PROFILE,
|
||||
MOVES
|
||||
}
|
||||
|
||||
export default class SummaryUiHandler extends UiHandler {
|
||||
private summaryContainer: Phaser.GameObjects.Container;
|
||||
private summaryPage: Phaser.GameObjects.Sprite;
|
||||
private summaryPageTransition: Phaser.GameObjects.Sprite;
|
||||
|
||||
private page: integer;
|
||||
|
||||
constructor(scene: BattleScene) {
|
||||
super(scene, Mode.SUMMARY);
|
||||
@@ -17,9 +26,29 @@ export default class SummaryUiHandler extends UiHandler {
|
||||
ui.add(this.summaryContainer);
|
||||
|
||||
const summaryBg = this.scene.add.image(0, 0, 'summary_bg');
|
||||
summaryBg.setOrigin(0, 1);
|
||||
this.summaryContainer.add(summaryBg);
|
||||
|
||||
summaryBg.setOrigin(0, 1);
|
||||
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()}`;
|
||||
}
|
||||
|
||||
show(args: any[]) {
|
||||
@@ -31,6 +60,11 @@ export default class SummaryUiHandler extends UiHandler {
|
||||
processInput(keyCode: integer) {
|
||||
const ui = this.getUi();
|
||||
const keyCodes = Phaser.Input.Keyboard.KeyCodes;
|
||||
|
||||
if (keyCode === keyCodes.X) {
|
||||
ui.setMode(Mode.PARTY);
|
||||
ui.playSelect();
|
||||
}
|
||||
}
|
||||
|
||||
setCursor(cursor: integer): boolean {
|
||||
@@ -44,5 +78,6 @@ export default class SummaryUiHandler extends UiHandler {
|
||||
clear() {
|
||||
super.clear();
|
||||
this.summaryContainer.setVisible(false);
|
||||
this.summaryPage.setVisible(false);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user