mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Minor wegame adjustments
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
/* typehints:start */
|
||||
import { PuzzlePlayGameMode } from "../../modes/puzzle_play";
|
||||
/* typehints:end */
|
||||
|
||||
import { makeDiv } from "../../../core/utils";
|
||||
import { T } from "../../../translations";
|
||||
import { PuzzlePlayGameMode } from "../../modes/puzzle_play";
|
||||
|
||||
import { BaseHUDPart } from "../base_hud_part";
|
||||
|
||||
export class HUDPuzzleNextPuzzle extends BaseHUDPart {
|
||||
|
||||
@@ -232,15 +232,20 @@ export class HUDPinnedShapes extends BaseHUDPart {
|
||||
}
|
||||
|
||||
// Show small info icon
|
||||
const infoButton = document.createElement("button");
|
||||
infoButton.classList.add("infoButton");
|
||||
element.appendChild(infoButton);
|
||||
const infoDetector = new ClickDetector(infoButton, {
|
||||
consumeEvents: true,
|
||||
preventDefault: true,
|
||||
targetOnly: true,
|
||||
});
|
||||
infoDetector.click.add(() => this.root.hud.signals.viewShapeDetailsRequested.dispatch(definition));
|
||||
let infoDetector;
|
||||
if (!G_WEGAME_VERSION) {
|
||||
const infoButton = document.createElement("button");
|
||||
infoButton.classList.add("infoButton");
|
||||
element.appendChild(infoButton);
|
||||
infoDetector = new ClickDetector(infoButton, {
|
||||
consumeEvents: true,
|
||||
preventDefault: true,
|
||||
targetOnly: true,
|
||||
});
|
||||
infoDetector.click.add(() =>
|
||||
this.root.hud.signals.viewShapeDetailsRequested.dispatch(definition)
|
||||
);
|
||||
}
|
||||
|
||||
const amountLabel = makeDiv(element, null, ["amountLabel"], "");
|
||||
|
||||
|
||||
@@ -77,7 +77,9 @@ export class HUDShop extends BaseHUDPart {
|
||||
const requiredHandle = handle.requireIndexToElement[i];
|
||||
requiredHandle.container.remove();
|
||||
requiredHandle.pinDetector.cleanup();
|
||||
requiredHandle.infoDetector.cleanup();
|
||||
if (requiredHandle.infoDetector) {
|
||||
requiredHandle.infoDetector.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
@@ -119,9 +121,19 @@ export class HUDShop extends BaseHUDPart {
|
||||
pinButton.classList.add("pin");
|
||||
container.appendChild(pinButton);
|
||||
|
||||
const viewInfoButton = document.createElement("button");
|
||||
viewInfoButton.classList.add("showInfo");
|
||||
container.appendChild(viewInfoButton);
|
||||
let infoDetector;
|
||||
if (!G_WEGAME_VERSION) {
|
||||
const viewInfoButton = document.createElement("button");
|
||||
viewInfoButton.classList.add("showInfo");
|
||||
container.appendChild(viewInfoButton);
|
||||
infoDetector = new ClickDetector(viewInfoButton, {
|
||||
consumeEvents: true,
|
||||
preventDefault: true,
|
||||
});
|
||||
infoDetector.click.add(() =>
|
||||
this.root.hud.signals.viewShapeDetailsRequested.dispatch(shapeDef)
|
||||
);
|
||||
}
|
||||
|
||||
const currentGoalShape = this.root.hubGoals.currentGoal.definition.getHash();
|
||||
if (shape === currentGoalShape) {
|
||||
@@ -146,14 +158,6 @@ export class HUDShop extends BaseHUDPart {
|
||||
}
|
||||
});
|
||||
|
||||
const infoDetector = new ClickDetector(viewInfoButton, {
|
||||
consumeEvents: true,
|
||||
preventDefault: true,
|
||||
});
|
||||
infoDetector.click.add(() =>
|
||||
this.root.hud.signals.viewShapeDetailsRequested.dispatch(shapeDef)
|
||||
);
|
||||
|
||||
handle.requireIndexToElement.push({
|
||||
container,
|
||||
progressLabel,
|
||||
@@ -211,7 +215,9 @@ export class HUDShop extends BaseHUDPart {
|
||||
const requiredHandle = handle.requireIndexToElement[i];
|
||||
requiredHandle.container.remove();
|
||||
requiredHandle.pinDetector.cleanup();
|
||||
requiredHandle.infoDetector.cleanup();
|
||||
if (requiredHandle.infoDetector) {
|
||||
requiredHandle.infoDetector.cleanup();
|
||||
}
|
||||
}
|
||||
handle.requireIndexToElement = [];
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export class SettingsState extends TextualGameState {
|
||||
`
|
||||
}
|
||||
<div class="versionbar">
|
||||
<div class="buildVersion">${T.global.loading} ...</div>
|
||||
${G_WEGAME_VERSION ? "" : `<div class="buildVersion">${T.global.loading} ...</div>`}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -91,6 +91,9 @@ export class SettingsState extends TextualGameState {
|
||||
|
||||
renderBuildText() {
|
||||
const labelVersion = this.htmlElement.querySelector(".buildVersion");
|
||||
if (!labelVersion) {
|
||||
return;
|
||||
}
|
||||
const lastBuildMs = new Date().getTime() - G_BUILD_TIME;
|
||||
const lastBuildText = formatSecondsToTimeAgo(lastBuildMs / 1000.0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user