mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Make shapes unpinnable. The current goal shape uses a special pin icon.
This commit is contained in:
parent
a2ee16589f
commit
0885bd6727
@ -132,15 +132,37 @@
|
||||
}
|
||||
|
||||
&.alreadyPinned {
|
||||
opacity: 0.1 !important;
|
||||
pointer-events: none;
|
||||
opacity: 0.3 !important;
|
||||
}
|
||||
|
||||
&.isGoal {
|
||||
background: uiResource("icons/current_goal_marker.png") center center / 95% no-repeat;
|
||||
opacity: 0.3 !important;
|
||||
cursor: default;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&.pinned {
|
||||
opacity: 0.1;
|
||||
pointer-events: none;
|
||||
cursor: default;
|
||||
opacity: 0.3;
|
||||
@include InlineAnimation(0.3s ease-in-out) {
|
||||
0% {
|
||||
opacity: 1;
|
||||
transform: scale(0.8);
|
||||
}
|
||||
|
||||
30% {
|
||||
opacity: 1;
|
||||
transform: scale(1.2);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.unpinned {
|
||||
opacity: 0.6;
|
||||
@include InlineAnimation(0.3s ease-in-out) {
|
||||
0% {
|
||||
opacity: 1;
|
||||
|
@ -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({
|
||||
|
Loading…
Reference in New Issue
Block a user