pokerogue/src/phases/end-card-phase.ts

41 lines
1.3 KiB
TypeScript
Raw Normal View History

import { globalScene } from "#app/global-scene";
import { PlayerGender } from "#app/enums/player-gender";
import { Phase } from "#app/phase";
import { addTextObject, TextStyle } from "#app/ui/text";
2024-08-19 03:23:52 +01:00
import i18next from "i18next";
export class EndCardPhase extends Phase {
public endCard: Phaser.GameObjects.Image;
public text: Phaser.GameObjects.Text;
constructor() {
super();
2024-08-19 03:23:52 +01:00
}
start(): void {
super.start();
globalScene.ui.getMessageHandler().bg.setVisible(false);
globalScene.ui.getMessageHandler().nameBoxContainer.setVisible(false);
2024-08-19 03:23:52 +01:00
this.endCard = globalScene.add.image(0, 0, `end_${globalScene.gameData.gender === PlayerGender.FEMALE ? "f" : "m"}`);
2024-08-19 03:23:52 +01:00
this.endCard.setOrigin(0);
this.endCard.setScale(0.5);
globalScene.field.add(this.endCard);
2024-08-19 03:23:52 +01:00
this.text = addTextObject(globalScene.game.canvas.width / 12, (globalScene.game.canvas.height / 6) - 16, i18next.t("battle:congratulations"), TextStyle.SUMMARY, { fontSize: "128px" });
2024-08-19 03:23:52 +01:00
this.text.setOrigin(0.5);
globalScene.field.add(this.text);
2024-08-19 03:23:52 +01:00
globalScene.ui.clearText();
2024-08-19 03:23:52 +01:00
globalScene.ui.fadeIn(1000).then(() => {
2024-08-19 03:23:52 +01:00
globalScene.ui.showText("", null, () => {
globalScene.ui.getMessageHandler().bg.setVisible(true);
2024-08-19 03:23:52 +01:00
this.end();
}, null, true);
});
}
}