Files
ResistanceRacing2k97/src/ui/computer/programs/programCalendarAero.js
T
2026-10-23 00:24:27 +02:00

116 lines
5.1 KiB
JavaScript

import Button from "../../button.js";
export default class ProgramCalendar {
constructor(_scene, _computer, _window) {
this.scene = _scene;
this.computer = _computer;
this.window = _window;
this.tiles = [];
let i = 0;
for (let yy = 0; yy < 4; yy++) {
for (let xx = 0; xx < 7; xx++) {
/*tile.colors = {
out: 0x83769c,
over: 0x29adff,
on: 0x00e436,
off: 0xad2900
}*/
if (i === 10) {
this.tiles.push(new Button(this.scene, { x: this.window.pos.x + 16 + (xx * 37), y: this.window.pos.y + 32 + (yy * 37) }, "atlasUi", "sprDesktopCalendarTileMarked", String(i + 1), false, () => {
this.txtNoData.alpha = 0;
this.textContainer.alpha = 1;
}));
} else if (i === 22) {
this.tiles.push(new Button(this.scene, { x: this.window.pos.x + 16 + (xx * 37), y: this.window.pos.y + 32 + (yy * 37) }, "atlasUi", "sprDesktopCalendarTile", String(i + 1), false, () => {
this.txtNoData.setText("I see you.");
this.txtNoData.alpha = 1;
this.textContainer.alpha = 0;
}));
} else {
this.tiles.push(new Button(this.scene, { x: this.window.pos.x + 16 + (xx * 37), y: this.window.pos.y + 32 + (yy * 37) }, "atlasUi", "sprDesktopCalendarTile", String(i + 1), false, () => {
this.txtNoData.setText("503: Service Unavailable");
this.txtNoData.alpha = 1;
this.textContainer.alpha = 0;
}));
}
let tile = this.tiles[this.tiles.length - 1];
tile.tintFill = false;
tile.tintText = false;
tile.colorInState(tile.states.out);
tile.setDepth(this.window.depth + 1);
this.window.container.add(tile.sprite);
this.window.container.add(tile.txt);
i += 1;
}
}
this.textContainer = this.scene.add.container(0, 0);
this.window.container.add(this.textContainer);
this.txtTrackTitle = this.scene.add.bitmapText((this.window.pos.x + this.window.width * 0.5) - 64, this.window.pos.y + (this.window.height * 0.5) + 64, "uiFont", "upcoming race:", 14, 0).setOrigin(0.5).setLetterSpacing(0);
this.txtTrackTitle.depth = this.depth + 1;
this.txtTrackTitle.setTintFill(0x83769c);
this.textContainer.add(this.txtTrackTitle);
this.txtTrackname = this.scene.add.bitmapText((this.window.pos.x + this.window.width * 0.5) - 64, this.window.pos.y + (this.window.height * 0.5) + 104 - 14, "uiFont", "Metro Loop", 14, 0).setOrigin(0.5).setLetterSpacing(0);
this.txtTrackname.depth = this.depth + 1;
this.txtTrackname.setTintFill(0x83769c);
this.textContainer.add(this.txtTrackname);
this.txtSessionTitle = this.scene.add.bitmapText((this.window.pos.x + this.window.width * 0.5) + 64, this.window.pos.y + (this.window.height * 0.5) + 64, "uiFont", "upcoming sessions:", 14, 0).setOrigin(0.5).setLetterSpacing(0);
this.txtSessionTitle.depth = this.depth + 1;
this.txtSessionTitle.setTintFill(0x83769c);
this.textContainer.add(this.txtSessionTitle);
this.txtSessions = this.scene.add.bitmapText(this.window.pos.x + (this.window.width * 0.5) + 32, this.window.pos.y + (this.window.height * 0.5) + 104, "uiFont", "09:00\n11:00\n14:00", 14, 0).setOrigin(1, 0.5).setLetterSpacing(0);
this.txtSessions.depth = this.depth + 1;
this.txtSessions.setTintFill(0x83769c);
this.textContainer.add(this.txtSessions);
this.txtSessionNames = this.scene.add.bitmapText(this.window.pos.x + (this.window.width * 0.5) + 32, this.window.pos.y + (this.window.height * 0.5) + 104, "uiFont", " Free Practice\n Qualifying\n Race", 14, 0).setOrigin(0, 0.5).setLetterSpacing(0);
this.txtSessionNames.depth = this.depth + 1;
this.txtSessionNames.setTintFill(0x83769c);
this.textContainer.add(this.txtSessionNames);
//this.window.container.add(this.txtSessionNames);
this.txtNoData = this.scene.add.bitmapText(this.window.pos.x + (this.window.width * 0.5) + 0, this.window.pos.y + (this.window.height * 0.5) + 104 - 14, "uiFont", "503: Service Unavailable", 14, 0).setOrigin(0.5, 0.5).setLetterSpacing(0);
this.txtNoData.depth = this.depth + 1;
this.txtNoData.setTintFill(0xff004d);
this.window.container.add(this.txtNoData);
this.txtNoData.alpha = 0;
this.textContainer.alpha = 0;
}
update() {
//console.log("update claendar")
for (let t of this.tiles) {
t.update();
if (t.hovering === true) {
this.computer.cursor.setTexture("atlasUi", "sprDesktopCursorTouch");
}
}
}
destroy() {
this.txtTrackTitle.destroy();
this.txtTrackname.destroy();
this.txtSessionTitle.destroy();
this.txtSessions.destroy();
this.txtSessionNames.destroy();
this.textContainer.destroy();
this.txtNoData.destroy();
for (let t of this.tiles) {
t.destroy();
}
}
}