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

Added a button to return to the menu after a puzzle is completed (#1170)

* added another button to return to the menu

* improved menu return

* fixed continue button to not go back to menu
This commit is contained in:
Sense101 2021-05-23 11:29:49 +01:00 committed by GitHub
parent 63482e36db
commit 8e25818999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 10 deletions

View File

@ -52,12 +52,22 @@ export class HUDPuzzleCompleteNotification extends BaseHUDPart {
this.updateState();
});
this.btnClose = document.createElement("button");
this.btnClose.classList.add("close", "styledButton");
this.btnClose.innerText = T.ingame.puzzleCompletion.buttonSubmit;
dialog.appendChild(this.btnClose);
this.continueBtn = document.createElement("button");
this.continueBtn.classList.add("close", "styledButton");
this.continueBtn.innerText = T.ingame.puzzleCompletion.continueBtn;
dialog.appendChild(this.continueBtn);
this.trackClicks(this.btnClose, this.close);
this.menuBtn = document.createElement("button");
this.menuBtn.classList.add("close", "styledButton");
this.menuBtn.innerText = T.ingame.puzzleCompletion.menuBtn;
dialog.appendChild(this.menuBtn);
this.trackClicks(this.continueBtn, () => {
this.close(false);
});
this.trackClicks(this.menuBtn, () => {
this.close(true);
});
}
updateState() {
@ -79,13 +89,16 @@ export class HUDPuzzleCompleteNotification extends BaseHUDPart {
return this.visible;
}
close() {
close(toMenu) {
/** @type {PuzzlePlayGameMode} */ (this.root.gameMode)
.trackCompleted(this.userDidLikePuzzle, Math.round(this.timeOfCompletion))
.then(() => {
// this.root.gameState.moveToState("PuzzleMenuState");
this.visible = false;
this.cleanup();
if (toMenu) {
this.root.gameState.moveToState("PuzzleMenuState");
} else {
this.visible = false;
this.cleanup();
}
});
}

View File

@ -626,7 +626,8 @@ ingame:
titleRating: How difficult did you find the puzzle?
titleRatingDesc: Your rating will help me to make you better suggestions in the future
buttonSubmit: Continue
continueBtn: Continue
menuBtn: Menu
puzzleMetadata:
author: Author