mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Minor refactoring
This commit is contained in:
@@ -47,6 +47,7 @@ import { HUDMinerHighlight } from "./parts/miner_highlight";
|
||||
import { HUDBetaOverlay } from "./parts/beta_overlay";
|
||||
import { HUDPerformanceWarning } from "./parts/performance_warning";
|
||||
import { HUDStandaloneAdvantages } from "./parts/standalone_advantages";
|
||||
import { HUDCatMemes } from "./parts/cat_memes";
|
||||
|
||||
export class GameHUD {
|
||||
/**
|
||||
@@ -118,6 +119,7 @@ export class GameHUD {
|
||||
if (IS_DEMO) {
|
||||
this.parts.watermark = new HUDWatermark(this.root);
|
||||
this.parts.standaloneAdvantages = new HUDStandaloneAdvantages(this.root);
|
||||
this.parts.catMemes = new HUDCatMemes(this.root);
|
||||
}
|
||||
|
||||
if (G_IS_DEV && globalConfig.debug.renderChanges) {
|
||||
|
||||
@@ -42,7 +42,7 @@ export class HUDBuildingsToolbar extends HUDBaseToolbar {
|
||||
],
|
||||
visibilityCondition: () =>
|
||||
!this.root.camera.getIsMapOverlayActive() && this.root.currentLayer === "regular",
|
||||
htmlElementId: "ingame_HUD_buildings_toolbar",
|
||||
htmlElementId: "ingame_HUD_BuildingsToolbar",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
21
src/js/game/hud/parts/cat_memes.js
Normal file
21
src/js/game/hud/parts/cat_memes.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { makeDiv } from "../../../core/utils";
|
||||
import { BaseHUDPart } from "../base_hud_part";
|
||||
import { DynamicDomAttach } from "../dynamic_dom_attach";
|
||||
|
||||
const memeShowIntervalSeconds = 70 * 60;
|
||||
const memeShowDuration = 5;
|
||||
|
||||
export class HUDCatMemes extends BaseHUDPart {
|
||||
createElements(parent) {
|
||||
this.element = makeDiv(parent, "ingame_HUD_CatMemes");
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.domAttach = new DynamicDomAttach(this.root, this.element);
|
||||
}
|
||||
|
||||
update() {
|
||||
const now = this.root.time.realtimeNow();
|
||||
this.domAttach.update(now % memeShowIntervalSeconds > memeShowIntervalSeconds - memeShowDuration);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user