Add proper title screen and logo

This commit is contained in:
Flashfyre committed 2024-03-21 13:12:05 -04:00
1 parent 7189258095
commit cf959c6e1b
9 files changed
+108 -40

No files matched your search

+1 -9
View File
@@ -40,8 +40,6 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
this.loadingLabel.setVisible(false);
this.add(this.loadingLabel);
this.setVisible(false);
}
updateRankings(rankings: RankingEntry[]) {
@@ -72,7 +70,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
});
}
showAndUpdate() {
update() {
this.rankingsContainer.removeAll(true);
this.loadingLabel.setText('Loading…');
@@ -87,12 +85,6 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
} else
this.loadingLabel.setText('No Rankings');
});
this.setVisible(true);
}
hide() {
this.setVisible(false);
}
}
+1 -1
View File
@@ -290,7 +290,7 @@ class SessionSlot extends Phaser.GameObjects.Container {
this.hasData = true;
await this.setupWithData(sessionData);
resolve(true);
})
});
});
}
}
+65
View File
@@ -0,0 +1,65 @@
import BattleScene from "../battle-scene";
import { DailyRunScoreboard } from "./daily-run-scoreboard";
import OptionSelectUiHandler from "./option-select-ui-handler";
import { Mode } from "./ui";
import * as Utils from "../utils";
export default class TitleUiHandler extends OptionSelectUiHandler {
private titleContainer: Phaser.GameObjects.Container;
private dailyRunScoreboard: DailyRunScoreboard;
constructor(scene: BattleScene, mode: Mode = Mode.TITLE) {
super(scene, mode);
}
setup() {
super.setup();
const ui = this.getUi();
this.titleContainer = this.scene.add.container(0, -(this.scene.game.canvas.height / 6));
this.titleContainer.setAlpha(0);
ui.add(this.titleContainer);
const logo = this.scene.add.image((this.scene.game.canvas.width / 6) / 2, 8, 'logo');
logo.setOrigin(0.5, 0);
this.titleContainer.add(logo);
this.dailyRunScoreboard = new DailyRunScoreboard(this.scene, 1, 49);
this.dailyRunScoreboard.setup();
this.titleContainer.add(this.dailyRunScoreboard);
}
show(args: any[]): boolean {
const ret = super.show(args);
if (ret) {
const ui = this.getUi();
this.dailyRunScoreboard.update();
this.scene.tweens.add({
targets: [ this.titleContainer, ui.getMessageHandler().bg ],
duration: Utils.fixedInt(325),
alpha: (target: any) => target === this.titleContainer ? 1 : 0,
ease: 'Sine.easeInOut'
});
}
return ret;
}
clear(): void {
super.clear();
const ui = this.getUi();
this.scene.tweens.add({
targets: [ this.titleContainer, ui.getMessageHandler().bg ],
duration: Utils.fixedInt(325),
alpha: (target: any) => target === this.titleContainer ? 0 : 1,
ease: 'Sine.easeInOut'
});
}
}
+4
View File
@@ -31,9 +31,11 @@ import * as Utils from "../utils";
import GameStatsUiHandler from './game-stats-ui-handler';
import AwaitableUiHandler from './awaitable-ui-handler';
import SaveSlotSelectUiHandler from './save-slot-select-ui-handler';
import TitleUiHandler from './title-ui-handler';
export enum Mode {
MESSAGE,
TITLE,
COMMAND,
FIGHT,
BALL,
@@ -73,6 +75,7 @@ const transitionModes = [
];
const noTransitionModes = [
Mode.TITLE,
Mode.CONFIRM,
Mode.OPTION_SELECT,
Mode.MENU,
@@ -107,6 +110,7 @@ export default class UI extends Phaser.GameObjects.Container {
this.modeChain = [];
this.handlers = [
new BattleMessageUiHandler(scene),
new TitleUiHandler(scene),
new CommandUiHandler(scene),
new FightUiHandler(scene),
new BallUiHandler(scene),