1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-07 01:54:10 +00:00

Fix unlock notification not being modal

This commit is contained in:
tobspr 2020-05-25 20:27:51 +02:00
parent 0561cd9f89
commit 6b5e83f905

View File

@ -8,6 +8,7 @@ import { enumHubGoalRewards } from "../../tutorial_goals";
import { BaseHUDPart } from "../base_hud_part"; import { BaseHUDPart } from "../base_hud_part";
import { DynamicDomAttach } from "../dynamic_dom_attach"; import { DynamicDomAttach } from "../dynamic_dom_attach";
import { enumHubGoalRewardsToContentUnlocked } from "../../tutorial_goals_mappings"; import { enumHubGoalRewardsToContentUnlocked } from "../../tutorial_goals_mappings";
import { InputReceiver } from "../../../core/input_receiver";
export class HUDUnlockNotification extends BaseHUDPart { export class HUDUnlockNotification extends BaseHUDPart {
initialize() { initialize() {
@ -25,6 +26,8 @@ export class HUDUnlockNotification extends BaseHUDPart {
} }
createElements(parent) { createElements(parent) {
this.inputReciever = new InputReceiver("unlock-notification");
this.element = makeDiv(parent, "ingame_HUD_UnlockNotification", []); this.element = makeDiv(parent, "ingame_HUD_UnlockNotification", []);
const dialog = makeDiv(this.element, null, ["dialog"]); const dialog = makeDiv(this.element, null, ["dialog"]);
@ -47,6 +50,7 @@ export class HUDUnlockNotification extends BaseHUDPart {
* @param {enumHubGoalRewards} reward * @param {enumHubGoalRewards} reward
*/ */
showForLevel(level, reward) { showForLevel(level, reward) {
this.root.app.inputMgr.makeSureAttachedAndOnTop(this.inputReciever);
this.elemTitle.innerText = T.ingame.levelCompleteNotification.levelTitle.replace( this.elemTitle.innerText = T.ingame.levelCompleteNotification.levelTitle.replace(
"<level>", "<level>",
("" + level).padStart(2, "0") ("" + level).padStart(2, "0")
@ -92,6 +96,7 @@ export class HUDUnlockNotification extends BaseHUDPart {
} }
cleanup() { cleanup() {
this.root.app.inputMgr.makeSureDetached(this.inputReciever);
if (this.buttonShowTimeout) { if (this.buttonShowTimeout) {
clearTimeout(this.buttonShowTimeout); clearTimeout(this.buttonShowTimeout);
this.buttonShowTimeout = null; this.buttonShowTimeout = null;
@ -113,6 +118,7 @@ export class HUDUnlockNotification extends BaseHUDPart {
} }
close() { close() {
this.root.app.inputMgr.makeSureDetached(this.inputReciever);
if (this.buttonShowTimeout) { if (this.buttonShowTimeout) {
clearTimeout(this.buttonShowTimeout); clearTimeout(this.buttonShowTimeout);
this.buttonShowTimeout = null; this.buttonShowTimeout = null;