From 6b5e83f905cffa23573be11ff7456645fbe0788d Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 25 May 2020 20:27:51 +0200 Subject: [PATCH] Fix unlock notification not being modal --- src/js/game/hud/parts/unlock_notification.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/js/game/hud/parts/unlock_notification.js b/src/js/game/hud/parts/unlock_notification.js index 2e24ad0d..570d04d9 100644 --- a/src/js/game/hud/parts/unlock_notification.js +++ b/src/js/game/hud/parts/unlock_notification.js @@ -8,6 +8,7 @@ import { enumHubGoalRewards } from "../../tutorial_goals"; import { BaseHUDPart } from "../base_hud_part"; import { DynamicDomAttach } from "../dynamic_dom_attach"; import { enumHubGoalRewardsToContentUnlocked } from "../../tutorial_goals_mappings"; +import { InputReceiver } from "../../../core/input_receiver"; export class HUDUnlockNotification extends BaseHUDPart { initialize() { @@ -25,6 +26,8 @@ export class HUDUnlockNotification extends BaseHUDPart { } createElements(parent) { + this.inputReciever = new InputReceiver("unlock-notification"); + this.element = makeDiv(parent, "ingame_HUD_UnlockNotification", []); const dialog = makeDiv(this.element, null, ["dialog"]); @@ -47,6 +50,7 @@ export class HUDUnlockNotification extends BaseHUDPart { * @param {enumHubGoalRewards} reward */ showForLevel(level, reward) { + this.root.app.inputMgr.makeSureAttachedAndOnTop(this.inputReciever); this.elemTitle.innerText = T.ingame.levelCompleteNotification.levelTitle.replace( "", ("" + level).padStart(2, "0") @@ -92,6 +96,7 @@ export class HUDUnlockNotification extends BaseHUDPart { } cleanup() { + this.root.app.inputMgr.makeSureDetached(this.inputReciever); if (this.buttonShowTimeout) { clearTimeout(this.buttonShowTimeout); this.buttonShowTimeout = null; @@ -113,6 +118,7 @@ export class HUDUnlockNotification extends BaseHUDPart { } close() { + this.root.app.inputMgr.makeSureDetached(this.inputReciever); if (this.buttonShowTimeout) { clearTimeout(this.buttonShowTimeout); this.buttonShowTimeout = null;