Initial work - does not work.

This commit is contained in:
frutescens 2024-08-28 13:53:26 -07:00
parent 447d47ef47
commit 1b16621c80
4 changed files with 42 additions and 42 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -41,8 +41,8 @@ export class LoadingScene extends SceneBase {
this.loadImage("loading_bg", "arenas"); this.loadImage("loading_bg", "arenas");
this.loadImage("logo", ""); this.loadImage("logo", "");
// this.loadImage("pride-update", "events"); this.loadImage("pride-update", "events");
this.loadImage("august-variant-update", "events"); this.loadImage("september-update", "events");
// Load menu images // Load menu images
this.loadAtlas("bg", "ui"); this.loadAtlas("bg", "ui");

View File

@ -2,34 +2,32 @@ import BattleScene from "#app/battle-scene.js";
import { TextStyle, addTextObject } from "#app/ui/text.js"; import { TextStyle, addTextObject } from "#app/ui/text.js";
export enum EventType { export enum EventType {
SHINY SHINY,
GENERIC
} }
interface TimedEvent { interface TimedEvent {
name: string; name: string;
eventType: EventType; eventType: EventType;
shinyMultiplier?: number; shinyMultiplier?: number;
startDate: Date; startDate: Date;
endDate: Date; endDate: Date;
bannerFilename?: string bannerFilename?: string;
xPosition?: number;
yPosition?: number;
scale?: number;
} }
const timedEvents: TimedEvent[] = [ const timedEvents: TimedEvent[] = [
{ {
name: "Pride Update", name: "September Update",
eventType: EventType.SHINY, eventType: EventType.GENERIC,
shinyMultiplier: 2, startDate: new Date(Date.UTC(2024, 7, 28, 0)),
startDate: new Date(Date.UTC(2024, 5, 14, 0)), endDate: new Date(Date.UTC(2024, 8, 15, 0)),
endDate: new Date(Date.UTC(2024, 5, 23, 0)), bannerFilename: "september-update",
bannerFilename: "pride-update" xPosition: 26,
}, yPosition: 103,
{ scale: 0.35
name: "August Variant Update",
eventType: EventType.SHINY,
shinyMultiplier: 2,
startDate: new Date(Date.UTC(2024, 7, 16, 0)),
endDate: new Date(Date.UTC(2024, 7, 22, 0)),
bannerFilename: "august-variant-update"
} }
]; ];
@ -86,10 +84,10 @@ export class TimedEventDisplay extends Phaser.GameObjects.Container {
setup() { setup() {
console.log(this.event?.bannerFilename); console.log(this.event?.bannerFilename);
this.banner = new Phaser.GameObjects.Image(this.scene, 29, 64, this.event!.bannerFilename!); // TODO: are the bangs correct here? this.banner = new Phaser.GameObjects.Image(this.scene, this.event!.xPosition ?? 29, this.event!.yPosition ?? 64, this.event!.bannerFilename!); // TODO: are the bangs correct here?
this.banner.setName("img-event-banner"); this.banner.setName("img-event-banner");
this.banner.setOrigin(0.08, -0.35); this.banner.setOrigin(0.08, -0.35);
this.banner.setScale(0.18); this.banner.setScale(this.event!.scale ?? 0.18);
// this.bannerShadow = new Phaser.GameObjects.Rectangle( // this.bannerShadow = new Phaser.GameObjects.Rectangle(
// this.scene, // this.scene,
// this.banner.x - 2, // this.banner.x - 2,
@ -102,21 +100,21 @@ export class TimedEventDisplay extends Phaser.GameObjects.Container {
// this.bannerShadow.setScale(0.07); // this.bannerShadow.setScale(0.07);
// this.bannerShadow.setAlpha(0.5); // this.bannerShadow.setAlpha(0.5);
// this.bannerShadow.setOrigin(0,0); // this.bannerShadow.setOrigin(0,0);
this.eventTimerText = addTextObject( if (this.event!.eventType !== EventType.GENERIC) {
this.scene, this.eventTimerText = addTextObject(
this.banner.x + 8, this.scene,
this.banner.y + 100, this.banner.x + 8,
this.timeToGo(this.event!.endDate), // TODO: is the bang correct here? this.banner.y + 100,
TextStyle.WINDOW this.timeToGo(this.event!.endDate), // TODO: is the bang correct here?
); TextStyle.WINDOW
this.eventTimerText.setName("text-event-timer"); );
this.eventTimerText.setScale(0.15); this.eventTimerText.setName("text-event-timer");
this.eventTimerText.setOrigin(0, 0); this.eventTimerText.setScale(0.15);
this.eventTimerText.setOrigin(0, 0);
this.add([
this.eventTimerText, this.add(this.eventTimerText);
// this.bannerShadow, }
this.banner]); this.add(this.banner);
} }
show() { show() {
@ -157,6 +155,8 @@ export class TimedEventDisplay extends Phaser.GameObjects.Container {
} }
updateCountdown() { updateCountdown() {
this.eventTimerText.setText(this.timeToGo(this.event!.endDate)); // TODO: is the bang correct here? if (this.event!.eventType !== EventType.GENERIC) {
this.eventTimerText.setText(this.timeToGo(this.event!.endDate));
}
} }
} }

View File

@ -35,7 +35,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
this.titleContainer.add(logo); this.titleContainer.add(logo);
if (this.scene.eventManager.isEventActive()) { if (this.scene.eventManager.isEventActive()) {
this.eventDisplay = new TimedEventDisplay(this.scene, 0, 0, this.scene.eventManager.activeEvent()); this.eventDisplay = new TimedEventDisplay(this.scene, 0, 0, this.scene.eventManager.activeEvents());
this.eventDisplay.setup(); this.eventDisplay.setup();
this.titleContainer.add(this.eventDisplay); this.titleContainer.add(this.eventDisplay);
} }