[Feature] Show app version on title screen (#4344)

* feat: show app version on title screen

* fix: adjust app version positions

* update app version text

---------

Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>
This commit is contained in:
fransdhinta 2024-09-30 08:18:52 +07:00 committed by GitHub
parent b43620b8c5
commit 4160aefd93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import { TextStyle, addTextObject, getTextStyleOptions } from "./text";
import { getSplashMessages } from "../data/splash-messages";
import i18next from "i18next";
import { TimedEventDisplay } from "#app/timed-event-manager";
import { version } from "../../package.json";
export default class TitleUiHandler extends OptionSelectUiHandler {
/** If the stats can not be retrieved, use this fallback value */
@ -16,6 +17,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
private splashMessage: string;
private splashMessageText: Phaser.GameObjects.Text;
private eventDisplay: TimedEventDisplay;
private appVersionText: Phaser.GameObjects.Text;
private titleStatsTimer: NodeJS.Timeout | null;
@ -68,6 +70,11 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
loop: -1,
yoyo: true,
});
this.appVersionText = addTextObject(this.scene, logo.x - 60, logo.y + logo.displayHeight + 4, "", TextStyle.MONEY, { fontSize: "54px" });
this.appVersionText.setOrigin(0.5, 0.5);
this.appVersionText.setAngle(0);
this.titleContainer.add(this.appVersionText);
}
updateTitleStats(): void {
@ -91,6 +98,8 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
this.splashMessage = Utils.randItem(getSplashMessages());
this.splashMessageText.setText(i18next.t(this.splashMessage, { count: TitleUiHandler.BATTLES_WON_FALLBACK }));
this.appVersionText.setText("v"+version);
const ui = this.getUi();
if (this.scene.eventManager.isEventActive()) {