From a093298993f62b65441bbe6cca8c0f5058d9a6a9 Mon Sep 17 00:00:00 2001 From: GRL Date: Tue, 13 Jul 2021 11:00:32 +0200 Subject: [PATCH] Graphic upgrade 2 --- front/src/Components/Chat/Chat.svelte | 12 ++-- front/src/Components/Chat/ChatElement.svelte | 17 ++++-- .../Components/Chat/ChatMessageForm.svelte | 2 +- .../src/Components/Chat/ChatPlayerName.svelte | 59 +++++++++++-------- front/src/Components/Chat/ChatSubMenu.svelte | 34 +++++++++++ front/src/Phaser/Game/GameScene.ts | 7 +++ front/src/Stores/ChatStore.ts | 16 +++++ 7 files changed, 113 insertions(+), 34 deletions(-) create mode 100644 front/src/Components/Chat/ChatSubMenu.svelte diff --git a/front/src/Components/Chat/Chat.svelte b/front/src/Components/Chat/Chat.svelte index cfb12103..8432df3b 100644 --- a/front/src/Components/Chat/Chat.svelte +++ b/front/src/Components/Chat/Chat.svelte @@ -31,13 +31,13 @@ \ No newline at end of file diff --git a/front/src/Components/Chat/ChatSubMenu.svelte b/front/src/Components/Chat/ChatSubMenu.svelte new file mode 100644 index 00000000..6d311656 --- /dev/null +++ b/front/src/Components/Chat/ChatSubMenu.svelte @@ -0,0 +1,34 @@ + + + + + + \ No newline at end of file diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 3ccc9fd9..a363fe27 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -92,6 +92,7 @@ import { peerStore, screenSharingPeerStore } from "../../Stores/PeerStore"; import { videoFocusStore } from "../../Stores/VideoFocusStore"; import { biggestAvailableAreaStore } from "../../Stores/BiggestAvailableAreaStore"; import { playersStore } from "../../Stores/PlayersStore"; +import { chatVisibilityStore } from "../../Stores/ChatStore"; export interface GameSceneInitInterface { initPosition: PointInterface | null; @@ -169,6 +170,7 @@ export class GameScene extends DirtyScene { private createPromiseResolve!: (value?: void | PromiseLike) => void; private iframeSubscriptionList!: Array; private peerStoreUnsubscribe!: () => void; + private chatVisibilityUnsubscribe!: () => void; private biggestAvailableAreaStoreUnsubscribe!: () => void; MapUrlFile: string; RoomId: string; @@ -571,6 +573,10 @@ export class GameScene extends DirtyScene { } oldPeerNumber = newPeerNumber; }); + + this.chatVisibilityUnsubscribe = chatVisibilityStore.subscribe((v) => { + this.openChatIcon.setVisible(!v); + }); } /** @@ -1150,6 +1156,7 @@ ${escapedMessage} this.pinchManager?.destroy(); this.emoteManager.destroy(); this.peerStoreUnsubscribe(); + this.chatVisibilityUnsubscribe(); this.biggestAvailableAreaStoreUnsubscribe(); iframeListener.unregisterAnswerer("getState"); diff --git a/front/src/Stores/ChatStore.ts b/front/src/Stores/ChatStore.ts index 344a424e..bc7c2d33 100644 --- a/front/src/Stores/ChatStore.ts +++ b/front/src/Stores/ChatStore.ts @@ -100,3 +100,19 @@ function createChatMessagesStore() { }; } export const chatMessagesStore = createChatMessagesStore(); + +function createChatSubMenuVisibilityStore() { + const { subscribe, update } = writable(""); + + return { + subscribe, + openSubMenu(playerName: string, index: number) { + let id = playerName + index; + update((oldValue) => { + return oldValue === id ? "" : id; + }); + }, + }; +} + +export const chatSubMenuVisbilityStore = createChatSubMenuVisibilityStore();