1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Add option to level up normally

This commit is contained in:
EmeraldBlock 2020-10-21 17:02:20 -05:00
parent e195744480
commit 0cccf1cb6e

View File

@ -26,7 +26,7 @@ export class HUDSandboxController extends BaseHUDPart {
</div> </div>
<div class="upgradesBelt plusMinus"> <div class="upgradesBelt plusMinus">
<label>&rarr; Belt</label> <label>&rarr; Belts</label>
<button class="styledButton reset"></button> <button class="styledButton reset"></button>
<button class="styledButton minus">-</button> <button class="styledButton minus">-</button>
<button class="styledButton plus">+</button> <button class="styledButton plus">+</button>
@ -54,12 +54,15 @@ export class HUDSandboxController extends BaseHUDPart {
</div> </div>
<div class="additionalOptions"> <div class="additionalOptions">
<div class="bigPlusMinus">
<button class="styledButton levelOverride">Override</button>
<button class="styledButton levelUp">Level up</button>
</div>
<div class="bigPlusMinus"> <div class="bigPlusMinus">
<button class="styledButton bigMinus">-100 All</button> <button class="styledButton bigMinus">-100 All</button>
<button class="styledButton bigPlus">+100 All</button> <button class="styledButton bigPlus">+100 All</button>
</div> </div>
<button class="styledButton giveBlueprints">Fill blueprint shapes</button> <button class="styledButton giveBlueprints">Fill blueprint shapes</button>
<button class="styledButton levelOverride">Override level</button>
</div> </div>
</div> </div>
` `
@ -67,13 +70,15 @@ export class HUDSandboxController extends BaseHUDPart {
const bind = (selector, handler) => this.trackClicks(this.element.querySelector(selector), handler); const bind = (selector, handler) => this.trackClicks(this.element.querySelector(selector), handler);
bind(".giveBlueprints", this.giveBlueprints); bind(".levelOverride", this.promptOverrideLevel);
bind(".levelUp", this.tryLevelUp)
bind(".bigMinus", () => this.modifyAll(-100)); bind(".bigMinus", () => this.modifyAll(-100));
bind(".bigPlus", () => this.modifyAll(100)); bind(".bigPlus", () => this.modifyAll(100));
bind(".giveBlueprints", this.giveBlueprints);
bind(".levelToggle .reset", this.resetLevel); bind(".levelToggle .reset", this.resetLevel);
bind(".levelToggle .minus", () => this.modifyLevel(-1)); bind(".levelToggle .minus", () => this.modifyLevel(-1));
bind(".levelToggle .plus", () => this.modifyLevel(1)); bind(".levelToggle .plus", () => this.modifyLevel(1));
bind(".levelOverride", this.promptOverrideLevel);
bind(".upgradesBelt .reset", () => this.resetUpgrade("belt")); bind(".upgradesBelt .reset", () => this.resetUpgrade("belt"));
bind(".upgradesBelt .minus", () => this.modifyUpgrade("belt", -1)); bind(".upgradesBelt .minus", () => this.modifyUpgrade("belt", -1));
@ -188,7 +193,7 @@ export class HUDSandboxController extends BaseHUDPart {
const dialog = new DialogWithForm({ const dialog = new DialogWithForm({
app: this.root.app, app: this.root.app,
title: "Override Level", title: "Override Level",
desc: "Enter shape to override with:", desc: "Enter a shape to override with:",
formElements: [signalValueInput], formElements: [signalValueInput],
buttons: ["cancel:bad:escape", "ok:good:enter"], buttons: ["cancel:bad:escape", "ok:good:enter"],
closeButton: false, closeButton: false,
@ -214,6 +219,12 @@ export class HUDSandboxController extends BaseHUDPart {
); );
} }
tryLevelUp() {
if (!this.root.hubGoals.isEndOfDemoReached()) {
this.root.hubGoals.onGoalCompleted();
}
}
initialize() { initialize() {
// Allow toggling the controller overlay // Allow toggling the controller overlay
this.root.gameState.inputReciever.keydown.add(key => { this.root.gameState.inputReciever.keydown.add(key => {