Add familiar splash messages
parent
67e3ea13d5
commit
702c28e555
|
@ -0,0 +1,18 @@
|
|||
export const splashMessages = [
|
||||
'Join the Discord!',
|
||||
'Infinite Levels!',
|
||||
'Optional Save Scumming!',
|
||||
'35 Biomes!',
|
||||
'Open Source!',
|
||||
'Play with 5x Speed!',
|
||||
'Live Bug Testing!',
|
||||
'Heavy RoR2 Influence!',
|
||||
'Pokémon Risk and Pokémon Rain!',
|
||||
'Infinite Fusion at Home!',
|
||||
'Broken Egg Moves!',
|
||||
'Mubstitute!',
|
||||
'Questionable Balancing!',
|
||||
'Sudden Difficulty Spikes!',
|
||||
'Based on an Unfinished Flash Game!',
|
||||
'YNOproject!'
|
||||
];
|
|
@ -3,10 +3,13 @@ import { DailyRunScoreboard } from "./daily-run-scoreboard";
|
|||
import OptionSelectUiHandler from "./option-select-ui-handler";
|
||||
import { Mode } from "./ui";
|
||||
import * as Utils from "../utils";
|
||||
import { TextStyle, addTextObject } from "./text";
|
||||
import { splashMessages } from "../data/splash-messages";
|
||||
|
||||
export default class TitleUiHandler extends OptionSelectUiHandler {
|
||||
private titleContainer: Phaser.GameObjects.Container;
|
||||
private dailyRunScoreboard: DailyRunScoreboard;
|
||||
private splashMessage: Phaser.GameObjects.Text;
|
||||
|
||||
constructor(scene: BattleScene, mode: Mode = Mode.TITLE) {
|
||||
super(scene, mode);
|
||||
|
@ -25,16 +28,33 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
|
|||
logo.setOrigin(0.5, 0);
|
||||
this.titleContainer.add(logo);
|
||||
|
||||
this.splashMessage = addTextObject(this.scene, logo.x + 64, logo.y + logo.displayHeight - 8, '', TextStyle.MONEY, { fontSize: '54px' });
|
||||
this.splashMessage.setOrigin(0.5, 0.5);
|
||||
this.splashMessage.setAngle(-20)
|
||||
this.titleContainer.add(this.splashMessage);
|
||||
|
||||
this.dailyRunScoreboard = new DailyRunScoreboard(this.scene, 1, 49);
|
||||
this.dailyRunScoreboard.setup();
|
||||
|
||||
this.titleContainer.add(this.dailyRunScoreboard);
|
||||
|
||||
const originalSplashMessageScale = this.splashMessage.scale;
|
||||
|
||||
this.scene.tweens.add({
|
||||
targets: this.splashMessage,
|
||||
duration: Utils.fixedInt(350),
|
||||
scale: originalSplashMessageScale * 1.25,
|
||||
loop: -1,
|
||||
yoyo: true,
|
||||
})
|
||||
}
|
||||
|
||||
show(args: any[]): boolean {
|
||||
const ret = super.show(args);
|
||||
|
||||
if (ret) {
|
||||
this.splashMessage.setText(Utils.randItem(splashMessages));
|
||||
|
||||
const ui = this.getUi();
|
||||
|
||||
this.dailyRunScoreboard.update();
|
||||
|
|
|
@ -78,6 +78,12 @@ export function randIntRange(min: integer, max: integer): integer {
|
|||
return randInt(max - min, min);
|
||||
}
|
||||
|
||||
export function randItem<T>(items: T[]): T {
|
||||
return items.length === 1
|
||||
? items[0]
|
||||
: items[randInt(items.length)];
|
||||
}
|
||||
|
||||
export function randSeedItem<T>(items: T[]): T {
|
||||
return items.length === 1
|
||||
? items[0]
|
||||
|
|
Loading…
Reference in New Issue