mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Merge branch 'master' of https://github.com/tobspr/shapez.io
This commit is contained in:
@@ -71,6 +71,7 @@ export class GameHUD {
|
||||
this.signals = {
|
||||
selectedPlacementBuildingChanged: /** @type {TypedSignal<[MetaBuilding|null]>} */ (new Signal()),
|
||||
shapePinRequested: /** @type {TypedSignal<[ShapeDefinition, number]>} */ (new Signal()),
|
||||
shapeUnpinRequested: /** @type {TypedSignal<[string]>} */ (new Signal()),
|
||||
notification: /** @type {TypedSignal<[string, enumNotificationType]>} */ (new Signal()),
|
||||
buildingsSelectedForCopy: /** @type {TypedSignal<[Array<number>]>} */ (new Signal()),
|
||||
};
|
||||
|
||||
@@ -35,6 +35,7 @@ export class HUDPinnedShapes extends BaseHUDPart {
|
||||
this.root.signals.storyGoalCompleted.add(this.rerenderFull, this);
|
||||
this.root.signals.postLoadHook.add(this.rerenderFull, this);
|
||||
this.root.hud.signals.shapePinRequested.add(this.pinNewShape, this);
|
||||
this.root.hud.signals.shapeUnpinRequested.add(this.unpinShape, this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -117,7 +117,10 @@ export class HUDShop extends BaseHUDPart {
|
||||
pinButton.classList.add("pin");
|
||||
container.appendChild(pinButton);
|
||||
|
||||
if (this.root.hud.parts.pinnedShapes.isShapePinned(shape)) {
|
||||
const currentGoalShape = this.root.hubGoals.currentGoal.definition.getHash();
|
||||
if (shape === currentGoalShape) {
|
||||
pinButton.classList.add("isGoal");
|
||||
} else if (this.root.hud.parts.pinnedShapes.isShapePinned(shape)) {
|
||||
pinButton.classList.add("alreadyPinned");
|
||||
}
|
||||
|
||||
@@ -126,8 +129,15 @@ export class HUDShop extends BaseHUDPart {
|
||||
preventDefault: true,
|
||||
});
|
||||
pinDetector.click.add(() => {
|
||||
this.root.hud.signals.shapePinRequested.dispatch(shapeDef, amount);
|
||||
pinButton.classList.add("pinned");
|
||||
if (this.root.hud.parts.pinnedShapes.isShapePinned(shape)) {
|
||||
this.root.hud.signals.shapeUnpinRequested.dispatch(shape);
|
||||
pinButton.classList.add("unpinned");
|
||||
pinButton.classList.remove("pinned", "alreadyPinned");
|
||||
} else {
|
||||
this.root.hud.signals.shapePinRequested.dispatch(shapeDef, amount);
|
||||
pinButton.classList.add("pinned");
|
||||
pinButton.classList.remove("unpinned");
|
||||
}
|
||||
});
|
||||
|
||||
handle.requireIndexToElement.push({
|
||||
|
||||
Reference in New Issue
Block a user