Applied comments

This commit is contained in:
NewHappyRabbit
2025-02-20 01:46:00 +02:00
parent e9eb006cea
commit a2fa30cee2
5 changed files with 351 additions and 334 deletions
+5 -5
View File
@@ -46,14 +46,13 @@ export class NameLayer implements Layer {
private container: HTMLDivElement;
private myPlayer: PlayerView | null = null;
private firstPlace: PlayerView | null = null;
private theme: Theme;
private theme: Theme = this.game.config().theme();
constructor(
private game: GameView,
private transformHandler: TransformHandler,
private clientID: ClientID,
) {
this.theme = game.config().theme();
this.traitorIconImage = new Image();
this.traitorIconImage.src = traitorIcon;
this.allianceIconImage = new Image();
@@ -73,6 +72,10 @@ export class NameLayer implements Layer {
return false;
}
redraw() {
this.theme = this.game.config().theme();
}
public init() {
this.canvas = createCanvas();
window.addEventListener("resize", () => this.resizeCanvas());
@@ -98,9 +101,6 @@ export class NameLayer implements Layer {
this.firstPlace = sorted[0];
}
if (this.theme !== this.game.config().theme()) {
this.theme = this.game.config().theme();
}
for (const player of this.game.playerViews()) {
if (player.isAlive()) {
if (!this.seenPlayers.has(player)) {
@@ -7,6 +7,7 @@ import { GameView } from "../../../core/game/GameView";
import { Layer } from "./Layer";
import { GameUpdateType } from "../../../core/game/GameUpdates";
import { UserSettings } from "../../../core/game/UserSettings";
import { RefreshGraphicsEvent } from "../../InputHandler";
const button = ({
classes = "",
@@ -83,6 +84,7 @@ export class OptionsMenu extends LitElement implements Layer {
private onToggleDarkModeButtonClick() {
this.userSettings.toggleDarkMode();
this.requestUpdate();
this.eventBus.emit(new RefreshGraphicsEvent());
}
init() {