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

Minor adjustments

This commit is contained in:
tobspr 2021-05-03 15:59:23 +02:00
parent 331d08d61c
commit 77eaf33060
2 changed files with 22 additions and 19 deletions

View File

@ -130,7 +130,7 @@ export class HUDPuzzleCompleteNotification extends BaseHUDPart {
report() {
const mode = /** @type {PuzzlePlayGameMode} */ (this.root.gameMode);
mode.reportPuzzle();
mode.reportPuzzle().then(() => this.close());
}
updateState() {

View File

@ -147,25 +147,28 @@ export class PuzzlePlayGameMode extends PuzzleGameMode {
}
);
optionSelected.add(option => {
const closeLoading = this.root.hud.parts.dialogs.showLoadingDialog();
return new Promise(resolve => {
optionSelected.add(option => {
const closeLoading = this.root.hud.parts.dialogs.showLoadingDialog();
this.root.app.clientApi.apiReportPuzzle(this.puzzle.meta.id, option).then(
() => {
closeLoading();
this.root.hud.parts.dialogs.showInfo(
T.dialogs.puzzleReportComplete.title,
T.dialogs.puzzleReportComplete.desc
);
},
err => {
closeLoading();
this.root.hud.parts.dialogs.showInfo(
T.dialogs.puzzleReportError.title,
T.dialogs.puzzleReportError.desc + " " + err
);
}
);
this.root.app.clientApi.apiReportPuzzle(this.puzzle.meta.id, option).then(
() => {
closeLoading();
const { ok } = this.root.hud.parts.dialogs.showInfo(
T.dialogs.puzzleReportComplete.title,
T.dialogs.puzzleReportComplete.desc
);
ok.add(resolve);
},
err => {
closeLoading();
const { ok } = this.root.hud.parts.dialogs.showInfo(
T.dialogs.puzzleReportError.title,
T.dialogs.puzzleReportError.desc + " " + err
);
}
);
});
});
}
}