From 91bc524e06bd16dc43bdad76a9a2201e6abb8dd6 Mon Sep 17 00:00:00 2001 From: Lurkars Date: Tue, 14 Sep 2021 08:50:43 +0200 Subject: [PATCH] disable controls --- front/src/Components/EmoteMenu/EmoteMenu.svelte | 2 +- front/src/Phaser/Game/GameScene.ts | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/front/src/Components/EmoteMenu/EmoteMenu.svelte b/front/src/Components/EmoteMenu/EmoteMenu.svelte index 1a973c1f..cf36c150 100644 --- a/front/src/Components/EmoteMenu/EmoteMenu.svelte +++ b/front/src/Components/EmoteMenu/EmoteMenu.svelte @@ -17,7 +17,7 @@ styleProperties: { '--font': 'Press Start 2P' }, - showSearch : false + autoFocusSearch : false }); picker.on("emoji", (selection) => { diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 080576c0..2896b884 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -173,6 +173,7 @@ export class GameScene extends DirtyScene { private peerStoreUnsubscribe!: () => void; private chatVisibilityUnsubscribe!: () => void; private emoteUnsubscribe!: () => void; + private emoteMenuUnsubscribe!: () => void; private biggestAvailableAreaStoreUnsubscribe!: () => void; MapUrlFile: string; roomUrl: string; @@ -624,6 +625,14 @@ export class GameScene extends DirtyScene { } }); + this.emoteMenuUnsubscribe = emoteMenuStore.subscribe((emoteMenu) => { + if (emoteMenu) { + this.userInputManager.disableControls(); + } else { + this.userInputManager.restoreControls(); + } + }); + Promise.all([this.connectionAnswerPromise as Promise, ...scriptPromises]).then(() => { this.scene.wake(); }); @@ -1313,6 +1322,7 @@ ${escapedMessage} this.peerStoreUnsubscribe(); this.chatVisibilityUnsubscribe(); this.emoteUnsubscribe(); + this.emoteMenuUnsubscribe(); this.biggestAvailableAreaStoreUnsubscribe(); iframeListener.unregisterAnswerer("getState"); iframeListener.unregisterAnswerer("loadTileset");