mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-01-27 03:07:28 +00:00
bac6c22973
* eslint config + packages * updated eslint config * fix the issue eslint adding ;;;; at interfaces * first round with eslint --fix . * removed config for unused export * Revert "first round with eslint --fix ." This reverts commit 77a88e0895f7c3389cb223651b90d918af778fe9. * removed config for camelCase * for real this time, first round of eslint --fix . * halfway to manual eslint fix * eslint done * added "how to setup" the hook to eslint --fix each new file before commit (if wanted) * removed eslintrc config file duplicat * fix human error + ignore build folder + merge overrides * added curly brace style + eslint * applied double quote linter rule * added lefthook * test precommit * test precommit * test precommit * test precommit * test precommit * test precommit * test precommit * github action to run eslint * added node_modules to ignore eslint * different action for typescript * no need for different glob (default src) * node 20 * node 20 * removed no longer needed install file * remove hooks part from README * eslint fixes --------- Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt>
101 lines
2.7 KiB
TypeScript
101 lines
2.7 KiB
TypeScript
import BattleScene from "../battle-scene";
|
|
import MessageUiHandler from "./message-ui-handler";
|
|
import { TextStyle, addTextObject } from "./text";
|
|
import { Mode } from "./ui";
|
|
import {Button} from "../enums/buttons";
|
|
|
|
export default class EvolutionSceneHandler extends MessageUiHandler {
|
|
public evolutionContainer: Phaser.GameObjects.Container;
|
|
public messageBg: Phaser.GameObjects.Image;
|
|
public messageContainer: Phaser.GameObjects.Container;
|
|
public canCancel: boolean;
|
|
public cancelled: boolean;
|
|
|
|
constructor(scene: BattleScene) {
|
|
super(scene, Mode.EVOLUTION_SCENE);
|
|
}
|
|
|
|
setup() {
|
|
this.canCancel = false;
|
|
this.cancelled = false;
|
|
|
|
const ui = this.getUi();
|
|
|
|
this.evolutionContainer = this.scene.add.container(0, -this.scene.game.canvas.height / 6);
|
|
ui.add(this.evolutionContainer);
|
|
|
|
const messageBg = this.scene.add.sprite(0, 0, "bg", this.scene.windowType);
|
|
messageBg.setOrigin(0, 1);
|
|
messageBg.setVisible(false);
|
|
ui.add(messageBg);
|
|
|
|
this.messageBg = messageBg;
|
|
|
|
this.messageContainer = this.scene.add.container(12, -39);
|
|
this.messageContainer.setVisible(false);
|
|
ui.add(this.messageContainer);
|
|
|
|
const message = addTextObject(this.scene, 0, 0, "", TextStyle.MESSAGE, {
|
|
maxLines: 2,
|
|
wordWrap: {
|
|
width: 1780
|
|
}
|
|
});
|
|
this.messageContainer.add(message);
|
|
|
|
this.message = message;
|
|
|
|
const prompt = this.scene.add.sprite(0, 0, "prompt");
|
|
prompt.setVisible(false);
|
|
prompt.setOrigin(0, 0);
|
|
this.messageContainer.add(prompt);
|
|
|
|
this.prompt = prompt;
|
|
}
|
|
|
|
show(_args: any[]): boolean {
|
|
super.show(_args);
|
|
|
|
this.scene.ui.bringToTop(this.evolutionContainer);
|
|
this.scene.ui.bringToTop(this.messageBg);
|
|
this.scene.ui.bringToTop(this.messageContainer);
|
|
this.messageBg.setVisible(true);
|
|
this.messageContainer.setVisible(true);
|
|
|
|
return true;
|
|
}
|
|
|
|
processInput(button: Button): boolean {
|
|
if (this.canCancel && !this.cancelled && button === Button.CANCEL) {
|
|
this.cancelled = true;
|
|
return true;
|
|
}
|
|
|
|
const ui = this.getUi();
|
|
if (this.awaitingActionInput) {
|
|
if (button === Button.CANCEL || button === Button.ACTION) {
|
|
if (this.onActionInput) {
|
|
ui.playSelect();
|
|
const originalOnActionInput = this.onActionInput;
|
|
this.onActionInput = null;
|
|
originalOnActionInput();
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
setCursor(_cursor: integer): boolean {
|
|
return false;
|
|
}
|
|
|
|
clear() {
|
|
this.clearText();
|
|
this.canCancel = false;
|
|
this.cancelled = false;
|
|
this.evolutionContainer.removeAll(true);
|
|
this.messageContainer.setVisible(false);
|
|
this.messageBg.setVisible(false);
|
|
}
|
|
}
|