From 2d8997c6d7bbfc8a96afbe2c7ba21f72a39da6d9 Mon Sep 17 00:00:00 2001 From: TabascoEye Date: Tue, 11 May 2021 17:38:28 +0200 Subject: [PATCH 01/53] turning noise suppresion back on turning AGC off was a good idea, disabling noise suppresion with it was not. => should all end up in the "settings" menu in the end --- front/src/WebRtc/MediaManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/src/WebRtc/MediaManager.ts b/front/src/WebRtc/MediaManager.ts index 85060a86..2bed2c68 100644 --- a/front/src/WebRtc/MediaManager.ts +++ b/front/src/WebRtc/MediaManager.ts @@ -20,7 +20,7 @@ const audioConstraint: boolean|MediaTrackConstraints = { //TODO: make these values configurable in the game settings menu and store them in localstorage autoGainControl: false, echoCancellation: true, - noiseSuppression: false + noiseSuppression: true }; export type UpdatedLocalStreamCallback = (media: MediaStream|null) => void; From 645af32b4cc991b3e0828c71fb1dd412895ec2d9 Mon Sep 17 00:00:00 2001 From: GRL Date: Mon, 31 May 2021 10:20:30 +0200 Subject: [PATCH 02/53] correction of resize select character and companion --- front/dist/resources/html/CustomCharacterScene.html | 4 ++-- front/src/Phaser/Game/DirtyScene.ts | 2 +- front/src/Phaser/Game/Game.ts | 12 ++++++++++-- front/src/Phaser/Game/GameScene.ts | 4 ++-- front/src/Phaser/Login/CustomizeScene.ts | 4 ++-- front/src/Phaser/Login/LoginScene.ts | 2 +- front/src/Phaser/Login/ResizableScene.ts | 4 ++-- front/src/Phaser/Login/SelectCharacterScene.ts | 8 ++++---- front/src/Phaser/Login/SelectCompanionScene.ts | 6 +++--- front/src/Phaser/Menu/HelpCameraSettingsScene.ts | 6 ++++-- 10 files changed, 31 insertions(+), 21 deletions(-) diff --git a/front/dist/resources/html/CustomCharacterScene.html b/front/dist/resources/html/CustomCharacterScene.html index 0bc050ea..0bf3f753 100644 --- a/front/dist/resources/html/CustomCharacterScene.html +++ b/front/dist/resources/html/CustomCharacterScene.html @@ -10,8 +10,8 @@ color: #ebeeee; width: 42vw; height: 48vh; - /*max-width: 300px; - max-height: 48vh;*/ + max-width: 350px; + /*max-height: 48vh;*/ overflow: hidden; } #customizeScene h1 { diff --git a/front/src/Phaser/Game/DirtyScene.ts b/front/src/Phaser/Game/DirtyScene.ts index 2e94aa66..3e1f3cdf 100644 --- a/front/src/Phaser/Game/DirtyScene.ts +++ b/front/src/Phaser/Game/DirtyScene.ts @@ -69,7 +69,7 @@ export abstract class DirtyScene extends ResizableScene { return this.dirty || this.objectListChanged; } - public onResize(ev: UIEvent): void { + public onResize(): void { this.objectListChanged = true; } } diff --git a/front/src/Phaser/Game/Game.ts b/front/src/Phaser/Game/Game.ts index 01aecf9f..e267e80a 100644 --- a/front/src/Phaser/Game/Game.ts +++ b/front/src/Phaser/Game/Game.ts @@ -21,14 +21,22 @@ export class Game extends Phaser.Game { constructor(GameConfig: Phaser.Types.Core.GameConfig) { super(GameConfig); - window.addEventListener('resize', (event) => { + this.scale.on(Phaser.Scale.Events.RESIZE, () => { + for (const scene of this.scene.getScenes(true)) { + if (scene instanceof ResizableScene) { + scene.onResize(); + } + } + }) + + /*window.addEventListener('resize', (event) => { // Let's trigger the onResize method of any active scene that is a ResizableScene for (const scene of this.scene.getScenes(true)) { if (scene instanceof ResizableScene) { scene.onResize(event); } } - }); + });*/ } public step(time: number, delta: number) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 4de5ffd9..2d34060f 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -1452,8 +1452,8 @@ ${escapedMessage} this.connection?.emitActionableEvent(itemId, eventName, state, parameters); } - public onResize(ev: UIEvent): void { - super.onResize(ev); + public onResize(): void { + super.onResize(); this.reposition(); // Send new viewport to server diff --git a/front/src/Phaser/Login/CustomizeScene.ts b/front/src/Phaser/Login/CustomizeScene.ts index 8b9a9a7a..1892813c 100644 --- a/front/src/Phaser/Login/CustomizeScene.ts +++ b/front/src/Phaser/Login/CustomizeScene.ts @@ -52,7 +52,7 @@ export class CustomizeScene extends AbstractCharacterScene { create() { this.customizeSceneElement = this.add.dom(-1000, 0).createFromCache(customizeSceneKey); - this.centerXDomElement(this.customizeSceneElement, 150); + this.centerXDomElement(this.customizeSceneElement, 350); MenuScene.revealMenusAfterInit(this.customizeSceneElement, customizeSceneKey); this.customizeSceneElement.addListener('click'); @@ -270,7 +270,7 @@ export class CustomizeScene extends AbstractCharacterScene { this.Rectangle.x = this.cameras.main.worldView.x + this.cameras.main.width / 2; this.Rectangle.y = this.cameras.main.worldView.y + this.cameras.main.height / 3; - this.centerXDomElement(this.customizeSceneElement, 150); + this.centerXDomElement(this.customizeSceneElement, 350); } private nextSceneToCamera(){ diff --git a/front/src/Phaser/Login/LoginScene.ts b/front/src/Phaser/Login/LoginScene.ts index 435592f2..661ddeb4 100644 --- a/front/src/Phaser/Login/LoginScene.ts +++ b/front/src/Phaser/Login/LoginScene.ts @@ -80,7 +80,7 @@ export class LoginScene extends ResizableScene { } - public onResize(ev: UIEvent): void { + public onResize(): void { this.centerXDomElement(this.loginSceneElement, 200); } } diff --git a/front/src/Phaser/Login/ResizableScene.ts b/front/src/Phaser/Login/ResizableScene.ts index 39e2d74b..d06cb66c 100644 --- a/front/src/Phaser/Login/ResizableScene.ts +++ b/front/src/Phaser/Login/ResizableScene.ts @@ -2,7 +2,7 @@ import {Scene} from "phaser"; import DOMElement = Phaser.GameObjects.DOMElement; export abstract class ResizableScene extends Scene { - public abstract onResize(ev: UIEvent): void; + public abstract onResize(): void; /** * Centers the DOM element on the X axis. @@ -17,7 +17,7 @@ export abstract class ResizableScene extends Scene { && object.node && object.node.getBoundingClientRect().width > 0 ? (object.node.getBoundingClientRect().width / 2 / this.scale.zoom) - : (300 / this.scale.zoom) + : (defaultWidth / this.scale.zoom) ); } } diff --git a/front/src/Phaser/Login/SelectCharacterScene.ts b/front/src/Phaser/Login/SelectCharacterScene.ts index ecbb9c64..998a62e6 100644 --- a/front/src/Phaser/Login/SelectCharacterScene.ts +++ b/front/src/Phaser/Login/SelectCharacterScene.ts @@ -51,7 +51,7 @@ export class SelectCharacterScene extends AbstractCharacterScene { create() { this.selectCharacterSceneElement = this.add.dom(-1000, 0).createFromCache(selectCharacterKey); - this.centerXDomElement(this.selectCharacterSceneElement, 150); + this.centerXDomElement(this.selectCharacterSceneElement, 300); MenuScene.revealMenusAfterInit(this.selectCharacterSceneElement, selectCharacterKey); this.selectCharacterSceneElement.addListener('click'); @@ -211,7 +211,7 @@ export class SelectCharacterScene extends AbstractCharacterScene { const {playerX, playerY, playerScale, playserOpactity, playerVisible} = this.defineSetupPlayer(numero); player.setBounce(0.2); - player.setCollideWorldBounds(true); + player.setCollideWorldBounds(false); player.setVisible( playerVisible ); player.setScale(playerScale, playerScale); player.setAlpha(playserOpactity); @@ -240,10 +240,10 @@ export class SelectCharacterScene extends AbstractCharacterScene { update(time: number, delta: number): void { } - public onResize(ev: UIEvent): void { + public onResize(): void { //move position of user this.moveUser(); - this.centerXDomElement(this.selectCharacterSceneElement, 150); + this.centerXDomElement(this.selectCharacterSceneElement, 300); } } diff --git a/front/src/Phaser/Login/SelectCompanionScene.ts b/front/src/Phaser/Login/SelectCompanionScene.ts index 203fd557..0e32108a 100644 --- a/front/src/Phaser/Login/SelectCompanionScene.ts +++ b/front/src/Phaser/Login/SelectCompanionScene.ts @@ -43,7 +43,7 @@ export class SelectCompanionScene extends ResizableScene { create() { this.selectCompanionSceneElement = this.add.dom(-1000, 0).createFromCache(selectCompanionSceneKey); - this.centerXDomElement(this.selectCompanionSceneElement, 150); + this.centerXDomElement(this.selectCompanionSceneElement, 300); MenuScene.revealMenusAfterInit(this.selectCompanionSceneElement, selectCompanionSceneKey); this.selectCompanionSceneElement.addListener('click'); @@ -126,10 +126,10 @@ export class SelectCompanionScene extends ResizableScene { this.selectedCompanion = this.companions[this.currentCompanion]; } - public onResize(ev: UIEvent): void { + public onResize(): void { this.moveCompanion(); - this.centerXDomElement(this.selectCompanionSceneElement, 150); + this.centerXDomElement(this.selectCompanionSceneElement, 300); } private updateSelectedCompanion(): void { diff --git a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts b/front/src/Phaser/Menu/HelpCameraSettingsScene.ts index 6bc520c0..fcc7996a 100644 --- a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts +++ b/front/src/Phaser/Menu/HelpCameraSettingsScene.ts @@ -109,8 +109,10 @@ export class HelpCameraSettingsScene extends DirtyScene { this.dirty = false; } - public onResize(ev: UIEvent): void { - super.onResize(ev); + public onResize(): void { + super.onResize( + + ); if (this.helpCameraSettingsOpened) { const middleX = this.getMiddleX(); const middleY = this.getMiddleY(); From 1ac108a9b8719781916265f03f33ea8edfbcff7b Mon Sep 17 00:00:00 2001 From: GRL Date: Mon, 31 May 2021 10:20:30 +0200 Subject: [PATCH 03/53] correction of resize select character and companion by David --- front/dist/resources/html/CustomCharacterScene.html | 4 ++-- front/dist/resources/html/SelectCompanionScene.html | 2 +- front/src/Phaser/Game/DirtyScene.ts | 2 +- front/src/Phaser/Game/Game.ts | 12 ++++++++++-- front/src/Phaser/Game/GameScene.ts | 4 ++-- front/src/Phaser/Login/CustomizeScene.ts | 4 ++-- front/src/Phaser/Login/LoginScene.ts | 2 +- front/src/Phaser/Login/ResizableScene.ts | 4 ++-- front/src/Phaser/Login/SelectCharacterScene.ts | 8 ++++---- front/src/Phaser/Login/SelectCompanionScene.ts | 6 +++--- front/src/Phaser/Menu/HelpCameraSettingsScene.ts | 6 ++++-- front/src/Phaser/Services/WaScaleManager.ts | 9 ++++++++- 12 files changed, 40 insertions(+), 23 deletions(-) diff --git a/front/dist/resources/html/CustomCharacterScene.html b/front/dist/resources/html/CustomCharacterScene.html index 0bc050ea..0bf3f753 100644 --- a/front/dist/resources/html/CustomCharacterScene.html +++ b/front/dist/resources/html/CustomCharacterScene.html @@ -10,8 +10,8 @@ color: #ebeeee; width: 42vw; height: 48vh; - /*max-width: 300px; - max-height: 48vh;*/ + max-width: 350px; + /*max-height: 48vh;*/ overflow: hidden; } #customizeScene h1 { diff --git a/front/dist/resources/html/SelectCompanionScene.html b/front/dist/resources/html/SelectCompanionScene.html index cffa7880..30c782cb 100644 --- a/front/dist/resources/html/SelectCompanionScene.html +++ b/front/dist/resources/html/SelectCompanionScene.html @@ -128,7 +128,7 @@
- No companion + No companion
diff --git a/front/src/Phaser/Game/DirtyScene.ts b/front/src/Phaser/Game/DirtyScene.ts index 2e94aa66..3e1f3cdf 100644 --- a/front/src/Phaser/Game/DirtyScene.ts +++ b/front/src/Phaser/Game/DirtyScene.ts @@ -69,7 +69,7 @@ export abstract class DirtyScene extends ResizableScene { return this.dirty || this.objectListChanged; } - public onResize(ev: UIEvent): void { + public onResize(): void { this.objectListChanged = true; } } diff --git a/front/src/Phaser/Game/Game.ts b/front/src/Phaser/Game/Game.ts index 01aecf9f..e267e80a 100644 --- a/front/src/Phaser/Game/Game.ts +++ b/front/src/Phaser/Game/Game.ts @@ -21,14 +21,22 @@ export class Game extends Phaser.Game { constructor(GameConfig: Phaser.Types.Core.GameConfig) { super(GameConfig); - window.addEventListener('resize', (event) => { + this.scale.on(Phaser.Scale.Events.RESIZE, () => { + for (const scene of this.scene.getScenes(true)) { + if (scene instanceof ResizableScene) { + scene.onResize(); + } + } + }) + + /*window.addEventListener('resize', (event) => { // Let's trigger the onResize method of any active scene that is a ResizableScene for (const scene of this.scene.getScenes(true)) { if (scene instanceof ResizableScene) { scene.onResize(event); } } - }); + });*/ } public step(time: number, delta: number) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 4de5ffd9..2d34060f 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -1452,8 +1452,8 @@ ${escapedMessage} this.connection?.emitActionableEvent(itemId, eventName, state, parameters); } - public onResize(ev: UIEvent): void { - super.onResize(ev); + public onResize(): void { + super.onResize(); this.reposition(); // Send new viewport to server diff --git a/front/src/Phaser/Login/CustomizeScene.ts b/front/src/Phaser/Login/CustomizeScene.ts index 8b9a9a7a..1892813c 100644 --- a/front/src/Phaser/Login/CustomizeScene.ts +++ b/front/src/Phaser/Login/CustomizeScene.ts @@ -52,7 +52,7 @@ export class CustomizeScene extends AbstractCharacterScene { create() { this.customizeSceneElement = this.add.dom(-1000, 0).createFromCache(customizeSceneKey); - this.centerXDomElement(this.customizeSceneElement, 150); + this.centerXDomElement(this.customizeSceneElement, 350); MenuScene.revealMenusAfterInit(this.customizeSceneElement, customizeSceneKey); this.customizeSceneElement.addListener('click'); @@ -270,7 +270,7 @@ export class CustomizeScene extends AbstractCharacterScene { this.Rectangle.x = this.cameras.main.worldView.x + this.cameras.main.width / 2; this.Rectangle.y = this.cameras.main.worldView.y + this.cameras.main.height / 3; - this.centerXDomElement(this.customizeSceneElement, 150); + this.centerXDomElement(this.customizeSceneElement, 350); } private nextSceneToCamera(){ diff --git a/front/src/Phaser/Login/LoginScene.ts b/front/src/Phaser/Login/LoginScene.ts index 435592f2..661ddeb4 100644 --- a/front/src/Phaser/Login/LoginScene.ts +++ b/front/src/Phaser/Login/LoginScene.ts @@ -80,7 +80,7 @@ export class LoginScene extends ResizableScene { } - public onResize(ev: UIEvent): void { + public onResize(): void { this.centerXDomElement(this.loginSceneElement, 200); } } diff --git a/front/src/Phaser/Login/ResizableScene.ts b/front/src/Phaser/Login/ResizableScene.ts index 39e2d74b..d06cb66c 100644 --- a/front/src/Phaser/Login/ResizableScene.ts +++ b/front/src/Phaser/Login/ResizableScene.ts @@ -2,7 +2,7 @@ import {Scene} from "phaser"; import DOMElement = Phaser.GameObjects.DOMElement; export abstract class ResizableScene extends Scene { - public abstract onResize(ev: UIEvent): void; + public abstract onResize(): void; /** * Centers the DOM element on the X axis. @@ -17,7 +17,7 @@ export abstract class ResizableScene extends Scene { && object.node && object.node.getBoundingClientRect().width > 0 ? (object.node.getBoundingClientRect().width / 2 / this.scale.zoom) - : (300 / this.scale.zoom) + : (defaultWidth / this.scale.zoom) ); } } diff --git a/front/src/Phaser/Login/SelectCharacterScene.ts b/front/src/Phaser/Login/SelectCharacterScene.ts index ecbb9c64..998a62e6 100644 --- a/front/src/Phaser/Login/SelectCharacterScene.ts +++ b/front/src/Phaser/Login/SelectCharacterScene.ts @@ -51,7 +51,7 @@ export class SelectCharacterScene extends AbstractCharacterScene { create() { this.selectCharacterSceneElement = this.add.dom(-1000, 0).createFromCache(selectCharacterKey); - this.centerXDomElement(this.selectCharacterSceneElement, 150); + this.centerXDomElement(this.selectCharacterSceneElement, 300); MenuScene.revealMenusAfterInit(this.selectCharacterSceneElement, selectCharacterKey); this.selectCharacterSceneElement.addListener('click'); @@ -211,7 +211,7 @@ export class SelectCharacterScene extends AbstractCharacterScene { const {playerX, playerY, playerScale, playserOpactity, playerVisible} = this.defineSetupPlayer(numero); player.setBounce(0.2); - player.setCollideWorldBounds(true); + player.setCollideWorldBounds(false); player.setVisible( playerVisible ); player.setScale(playerScale, playerScale); player.setAlpha(playserOpactity); @@ -240,10 +240,10 @@ export class SelectCharacterScene extends AbstractCharacterScene { update(time: number, delta: number): void { } - public onResize(ev: UIEvent): void { + public onResize(): void { //move position of user this.moveUser(); - this.centerXDomElement(this.selectCharacterSceneElement, 150); + this.centerXDomElement(this.selectCharacterSceneElement, 300); } } diff --git a/front/src/Phaser/Login/SelectCompanionScene.ts b/front/src/Phaser/Login/SelectCompanionScene.ts index 203fd557..0e32108a 100644 --- a/front/src/Phaser/Login/SelectCompanionScene.ts +++ b/front/src/Phaser/Login/SelectCompanionScene.ts @@ -43,7 +43,7 @@ export class SelectCompanionScene extends ResizableScene { create() { this.selectCompanionSceneElement = this.add.dom(-1000, 0).createFromCache(selectCompanionSceneKey); - this.centerXDomElement(this.selectCompanionSceneElement, 150); + this.centerXDomElement(this.selectCompanionSceneElement, 300); MenuScene.revealMenusAfterInit(this.selectCompanionSceneElement, selectCompanionSceneKey); this.selectCompanionSceneElement.addListener('click'); @@ -126,10 +126,10 @@ export class SelectCompanionScene extends ResizableScene { this.selectedCompanion = this.companions[this.currentCompanion]; } - public onResize(ev: UIEvent): void { + public onResize(): void { this.moveCompanion(); - this.centerXDomElement(this.selectCompanionSceneElement, 150); + this.centerXDomElement(this.selectCompanionSceneElement, 300); } private updateSelectedCompanion(): void { diff --git a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts b/front/src/Phaser/Menu/HelpCameraSettingsScene.ts index 6bc520c0..fcc7996a 100644 --- a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts +++ b/front/src/Phaser/Menu/HelpCameraSettingsScene.ts @@ -109,8 +109,10 @@ export class HelpCameraSettingsScene extends DirtyScene { this.dirty = false; } - public onResize(ev: UIEvent): void { - super.onResize(ev); + public onResize(): void { + super.onResize( + + ); if (this.helpCameraSettingsOpened) { const middleX = this.getMiddleX(); const middleY = this.getMiddleY(); diff --git a/front/src/Phaser/Services/WaScaleManager.ts b/front/src/Phaser/Services/WaScaleManager.ts index ca8b668d..8ca4ad20 100644 --- a/front/src/Phaser/Services/WaScaleManager.ts +++ b/front/src/Phaser/Services/WaScaleManager.ts @@ -2,6 +2,7 @@ import {HdpiManager} from "./HdpiManager"; import ScaleManager = Phaser.Scale.ScaleManager; import {coWebsiteManager} from "../../WebRtc/CoWebsiteManager"; import type {Game} from "../Game/Game"; +import {ResizableScene} from "../Login/ResizableScene"; class WaScaleManager { @@ -30,13 +31,19 @@ class WaScaleManager { const { game: gameSize, real: realSize } = this.hdpiManager.getOptimalGameSize({width: width * devicePixelRatio, height: height * devicePixelRatio}); this.actualZoom = realSize.width / gameSize.width / devicePixelRatio; - this.scaleManager.setZoom(realSize.width / gameSize.width / devicePixelRatio); + this.scaleManager.setZoom(realSize.width / gameSize.width / devicePixelRatio) this.scaleManager.resize(gameSize.width, gameSize.height); // Override bug in canvas resizing in Phaser. Let's resize the canvas ourselves const style = this.scaleManager.canvas.style; style.width = Math.ceil(realSize.width / devicePixelRatio) + 'px'; style.height = Math.ceil(realSize.height / devicePixelRatio) + 'px'; + // Note: onResize will be called twice (once here and once is Game.ts), but we have no better way. + for (const scene of this.game.scene.getScenes(true)) { + if (scene instanceof ResizableScene) { + scene.onResize(); + } + } this.game.markDirty(); } From b8873d127780b92425ee9b6110e0b42ed4405283 Mon Sep 17 00:00:00 2001 From: GRL Date: Mon, 31 May 2021 12:06:11 +0200 Subject: [PATCH 04/53] selectCompanionScene work with svelte --- .../resources/html/CustomCharacterScene.html | 3 - .../resources/html/EnableCameraScene.html | 3 - .../resources/html/SelectCompanionScene.html | 134 ------------------ front/dist/resources/html/gameMenu.html | 3 - front/dist/resources/html/gameMenuIcon.html | 3 - .../dist/resources/html/gameQualityMenu.html | 3 - front/dist/resources/html/gameReport.html | 3 - front/dist/resources/html/gameShare.html | 3 - .../resources/html/helpCameraSettings.html | 3 - front/dist/resources/html/loginScene.html | 3 - .../resources/html/selectCharacterScene.html | 3 - .../dist/resources/html/warningContainer.html | 3 - front/src/Components/App.svelte | 10 +- front/src/Phaser/Game/GameScene.ts | 2 + .../src/Phaser/Login/SelectCompanionScene.ts | 65 +++------ front/src/WebRtc/SimplePeer.ts | 2 +- front/src/index.ts | 4 +- front/style/fonts.scss | 6 +- 18 files changed, 42 insertions(+), 214 deletions(-) delete mode 100644 front/dist/resources/html/SelectCompanionScene.html diff --git a/front/dist/resources/html/CustomCharacterScene.html b/front/dist/resources/html/CustomCharacterScene.html index 0bf3f753..9a8aac4d 100644 --- a/front/dist/resources/html/CustomCharacterScene.html +++ b/front/dist/resources/html/CustomCharacterScene.html @@ -1,7 +1,4 @@ - - diff --git a/front/dist/resources/html/gameMenu.html b/front/dist/resources/html/gameMenu.html index 6abf2753..399cf349 100644 --- a/front/dist/resources/html/gameMenu.html +++ b/front/dist/resources/html/gameMenu.html @@ -1,7 +1,4 @@ \ No newline at end of file diff --git a/front/src/Stores/SelectCompanionStore.ts b/front/src/Stores/SelectCompanionStore.ts new file mode 100644 index 00000000..e66f5de3 --- /dev/null +++ b/front/src/Stores/SelectCompanionStore.ts @@ -0,0 +1,3 @@ +import { derived, writable, Writable } from "svelte/store"; + +export const selectCompanionSceneVisibleStore = writable(false); From 13d32273238f51100ee2da4b8e4e4d070a3943b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Mon, 31 May 2021 17:03:29 +0200 Subject: [PATCH 06/53] Migrating LoginScene to Svelte --- CHANGELOG.md | 4 + front/dist/resources/html/loginScene.html | 117 ----------------- front/src/Components/App.svelte | 5 + front/src/Components/Login/LoginScene.svelte | 119 ++++++++++++++++++ .../SelectCompanionScene.svelte | 5 +- front/src/Components/images/logo.png | Bin 0 -> 15822 bytes front/src/Connexion/LocalUser.ts | 2 +- front/src/Enum/EnvironmentVariable.ts | 1 + front/src/Phaser/Login/LoginScene.ts | 59 ++------- front/src/Stores/LoginSceneStore.ts | 3 + front/src/WebRtc/ScreenSharingPeer.ts | 1 + front/style/fonts.scss | 6 +- front/webpack.config.ts | 4 +- 13 files changed, 150 insertions(+), 176 deletions(-) delete mode 100644 front/dist/resources/html/loginScene.html create mode 100644 front/src/Components/Login/LoginScene.svelte create mode 100644 front/src/Components/images/logo.png create mode 100644 front/src/Stores/LoginSceneStore.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index d9afd71e..b9b0a926 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ - Mouse wheel support to zoom in / out - Pinch support on mobile to zoom in / out - Improved virtual joystick size (adapts to the zoom level) +- Redesigned intermediate scenes + - Redesigned Select Companion scene + - Redesigned Enter Your Name scene + - Added a new `DISPLAY_TERMS_OF_USE` environment variable to trigger the display of terms of use - New scripting API features: - Use `WA.loadSound(): Sound` to load / play / stop a sound diff --git a/front/dist/resources/html/loginScene.html b/front/dist/resources/html/loginScene.html deleted file mode 100644 index 9c076693..00000000 --- a/front/dist/resources/html/loginScene.html +++ /dev/null @@ -1,117 +0,0 @@ - - - diff --git a/front/src/Components/App.svelte b/front/src/Components/App.svelte index f8a2589f..286b5687 100644 --- a/front/src/Components/App.svelte +++ b/front/src/Components/App.svelte @@ -7,12 +7,17 @@ import SelectCompanionScene from "./SelectCompanion/SelectCompanionScene.svelte"; import {selectCompanionSceneVisibleStore} from "../Stores/SelectCompanionStore"; import {Game} from "../Phaser/Game/Game"; + import LoginScene from "./Login/LoginScene.svelte"; + import {loginSceneVisibleStore} from "../Stores/LoginSceneStore"; export let game: Game;
+ {#if $loginSceneVisibleStore} + + {/if} {#if $selectCompanionSceneVisibleStore} {/if} diff --git a/front/src/Components/Login/LoginScene.svelte b/front/src/Components/Login/LoginScene.svelte new file mode 100644 index 00000000..6a05ba9f --- /dev/null +++ b/front/src/Components/Login/LoginScene.svelte @@ -0,0 +1,119 @@ + + +
+
+ WorkAdventure logo +
+
+

Enter your name

+
+ {startValidating = true}} class:is-error={name.trim() === '' && startValidating} /> +
+ {#if name.trim() === '' && startValidating } +

The name is empty

+ {/if} +
+ + {#if !DISPLAY_TERMS_OF_USE} +
+

By continuing, you are agreeing our terms of use, privacy policy and cookie policy.

+
+ {/if} +
+ +
+
+ + diff --git a/front/src/Components/SelectCompanion/SelectCompanionScene.svelte b/front/src/Components/SelectCompanion/SelectCompanionScene.svelte index 8638dc4d..9aaa0757 100644 --- a/front/src/Components/SelectCompanion/SelectCompanionScene.svelte +++ b/front/src/Components/SelectCompanion/SelectCompanionScene.svelte @@ -41,9 +41,6 @@ pointer-events: auto; color: #ebeeee; } - .selectCompanionScene button { - font-family: "Press Start 2P"; - } .selectCompanionScene section { margin: 10px; } @@ -80,4 +77,4 @@ } - \ No newline at end of file + diff --git a/front/src/Components/images/logo.png b/front/src/Components/images/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..f4440ad51079b55755f5b1f510ed6da89907fcee GIT binary patch literal 15822 zcmV;$tqyk4vm|jMSEvmS%*8hDvU3ZjB&O zQBgLlqwa#^U&HV5Ct;rm>?SK<9~llzsSHmMM)LB~qh)3-kzLqb9% zKR;ipsz_QSCnrael9FWFv}s0MT%7dm+0#WltxV*Dbfe2&JP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!AigGWiYAc5z$twJd*DZ))@(=Id+?h!Y>50eby8!Ue$qb&`OSq^TbakPH_*UoB~%XU z9fR5BPySb$zx;xHhjcbWg*=Ddo?ghqcJL<+G+QBEap2Kj^v5|FP#1_njI}C4OmO2%9ird4e4f=Z8iF4W7ejkyJ>IV6f~1jw)>Gb@}ebV zfn~c8c?(CH&j!D;U`8QJHGq~`M<^8zfh2(j&!dY+1T4$R@B@n$fz%}o2vK|nmh(u; z;#w%iPRLs)l<_toq@r}0Un*}id&1$?4aa|OfJ{)4or?64?`v^RQ;REalvRcQQu4nE zLXm|5xQ>vsa1hyAV#M!-g2bW7(gtztMVwTcceSwdY&*NZ`ON&Zv^1*{t&vf04z*cd zb+x$6wCiep{oMxj&3QP~yI=ZtDc&9|zo4Y41lqu^=boK~Xx*}L)|nMbGSeku&qmn_ zMUj9o%^(!bQQ_0@y>|CLE4nP*xLHn#%EAe>Hkku_7H+#hLv=3_FaXDHO)G?Ninup| z#u9u-gJvX-nC5ucrMc-hMBFVm#v6c7Xc ze_NY8drP+`cQ!!S0nmtP^9s|ZP4iZFyoUL+JVG#wqM={Eezm4sHvj+t07*qoM6N<$f+aWuq5uE@ literal 0 HcmV?d00001 diff --git a/front/src/Connexion/LocalUser.ts b/front/src/Connexion/LocalUser.ts index 43b184cf..f5a4ac2a 100644 --- a/front/src/Connexion/LocalUser.ts +++ b/front/src/Connexion/LocalUser.ts @@ -10,7 +10,7 @@ export interface CharacterTexture { export const maxUserNameLength: number = MAX_USERNAME_LENGTH; export function isUserNameValid(value: unknown): boolean { - return typeof value === "string" && value.length > 0 && value.length < maxUserNameLength && value.indexOf(' ') === -1; + return typeof value === "string" && value.length > 0 && value.length <= maxUserNameLength && value.indexOf(' ') === -1; } export function areCharacterLayersValid(value: string[] | null): boolean { diff --git a/front/src/Enum/EnvironmentVariable.ts b/front/src/Enum/EnvironmentVariable.ts index 85b63335..73f6427c 100644 --- a/front/src/Enum/EnvironmentVariable.ts +++ b/front/src/Enum/EnvironmentVariable.ts @@ -14,6 +14,7 @@ const POSITION_DELAY = 200; // Wait 200ms between sending position events const MAX_EXTRAPOLATION_TIME = 100; // Extrapolate a maximum of 250ms if no new movement is sent by the player export const MAX_USERNAME_LENGTH = parseInt(process.env.MAX_USERNAME_LENGTH || '') || 8; export const MAX_PER_GROUP = parseInt(process.env.MAX_PER_GROUP || '4'); +export const DISPLAY_TERMS_OF_USE = process.env.DISPLAY_TERMS_OF_USE == 'true'; export const isMobile = ():boolean => ( ( window.innerWidth <= 800 ) || ( window.innerHeight <= 600 ) ); diff --git a/front/src/Phaser/Login/LoginScene.ts b/front/src/Phaser/Login/LoginScene.ts index 4b36e3d9..39a8f5f3 100644 --- a/front/src/Phaser/Login/LoginScene.ts +++ b/front/src/Phaser/Login/LoginScene.ts @@ -1,17 +1,12 @@ import {gameManager} from "../Game/GameManager"; import {SelectCharacterSceneName} from "./SelectCharacterScene"; import {ResizableScene} from "./ResizableScene"; -import { localUserStore } from "../../Connexion/LocalUserStore"; -import {MenuScene} from "../Menu/MenuScene"; -import { isUserNameValid } from "../../Connexion/LocalUser"; +import {loginSceneVisibleStore} from "../../Stores/LoginSceneStore"; export const LoginSceneName = "LoginScene"; -const loginSceneKey = 'loginScene'; - export class LoginScene extends ResizableScene { - private loginSceneElement!: Phaser.GameObjects.DOMElement; private name: string = ''; constructor() { @@ -22,65 +17,25 @@ export class LoginScene extends ResizableScene { } preload() { - this.load.html(loginSceneKey, 'resources/html/loginScene.html'); } create() { - this.loginSceneElement = this.add.dom(-1000, 0).createFromCache(loginSceneKey); - this.centerXDomElement(this.loginSceneElement, 200); - MenuScene.revealMenusAfterInit(this.loginSceneElement, loginSceneKey); - - const pErrorElement = this.loginSceneElement.getChildByID('errorLoginScene') as HTMLInputElement; - const inputElement = this.loginSceneElement.getChildByID('loginSceneName') as HTMLInputElement; - inputElement.value = localUserStore.getName() ?? ''; - inputElement.focus(); - inputElement.addEventListener('keypress', (event: KeyboardEvent) => { - if(inputElement.value.length > 7){ - event.preventDefault(); - return; - } - pErrorElement.innerHTML = ''; - if(inputElement.value && !isUserNameValid(inputElement.value)){ - pErrorElement.innerHTML = 'Invalid user name: No spaces are allowed.'; - } - if (event.key === 'Enter') { - event.preventDefault(); - this.login(inputElement); - return; - } - }); - - const continuingButton = this.loginSceneElement.getChildByID('loginSceneFormSubmit') as HTMLButtonElement; - continuingButton.addEventListener('click', (e) => { - e.preventDefault(); - this.login(inputElement); - }); + loginSceneVisibleStore.set(true); } - private login(inputElement: HTMLInputElement): void { - const pErrorElement = this.loginSceneElement.getChildByID('errorLoginScene') as HTMLInputElement; - this.name = inputElement.value; - if (this.name === '') { - pErrorElement.innerHTML = 'The name is empty'; - return - } - if(!isUserNameValid(this.name)){ - pErrorElement.innerHTML = 'Invalid user name: only letters and numbers are allowed. No spaces.'; - return - } - if (this.name === '') return - gameManager.setPlayerName(this.name); + public login(name: string): void { + name = name.trim(); + gameManager.setPlayerName(name); this.scene.stop(LoginSceneName) gameManager.tryResumingGame(this, SelectCharacterSceneName); - this.scene.remove(LoginSceneName) + this.scene.remove(LoginSceneName); + loginSceneVisibleStore.set(false); } update(time: number, delta: number): void { - } public onResize(): void { - this.centerXDomElement(this.loginSceneElement, 200); } } diff --git a/front/src/Stores/LoginSceneStore.ts b/front/src/Stores/LoginSceneStore.ts new file mode 100644 index 00000000..6e2ea18b --- /dev/null +++ b/front/src/Stores/LoginSceneStore.ts @@ -0,0 +1,3 @@ +import { writable } from "svelte/store"; + +export const loginSceneVisibleStore = writable(false); diff --git a/front/src/WebRtc/ScreenSharingPeer.ts b/front/src/WebRtc/ScreenSharingPeer.ts index 947549eb..d797f59b 100644 --- a/front/src/WebRtc/ScreenSharingPeer.ts +++ b/front/src/WebRtc/ScreenSharingPeer.ts @@ -60,6 +60,7 @@ export class ScreenSharingPeer extends Peer { const message = JSON.parse(chunk.toString('utf8')); if (message.streamEnded !== true) { console.error('Unexpected message on screen sharing peer connection'); + return; } mediaManager.removeActiveScreenSharingVideo("" + this.userId); }); diff --git a/front/style/fonts.scss b/front/style/fonts.scss index 748710fa..a49d3967 100644 --- a/front/style/fonts.scss +++ b/front/style/fonts.scss @@ -2,4 +2,8 @@ *{ font-family: PixelFont-7,monospace; -} \ No newline at end of file +} + +.nes-btn { + font-family: "Press Start 2P"; +} diff --git a/front/webpack.config.ts b/front/webpack.config.ts index 6ebf907f..99cbff77 100644 --- a/front/webpack.config.ts +++ b/front/webpack.config.ts @@ -7,6 +7,7 @@ import MiniCssExtractPlugin from 'mini-css-extract-plugin'; import sveltePreprocess from 'svelte-preprocess'; import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin"; import NodePolyfillPlugin from 'node-polyfill-webpack-plugin'; +import {DISPLAY_TERMS_OF_USE} from "./src/Enum/EnvironmentVariable"; const mode = process.env.NODE_ENV ?? 'development'; const isProduction = mode === 'production'; @@ -175,7 +176,8 @@ module.exports = { 'JITSI_PRIVATE_MODE': null, 'START_ROOM_URL': null, 'MAX_USERNAME_LENGTH': 8, - 'MAX_PER_GROUP': 4 + 'MAX_PER_GROUP': 4, + 'DISPLAY_TERMS_OF_USE': false, }) ], From cb03580421de1cc24f628e6c2a2da2ea70079fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Mon, 31 May 2021 17:49:41 +0200 Subject: [PATCH 07/53] Partial migration of EnableCameraScene to Svelte --- .../resources/html/EnableCameraScene.html | 126 ------------------ front/src/Components/App.svelte | 7 +- .../EnableCamera/EnableCameraScene.svelte | 76 +++++++++++ front/src/Components/Login/LoginScene.svelte | 3 +- front/src/Phaser/Login/EnableCameraScene.ts | 29 +--- 5 files changed, 87 insertions(+), 154 deletions(-) delete mode 100644 front/dist/resources/html/EnableCameraScene.html create mode 100644 front/src/Components/EnableCamera/EnableCameraScene.svelte diff --git a/front/dist/resources/html/EnableCameraScene.html b/front/dist/resources/html/EnableCameraScene.html deleted file mode 100644 index 21c798b5..00000000 --- a/front/dist/resources/html/EnableCameraScene.html +++ /dev/null @@ -1,126 +0,0 @@ - - - diff --git a/front/src/Components/App.svelte b/front/src/Components/App.svelte index 286b5687..581c5673 100644 --- a/front/src/Components/App.svelte +++ b/front/src/Components/App.svelte @@ -1,7 +1,7 @@
@@ -21,6 +21,9 @@ {#if $selectCompanionSceneVisibleStore} {/if} + {#if $enableCameraSceneVisibilityStore} + + {/if} diff --git a/front/src/Components/EnableCamera/EnableCameraScene.svelte b/front/src/Components/EnableCamera/EnableCameraScene.svelte new file mode 100644 index 00000000..ac2cf992 --- /dev/null +++ b/front/src/Components/EnableCamera/EnableCameraScene.svelte @@ -0,0 +1,76 @@ + + +
+
+

Turn on your camera and microphone

+
+ +
+ +
+
+ + + diff --git a/front/src/Components/Login/LoginScene.svelte b/front/src/Components/Login/LoginScene.svelte index 6a05ba9f..ea824908 100644 --- a/front/src/Components/Login/LoginScene.svelte +++ b/front/src/Components/Login/LoginScene.svelte @@ -30,7 +30,7 @@

Enter your name

- {startValidating = true}} class:is-error={name.trim() === '' && startValidating} /> + {startValidating = true}} class:is-error={name.trim() === '' && startValidating} />
{#if name.trim() === '' && startValidating }

The name is empty

@@ -71,6 +71,7 @@ section.error-section { min-height: 2rem; + margin: 0; p { margin: 0; diff --git a/front/src/Phaser/Login/EnableCameraScene.ts b/front/src/Phaser/Login/EnableCameraScene.ts index 6002da7b..73fa7303 100644 --- a/front/src/Phaser/Login/EnableCameraScene.ts +++ b/front/src/Phaser/Login/EnableCameraScene.ts @@ -12,8 +12,8 @@ import { MenuScene } from "../Menu/MenuScene"; import {ResizableScene} from "./ResizableScene"; import { audioConstraintStore, - enableCameraSceneVisibilityStore, localStreamStore, + enableCameraSceneVisibilityStore, mediaStreamConstraintsStore, videoConstraintStore } from "../../Stores/MediaStore"; @@ -28,8 +28,6 @@ enum LoginTextures { arrowUp = "arrow_up" } -const enableCameraSceneKey = 'enableCameraScene'; - export class EnableCameraScene extends ResizableScene { private textField!: TextField; private cameraNameField!: TextField; @@ -45,8 +43,6 @@ export class EnableCameraScene extends ResizableScene { private soundMeterSprite!: SoundMeterSprite; private microphoneNameField!: TextField; - private enableCameraSceneElement!: Phaser.GameObjects.DOMElement; - private mobileTapZone!: Zone; private localStreamStoreUnsubscriber!: Unsubscriber; @@ -58,9 +54,6 @@ export class EnableCameraScene extends ResizableScene { } preload() { - - this.load.html(enableCameraSceneKey, 'resources/html/EnableCameraScene.html'); - this.load.image(LoginTextures.playButton, "resources/objects/play_button.png"); this.load.image(LoginTextures.arrowRight, "resources/objects/arrow_right.png"); this.load.image(LoginTextures.arrowUp, "resources/objects/arrow_up.png"); @@ -69,18 +62,6 @@ export class EnableCameraScene extends ResizableScene { } create() { - - this.enableCameraSceneElement = this.add.dom(-1000, 0).createFromCache(enableCameraSceneKey); - this.centerXDomElement(this.enableCameraSceneElement, 300); - - MenuScene.revealMenusAfterInit(this.enableCameraSceneElement, enableCameraSceneKey); - - const continuingButton = this.enableCameraSceneElement.getChildByID('enableCameraSceneFormSubmit') as HTMLButtonElement; - continuingButton.addEventListener('click', (e) => { - e.preventDefault(); - this.login(); - }); - if (touchScreenManager.supportTouchScreen) { new PinchManager(this); } @@ -272,19 +253,17 @@ export class EnableCameraScene extends ResizableScene { this.arrowUp.x = this.microphoneNameField.x - this.microphoneNameField.width / 2 - 16; this.arrowUp.y = this.microphoneNameField.y; - const actionBtn = document.querySelector('#enableCameraScene .action'); + /*const actionBtn = document.querySelector('#enableCameraScene .action'); if (actionBtn !== null) { actionBtn.style.top = (this.scale.height - 65) + 'px'; - } + }*/ } update(time: number, delta: number): void { this.soundMeterSprite.setVolume(this.soundMeter.getVolume()); - - this.centerXDomElement(this.enableCameraSceneElement, 300); } - private login(): void { + public login(): void { HtmlUtils.getElementByIdOrFail('webRtcSetup').style.display = 'none'; this.soundMeter.stop(); From 4923ce8b833b07daf19c834b0a2383d420c5c0f1 Mon Sep 17 00:00:00 2001 From: GRL Date: Mon, 31 May 2021 17:50:14 +0200 Subject: [PATCH 08/53] selectCharacterScene and customCharacterScene in svelte --- .../resources/html/CustomCharacterScene.html | 157 ------------------ .../resources/html/selectCharacterScene.html | 139 ---------------- front/dist/resources/objects/arrow_down.png | Bin 0 -> 4816 bytes front/dist/resources/objects/arrow_up.png | Bin 149 -> 4710 bytes front/src/Components/App.svelte | 14 +- .../CustomCharacterScene.svelte | 110 ++++++++++++ .../SelectCharacterScene.svelte | 84 ++++++++++ front/src/Phaser/Login/CustomizeScene.ts | 63 ++----- .../Login/SelectCharacterMobileScene.ts | 24 +-- .../src/Phaser/Login/SelectCharacterScene.ts | 43 ++--- front/src/Stores/CustomCharacterStore.ts | 3 + front/src/Stores/SelectCharacterStore.ts | 3 + 12 files changed, 249 insertions(+), 391 deletions(-) delete mode 100644 front/dist/resources/html/CustomCharacterScene.html delete mode 100644 front/dist/resources/html/selectCharacterScene.html create mode 100644 front/dist/resources/objects/arrow_down.png create mode 100644 front/src/Components/CustomCharacterScene/CustomCharacterScene.svelte create mode 100644 front/src/Components/selectCharacter/SelectCharacterScene.svelte create mode 100644 front/src/Stores/CustomCharacterStore.ts create mode 100644 front/src/Stores/SelectCharacterStore.ts diff --git a/front/dist/resources/html/CustomCharacterScene.html b/front/dist/resources/html/CustomCharacterScene.html deleted file mode 100644 index 9a8aac4d..00000000 --- a/front/dist/resources/html/CustomCharacterScene.html +++ /dev/null @@ -1,157 +0,0 @@ - - - diff --git a/front/dist/resources/html/selectCharacterScene.html b/front/dist/resources/html/selectCharacterScene.html deleted file mode 100644 index 88c84041..00000000 --- a/front/dist/resources/html/selectCharacterScene.html +++ /dev/null @@ -1,139 +0,0 @@ - - - diff --git a/front/dist/resources/objects/arrow_down.png b/front/dist/resources/objects/arrow_down.png new file mode 100644 index 0000000000000000000000000000000000000000..c89fb5f3fa79da69e2a67e763de0304e82f5c1f9 GIT binary patch literal 4816 zcmeHLX;c$g77h)Hg5ZXVic-Xdtt(YYD(euI07BFtLTp7vtt6FDN*0p>f;|e2zz8lh zwkxivh({Y76c-eCZ~?SI!P5#dHj0g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z$D5XL;NoUaDU^+<+t|kz@R&7z32^R*0OGI=Q1N|fkkHsk!a1ha_lG-@a zCxwjE5RnvaW|PTfu`nLW!dRGqg`(_FM&A(zBj`jkCKF|_x>GPuix3n8h{er)3IHq~ zpcY}Efxs!9L8jBiisrw5TA+(zZfe z(H+Ey#}i6RAmG=nQpDg|H38OlPeXl>lYcT4kYw&|?mY32tb+-Ix7WRC*s*)g)mZ~NGRh8Dp_(R# zriaq{yQR}yE`2k(8albG!>{vB!TN1mJJzO5hdP@0uH*dQGQtn=ue~n1R~ts_V(asG z|H<=0pG%hH<)&pNH)`%Soyhh4{%o@&+M&F>_wnRqIbyDT>5dv+-Vdke>|AuUwcvEt z4O>VOU9L-B9=HGtxz!3c-l=J*Kcjy1?j23gVED1|*Z>5aP5a8HgapyL%-@}-@_z!7 z{`$};BaP-*X1=V}dpnK>LR(5A4YqCWS$?yq@Xd~ mHh**C&9Exzo+0fatu`e&ey<#IejfY)`nk!ZS literal 0 HcmV?d00001 diff --git a/front/dist/resources/objects/arrow_up.png b/front/dist/resources/objects/arrow_up.png index b9f81ebc21b9be4af3c5f85ddeb5947ec958c7c1..6e948ae216bdbc1f31a4d1e7db53bc69de9db514 100644 GIT binary patch literal 4710 zcmeHLdsGu=7LRX4Kv1zRMi>SkfF_wdNoI*W0z!%bgeVVnbuyX20C|`U5CJJ-*&-@n zEmWx%5m2`lsSB>++XX5rT3xlS4-imPiV7%QSzDI<5)koh|M8sde`L-~X71y6@BQ8T zeJ7L6p}_&xmJXIQ8qHc7=obdQZB3`eL~wO_HGt7*V|!BMkyIF#4C(Y*6`4Rl)OsBO z5k^u)qZ#i$FI<^Rcee5$i1IJYP;b4WcXbR)%5Q%XR=Ms^u9 z>Qgoo3Xe2YI7HKYUtMx(8kbh^Bxaqx?M-oGuJw<{=gb$BbC0cXyl4}>_h4*Z)si1W z##z{8)>BST(;7wq=qv+a>Vw>l{+-Nf&$(l7c~o=iVxgevrRpm!amc#kM%azQulQ3ds_)hWT@YV4 z9D8xP7mbAqmN=jyEUUhkV zMW^3KT-%3!kY)>QTG2;UPrsPYoG_g#!tOKT@_7#kFcCrqn73rctc}i-Sh<^fKx&Jf5H+1rbAP z#BkTivoJ&|#c%{)hRAdhB9;tH(G%e*!E!t$9v3NLuf>+0Mic<32?~RZ>I97eHHu*~ zE(-2VVipXUO{jP=94QNhBw9TI@t8a&!tgheNgQ~wCFH4Bs?adMB|{M4NestQln!OF zl9Q8}$y}yZAH!mcL?RZ#VR1MNV8Jk~*HD;|p)t6aAOqVIXeg5x1pN?+FpQxTaWOu@;VM)@-UukE#z0{joG?KFa3%?G2#%7A;Fyx3Bya%1V{;io zA&4hEn3_60Kg1fp(H=EQVm|G%;p{iEz{>R4Rr!Oyr#;Gy$Vjz(EWzB{hl0 zcM3VFCc-Jq#3oz7;qW{Vj*!o1^F8<@yjKu<1DHe;CL3XL1_?2>1qHu# z!5{`KiBOsY0lz^N9*b#W2(Z3~2I{Sx{HU65oUN(TPY+@023mTsLNJ zX8if{dG+6H+ER7c=5Qv|H>U0J&^Y*(v?>tt-3eYRW%~&HtV(y z*}axiA#}z1sCkPQIC48O>+)7bc&0zxZHQ{w<;>l+bAgTBmYVr1igvckwi$DT-^QWs zQ{3{FUtPKTsAAWxu8V7CH9lQV_U!KdJaZY;-6nK$@&1JwdPsQn^^u1+gJ}a?UAf1v z-X=Sjrpm+pC-Dm&u>0v#RBi96BR)LezXD8vG??W9Y8W! z7Z_!r(QN8W=a_{_dEaq delta 121 zcmaE+GL>
+ {#if $selectCharacterSceneVisibleStore} + + {/if} + {#if $customCharacterSceneVisibleStore} + + {/if} {#if $selectCompanionSceneVisibleStore} - + {/if} +
+ Refresh + +
+ + + + diff --git a/front/dist/resources/objects/help-setting-camera-permission-chrome.png b/front/src/Components/HelpCameraSettings/images/help-setting-camera-permission-chrome.png similarity index 100% rename from front/dist/resources/objects/help-setting-camera-permission-chrome.png rename to front/src/Components/HelpCameraSettings/images/help-setting-camera-permission-chrome.png diff --git a/front/dist/resources/objects/help-setting-camera-permission-firefox.png b/front/src/Components/HelpCameraSettings/images/help-setting-camera-permission-firefox.png similarity index 100% rename from front/dist/resources/objects/help-setting-camera-permission-firefox.png rename to front/src/Components/HelpCameraSettings/images/help-setting-camera-permission-firefox.png diff --git a/front/src/Phaser/Game/GameManager.ts b/front/src/Phaser/Game/GameManager.ts index 2a1d3d8a..e1b969fc 100644 --- a/front/src/Phaser/Game/GameManager.ts +++ b/front/src/Phaser/Game/GameManager.ts @@ -7,6 +7,9 @@ import {LoginSceneName} from "../Login/LoginScene"; import {SelectCharacterSceneName} from "../Login/SelectCharacterScene"; import {EnableCameraSceneName} from "../Login/EnableCameraScene"; import {localUserStore} from "../../Connexion/LocalUserStore"; +import {get} from "svelte/store"; +import {requestedCameraState, requestedMicrophoneState} from "../../Stores/MediaStore"; +import {helpCameraSettingsVisibleStore} from "../../Stores/HelpCameraSettingsStore"; export interface HasMovedEvent { direction: string; @@ -89,7 +92,12 @@ export class GameManager { console.log('starting '+ (this.currentGameSceneName || this.startRoom.id)) scenePlugin.start(this.currentGameSceneName || this.startRoom.id); scenePlugin.launch(MenuSceneName); - scenePlugin.launch(HelpCameraSettingsSceneName);//700 + //scenePlugin.launch(HelpCameraSettingsSceneName);//700 + + if(!localUserStore.getHelpCameraSettingsShown() && (!get(requestedMicrophoneState) || !get(requestedCameraState))){ + helpCameraSettingsVisibleStore.set(true); + localUserStore.setHelpCameraSettingsShown(); + } } public gameSceneIsCreated(scene: GameScene) { diff --git a/front/src/Stores/HelpCameraSettingsStore.ts b/front/src/Stores/HelpCameraSettingsStore.ts new file mode 100644 index 00000000..88373dab --- /dev/null +++ b/front/src/Stores/HelpCameraSettingsStore.ts @@ -0,0 +1,3 @@ +import { writable } from "svelte/store"; + +export const helpCameraSettingsVisibleStore = writable(false); diff --git a/front/src/WebRtc/MediaManager.ts b/front/src/WebRtc/MediaManager.ts index 29973e46..180b5746 100644 --- a/front/src/WebRtc/MediaManager.ts +++ b/front/src/WebRtc/MediaManager.ts @@ -12,6 +12,7 @@ import { import { screenSharingLocalStreamStore } from "../Stores/ScreenSharingStore"; +import {helpCameraSettingsVisibleStore} from "../Stores/HelpCameraSettingsStore"; export type UpdatedLocalStreamCallback = (media: MediaStream|null) => void; export type StartScreenSharingCallback = (media: MediaStream) => void; @@ -29,7 +30,6 @@ export class MediaManager { startScreenSharingCallBacks : Set = new Set(); stopScreenSharingCallBacks : Set = new Set(); showReportModalCallBacks : Set = new Set(); - helpCameraSettingsCallBacks : Set = new Set(); private focused : boolean = true; @@ -64,7 +64,7 @@ export class MediaManager { if (result.type === 'error') { console.error(result.error); layoutManager.addInformation('warning', 'Camera access denied. Click here and check your browser permissions.', () => { - this.showHelpCameraSettingsCallBack(); + helpCameraSettingsVisibleStore.set(true); }, this.userInputManager); return; } @@ -74,7 +74,7 @@ export class MediaManager { if (result.type === 'error') { console.error(result.error); layoutManager.addInformation('warning', 'Screen sharing denied. Click here and check your browser permissions.', () => { - this.showHelpCameraSettingsCallBack(); + helpCameraSettingsVisibleStore.set(true); }, this.userInputManager); return; } @@ -395,16 +395,6 @@ export class MediaManager { this.showReportModalCallBacks.add(callback); } - public setHelpCameraSettingsCallBack(callback: HelpCameraSettingsCallBack){ - this.helpCameraSettingsCallBacks.add(callback); - } - - private showHelpCameraSettingsCallBack(){ - for(const callBack of this.helpCameraSettingsCallBacks){ - callBack(); - } - } - //FIX ME SOUNDMETER: check stalability of sound meter calculation /*updateSoudMeter(){ try{ From 9063ba2a1fa7b23b415e04f3a2163a1d6745123d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Tue, 1 Jun 2021 09:12:31 +0200 Subject: [PATCH 13/53] Removing call to removed method --- front/src/Phaser/Menu/HelpCameraSettingsScene.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts b/front/src/Phaser/Menu/HelpCameraSettingsScene.ts index fcc7996a..7d684df2 100644 --- a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts +++ b/front/src/Phaser/Menu/HelpCameraSettingsScene.ts @@ -47,10 +47,6 @@ export class HelpCameraSettingsScene extends DirtyScene { this.openHelpCameraSettingsOpened(); localUserStore.setHelpCameraSettingsShown(); } - - mediaManager.setHelpCameraSettingsCallBack(() => { - this.openHelpCameraSettingsOpened(); - }); } private openHelpCameraSettingsOpened(): void{ From 5839e0b270ae0589b27ba553daae316d1a6fe4f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Tue, 1 Jun 2021 09:17:01 +0200 Subject: [PATCH 14/53] Throwing exceptions into store subscribers is wreaking havok --- front/src/Phaser/Login/EnableCameraScene.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/front/src/Phaser/Login/EnableCameraScene.ts b/front/src/Phaser/Login/EnableCameraScene.ts index 73fa7303..3eabe4d7 100644 --- a/front/src/Phaser/Login/EnableCameraScene.ts +++ b/front/src/Phaser/Login/EnableCameraScene.ts @@ -111,8 +111,10 @@ export class EnableCameraScene extends ResizableScene { this.localStreamStoreUnsubscriber = localStreamStore.subscribe((result) => { if (result.type === 'error') { - // TODO: proper handling of the error - throw result.error; + // TODO: we could handle the error in a specific way on the EnableCameraScene page. + // TODO: we could handle the error in a specific way on the EnableCameraScene page. + return; + //throw result.error; } this.getDevices(); From 9a5300dd2dd6853c8c662f4bd629754b18b3c3db Mon Sep 17 00:00:00 2001 From: GRL Date: Tue, 1 Jun 2021 11:07:52 +0200 Subject: [PATCH 15/53] helpCameraSettingPopup in svelte with nes-css --- .../resources/html/helpCameraSettings.html | 106 ------------- .../HelpCameraSettingsPopup.svelte | 116 ++++---------- front/src/Phaser/Game/GameManager.ts | 2 - .../Phaser/Menu/HelpCameraSettingsScene.ts | 150 ------------------ front/src/index.ts | 3 +- 5 files changed, 29 insertions(+), 348 deletions(-) delete mode 100644 front/dist/resources/html/helpCameraSettings.html delete mode 100644 front/src/Phaser/Menu/HelpCameraSettingsScene.ts diff --git a/front/dist/resources/html/helpCameraSettings.html b/front/dist/resources/html/helpCameraSettings.html deleted file mode 100644 index 8c4e63c4..00000000 --- a/front/dist/resources/html/helpCameraSettings.html +++ /dev/null @@ -1,106 +0,0 @@ - - -
-
- Refresh - -
- diff --git a/front/src/Components/HelpCameraSettings/HelpCameraSettingsPopup.svelte b/front/src/Components/HelpCameraSettings/HelpCameraSettingsPopup.svelte index 44ebde3d..fc6656a0 100644 --- a/front/src/Components/HelpCameraSettings/HelpCameraSettingsPopup.svelte +++ b/front/src/Components/HelpCameraSettings/HelpCameraSettingsPopup.svelte @@ -3,6 +3,7 @@ import firefoxImg from "./images/help-setting-camera-permission-firefox.png"; import chromeImg from "./images/help-setting-camera-permission-chrome.png"; + let isAndroid = window.navigator.userAgent.includes('Android'); let isFirefox = window.navigator.userAgent.includes('Firefox'); let isChrome = window.navigator.userAgent.includes('Chrome'); @@ -16,115 +17,54 @@ -
-

Camera/Microphone access needed

-
-
Camera/Microphone access needed
-

Permission denied

-

You must allow camera and microphone access in your browser.

-
    -
  • Please click on the lock or camera symbol on the side of the URL in the address bar. Here you can grant "always allow" access to your input devices.
  • -
  • Please ensure that you have a camera AND microphone plugged into your computer.
  • -
-

Once you've followed these steps, please refresh this page.

-

If you prefer to continue without allowing camera and microphone access, click on Continue

+ +
+

Camera/Microphone access needed

+

Permission denied

+

You must allow camera and microphone access in your browser.

{#if isFirefox } - - {:else if isChrome } - +

Please click the "Remember this decision" checkbox, if you don't want Firefox to keep asking you the authorization.

+ + {:else if isChrome && !isAndroid } + {/if}

- -
- Refresh - +
+ +
diff --git a/front/src/Phaser/Game/GameManager.ts b/front/src/Phaser/Game/GameManager.ts index e1b969fc..8c38a626 100644 --- a/front/src/Phaser/Game/GameManager.ts +++ b/front/src/Phaser/Game/GameManager.ts @@ -2,7 +2,6 @@ import {GameScene} from "./GameScene"; import {connectionManager} from "../../Connexion/ConnectionManager"; import type {Room} from "../../Connexion/Room"; import {MenuScene, MenuSceneName} from "../Menu/MenuScene"; -import {HelpCameraSettingsScene, HelpCameraSettingsSceneName} from "../Menu/HelpCameraSettingsScene"; import {LoginSceneName} from "../Login/LoginScene"; import {SelectCharacterSceneName} from "../Login/SelectCharacterScene"; import {EnableCameraSceneName} from "../Login/EnableCameraScene"; @@ -92,7 +91,6 @@ export class GameManager { console.log('starting '+ (this.currentGameSceneName || this.startRoom.id)) scenePlugin.start(this.currentGameSceneName || this.startRoom.id); scenePlugin.launch(MenuSceneName); - //scenePlugin.launch(HelpCameraSettingsSceneName);//700 if(!localUserStore.getHelpCameraSettingsShown() && (!get(requestedMicrophoneState) || !get(requestedCameraState))){ helpCameraSettingsVisibleStore.set(true); diff --git a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts b/front/src/Phaser/Menu/HelpCameraSettingsScene.ts deleted file mode 100644 index 7d684df2..00000000 --- a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts +++ /dev/null @@ -1,150 +0,0 @@ -import {mediaManager} from "../../WebRtc/MediaManager"; -import {HtmlUtils} from "../../WebRtc/HtmlUtils"; -import {localUserStore} from "../../Connexion/LocalUserStore"; -import {DirtyScene} from "../Game/DirtyScene"; -import {get} from "svelte/store"; -import {requestedCameraState, requestedMicrophoneState} from "../../Stores/MediaStore"; - -export const HelpCameraSettingsSceneName = 'HelpCameraSettingsScene'; -const helpCameraSettings = 'helpCameraSettings'; -/** - * The scene that show how to permit Camera and Microphone access if there are not already allowed - */ -export class HelpCameraSettingsScene extends DirtyScene { - private helpCameraSettingsElement!: Phaser.GameObjects.DOMElement; - private helpCameraSettingsOpened: boolean = false; - - constructor() { - super({key: HelpCameraSettingsSceneName}); - } - - preload() { - this.load.html(helpCameraSettings, 'resources/html/helpCameraSettings.html'); - } - - create(){ - this.createHelpCameraSettings(); - } - - private createHelpCameraSettings() : void { - const middleX = this.getMiddleX(); - this.helpCameraSettingsElement = this.add.dom(middleX, -800, undefined, {overflow: 'scroll'}).createFromCache(helpCameraSettings); - this.revealMenusAfterInit(this.helpCameraSettingsElement, helpCameraSettings); - this.helpCameraSettingsElement.addListener('click'); - this.helpCameraSettingsElement.on('click', (event:MouseEvent) => { - if((event?.target as HTMLInputElement).id === 'mailto') { - return; - } - event.preventDefault(); - if((event?.target as HTMLInputElement).id === 'helpCameraSettingsFormRefresh') { - window.location.reload(); - }else if((event?.target as HTMLInputElement).id === 'helpCameraSettingsFormContinue') { - this.closeHelpCameraSettingsOpened(); - } - }); - - if(!localUserStore.getHelpCameraSettingsShown() && (!get(requestedMicrophoneState) || !get(requestedCameraState))){ - this.openHelpCameraSettingsOpened(); - localUserStore.setHelpCameraSettingsShown(); - } - } - - private openHelpCameraSettingsOpened(): void{ - HtmlUtils.getElementByIdOrFail('webRtcSetup').style.display = 'none'; - this.helpCameraSettingsOpened = true; - try{ - if(window.navigator.userAgent.includes('Firefox')){ - HtmlUtils.getElementByIdOrFail('browserHelpSetting').innerHTML =''; - }else if(window.navigator.userAgent.includes('Chrome')){ - HtmlUtils.getElementByIdOrFail('browserHelpSetting').innerHTML =''; - } - }catch(err) { - console.error('openHelpCameraSettingsOpened => getElementByIdOrFail => error', err); - } - const middleY = this.getMiddleY(); - const middleX = this.getMiddleX(); - this.tweens.add({ - targets: this.helpCameraSettingsElement, - y: middleY, - x: middleX, - duration: 1000, - ease: 'Power3', - overflow: 'scroll' - }); - - this.dirty = true; - } - - private closeHelpCameraSettingsOpened(): void{ - const middleX = this.getMiddleX(); - /*const helpCameraSettingsInfo = this.helpCameraSettingsElement.getChildByID('helpCameraSettings') as HTMLParagraphElement; - helpCameraSettingsInfo.innerText = ''; - helpCameraSettingsInfo.style.display = 'none';*/ - this.helpCameraSettingsOpened = false; - this.tweens.add({ - targets: this.helpCameraSettingsElement, - y: -1000, - x: middleX, - duration: 1000, - ease: 'Power3', - overflow: 'scroll' - }); - - this.dirty = true; - } - - private revealMenusAfterInit(menuElement: Phaser.GameObjects.DOMElement, rootDomId: string) { - //Dom elements will appear inside the viewer screen when creating before being moved out of it, which create a flicker effect. - //To prevent this, we put a 'hidden' attribute on the root element, we remove it only after the init is done. - setTimeout(() => { - (menuElement.getChildByID(rootDomId) as HTMLElement).hidden = false; - }, 250); - } - - update(time: number, delta: number): void { - this.dirty = false; - } - - public onResize(): void { - super.onResize( - - ); - if (this.helpCameraSettingsOpened) { - const middleX = this.getMiddleX(); - const middleY = this.getMiddleY(); - this.tweens.add({ - targets: this.helpCameraSettingsElement, - x: middleX, - y: middleY, - duration: 1000, - ease: 'Power3' - }); - this.dirty = true; - } - } - - private getMiddleX() : number{ - return (this.scale.width / 2) - - ( - this.helpCameraSettingsElement - && this.helpCameraSettingsElement.node - && this.helpCameraSettingsElement.node.getBoundingClientRect().width > 0 - ? (this.helpCameraSettingsElement.node.getBoundingClientRect().width / (2 * this.scale.zoom)) - : (400 / 2) - ); - } - - private getMiddleY() : number{ - const middleY = ((this.scale.height) - ( - (this.helpCameraSettingsElement - && this.helpCameraSettingsElement.node - && this.helpCameraSettingsElement.node.getBoundingClientRect().height > 0 - ? this.helpCameraSettingsElement.node.getBoundingClientRect().height : 400 /*FIXME to use a const will be injected in HTMLElement*/)/this.scale.zoom)) / 2; - return (middleY > 0 ? middleY : 0); - } - - public isDirty(): boolean { - return this.dirty; - } -} - diff --git a/front/src/index.ts b/front/src/index.ts index bc435ee1..90d4c612 100644 --- a/front/src/index.ts +++ b/front/src/index.ts @@ -13,7 +13,6 @@ import WebFontLoaderPlugin from 'phaser3-rex-plugins/plugins/webfontloader-plugi import {EntryScene} from "./Phaser/Login/EntryScene"; import {coWebsiteManager} from "./WebRtc/CoWebsiteManager"; import {MenuScene} from "./Phaser/Menu/MenuScene"; -import {HelpCameraSettingsScene} from "./Phaser/Menu/HelpCameraSettingsScene"; import {localUserStore} from "./Connexion/LocalUserStore"; import {ErrorScene} from "./Phaser/Reconnecting/ErrorScene"; import {iframeListener} from "./Api/IframeListener"; @@ -96,7 +95,7 @@ const config: GameConfig = { ErrorScene, CustomizeScene, MenuScene, - HelpCameraSettingsScene], + ], //resolution: window.devicePixelRatio / 2, fps: fps, dom: { From 47555d59558f8c324368d4fe155bbe09a6f98684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Tue, 1 Jun 2021 11:19:46 +0200 Subject: [PATCH 16/53] Migrating cam to Svelte on Camera setup screen --- front/dist/index.tmpl.html | 4 -- .../EnableCamera/EnableCameraScene.svelte | 66 +++++++++++++++++++ front/src/Phaser/Login/EnableCameraScene.ts | 15 ++--- front/style/style.css | 33 ---------- 4 files changed, 71 insertions(+), 47 deletions(-) diff --git a/front/dist/index.tmpl.html b/front/dist/index.tmpl.html index 9c251bf3..279609e8 100644 --- a/front/dist/index.tmpl.html +++ b/front/dist/index.tmpl.html @@ -94,10 +94,6 @@
-
- - -
diff --git a/front/src/Components/EnableCamera/EnableCameraScene.svelte b/front/src/Components/EnableCamera/EnableCameraScene.svelte index ac2cf992..f8b2867e 100644 --- a/front/src/Components/EnableCamera/EnableCameraScene.svelte +++ b/front/src/Components/EnableCamera/EnableCameraScene.svelte @@ -1,6 +1,8 @@

Turn on your camera and microphone

+
+ + +
+ - {#if $gameOverlayVisibilityStore} - - - {/if} {#if $helpCameraSettingsVisibleStore} {/if}
- +
From 9e35f96ce5284c9e6a7d5807ee72ac05315e8af7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Wed, 2 Jun 2021 09:58:00 +0200 Subject: [PATCH 27/53] Fixing absolute/relative layouts of Svelte layers --- front/src/Components/App.svelte | 47 ++++++++++------ front/src/Components/CameraControls.svelte | 44 +++++++-------- .../EnableCamera/EnableCameraScene.svelte | 54 ++++++++++++------- front/style/style.scss | 10 ++-- 4 files changed, 97 insertions(+), 58 deletions(-) diff --git a/front/src/Components/App.svelte b/front/src/Components/App.svelte index cba741fe..d1a18f21 100644 --- a/front/src/Components/App.svelte +++ b/front/src/Components/App.svelte @@ -22,31 +22,48 @@
-{#if $gameOverlayVisibilityStore} - - -{/if} -
{#if $loginSceneVisibleStore} - +
+ +
{/if} {#if $selectCharacterSceneVisibleStore} - +
+ +
{/if} {#if $customCharacterSceneVisibleStore} - +
+ +
{/if} {#if $selectCompanionSceneVisibleStore} - +
+ +
{/if} {#if $enableCameraSceneVisibilityStore} - +
+ +
+ {/if} + + + {#if $gameOverlayVisibilityStore} +
+ + +
{/if} - {#if $helpCameraSettingsVisibleStore} - +
+ +
{/if}
-
diff --git a/front/src/Components/CameraControls.svelte b/front/src/Components/CameraControls.svelte index bd35d230..5c17a9fe 100644 --- a/front/src/Components/CameraControls.svelte +++ b/front/src/Components/CameraControls.svelte @@ -34,26 +34,28 @@ -
-
- {#if $requestedScreenSharingState} - Start screen sharing - {:else} - Stop screen sharing - {/if} -
-
- {#if $requestedCameraState} - Turn on webcam - {:else} - Turn off webcam - {/if} -
-
- {#if $requestedMicrophoneState} - Turn on microphone - {:else} - Turn off microphone - {/if} +
+
+
+ {#if $requestedScreenSharingState} + Start screen sharing + {:else} + Stop screen sharing + {/if} +
+
+ {#if $requestedCameraState} + Turn on webcam + {:else} + Turn off webcam + {/if} +
+
+ {#if $requestedMicrophoneState} + Turn on microphone + {:else} + Turn off microphone + {/if} +
diff --git a/front/src/Components/EnableCamera/EnableCameraScene.svelte b/front/src/Components/EnableCamera/EnableCameraScene.svelte index 36e31cf6..b5b2748a 100644 --- a/front/src/Components/EnableCamera/EnableCameraScene.svelte +++ b/front/src/Components/EnableCamera/EnableCameraScene.svelte @@ -11,6 +11,8 @@ import {onDestroy} from "svelte"; import HorizontalSoundMeterWidget from "./HorizontalSoundMeterWidget.svelte"; import cinemaCloseImg from "../images/cinema-close.svg"; + import cinemaImg from "../images/cinema.svg"; + import microphoneImg from "../images/microphone.svg"; export let game: Game; let selectedCamera : string|null = null; @@ -86,27 +88,33 @@
{#if $cameraListStore.length > 1 } -
- -
+
+ Camera +
+ +
+
{/if} {#if $microphoneListStore.length > 1 } -
- -
+
+ Microphone +
+ +
+
{/if}
@@ -190,6 +198,16 @@ font-size: 200%; } + .control-group { + display: flex; + flex-direction: row; + + img { + width: 30px; + margin-right: 10px; + } + } + .webrtcsetup{ /*position: absolute; top: 140px; diff --git a/front/style/style.scss b/front/style/style.scss index 78cfcc66..ef3df5c5 100644 --- a/front/style/style.scss +++ b/front/style/style.scss @@ -1212,13 +1212,15 @@ div.action.danger p.action-body{ height: 100%; pointer-events: none; - .absolute-overlay { - position: absolute; + & > div { + position: relative; width: 100%; height: 100%; - & > * { - position: relative; + & > div { + position: absolute; + width: 100%; + height: 100%; } } } From ea576477cdb21383598ae0778b51430a68ec8c92 Mon Sep 17 00:00:00 2001 From: GRL Date: Wed, 2 Jun 2021 09:58:34 +0200 Subject: [PATCH 28/53] Border on videocam in enable camera scene --- front/src/Components/App.svelte | 52 +++++++------- .../EnableCamera/EnableCameraScene.svelte | 71 +++++-------------- 2 files changed, 45 insertions(+), 78 deletions(-) diff --git a/front/src/Components/App.svelte b/front/src/Components/App.svelte index cba741fe..6bf45e82 100644 --- a/front/src/Components/App.svelte +++ b/front/src/Components/App.svelte @@ -22,31 +22,31 @@
-{#if $gameOverlayVisibilityStore} - - -{/if} -
- {#if $loginSceneVisibleStore} - - {/if} - {#if $selectCharacterSceneVisibleStore} - - {/if} - {#if $customCharacterSceneVisibleStore} - - {/if} - {#if $selectCompanionSceneVisibleStore} - - {/if} - {#if $enableCameraSceneVisibilityStore} - - {/if} - - {#if $helpCameraSettingsVisibleStore} - + {#if $gameOverlayVisibilityStore} + + {/if} -
+
+ {#if $loginSceneVisibleStore} + + {/if} + {#if $selectCharacterSceneVisibleStore} + + {/if} + {#if $customCharacterSceneVisibleStore} + + {/if} + {#if $selectCompanionSceneVisibleStore} + + {/if} + {#if $enableCameraSceneVisibilityStore} + + {/if} + + {#if $helpCameraSettingsVisibleStore} + + {/if} +
diff --git a/front/src/Components/EnableCamera/EnableCameraScene.svelte b/front/src/Components/EnableCamera/EnableCameraScene.svelte index 36e31cf6..ddb31b1d 100644 --- a/front/src/Components/EnableCamera/EnableCameraScene.svelte +++ b/front/src/Components/EnableCamera/EnableCameraScene.svelte @@ -77,10 +77,13 @@

Turn on your camera and microphone

-
- - -
+ {#if $localStreamStore.stream} + + {:else } +
+ +
+ {/if}
@@ -110,21 +113,6 @@ {/if}
- - -
@@ -132,23 +120,10 @@ diff --git a/front/src/Components/UI/images/megaphone.svg b/front/src/Components/UI/images/megaphone.svg new file mode 100644 index 00000000..708f860c --- /dev/null +++ b/front/src/Components/UI/images/megaphone.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 10a038ba..fff6912c 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -280,7 +280,7 @@ export class GameScene extends DirtyScene implements CenterListener { this.load.spritesheet('layout_modes', 'resources/objects/layout_modes.png', {frameWidth: 32, frameHeight: 32}); this.load.bitmapFont('main_font', 'resources/fonts/arcade.png', 'resources/fonts/arcade.xml'); //eslint-disable-next-line @typescript-eslint/no-explicit-any - (this.load as any).rexWebFont({ + (this.load as any).rexWebFont({ custom: { families: ['Press Start 2P'], urls: ['/resources/fonts/fonts.css'], diff --git a/front/src/Phaser/Game/SoundManager.ts b/front/src/Phaser/Game/SoundManager.ts index f0210494..47614fca 100644 --- a/front/src/Phaser/Game/SoundManager.ts +++ b/front/src/Phaser/Game/SoundManager.ts @@ -17,7 +17,9 @@ class SoundManager { return res(sound); } loadPlugin.audio(soundUrl, soundUrl); - loadPlugin.once('filecomplete-audio-' + soundUrl, () => res(soundManager.add(soundUrl))); + loadPlugin.once('filecomplete-audio-' + soundUrl, () => { + res(soundManager.add(soundUrl)); + }); loadPlugin.start(); }); this.soundPromises.set(soundUrl,soundPromise); diff --git a/front/src/Stores/SoundPlayingStore.ts b/front/src/Stores/SoundPlayingStore.ts new file mode 100644 index 00000000..cf1d681c --- /dev/null +++ b/front/src/Stores/SoundPlayingStore.ts @@ -0,0 +1,22 @@ +import { writable } from "svelte/store"; + +/** + * A store that contains the URL of the sound currently playing + */ +function createSoundPlayingStore() { + const { subscribe, set, update } = writable(null); + + return { + subscribe, + playSound: (url: string) => { + set(url); + }, + soundEnded: () => { + set(null); + } + + + }; +} + +export const soundPlayingStore = createSoundPlayingStore(); diff --git a/front/style/style.scss b/front/style/style.scss index 883f63bb..f43fb240 100644 --- a/front/style/style.scss +++ b/front/style/style.scss @@ -810,35 +810,6 @@ input[type=range]:focus::-ms-fill-upper { } - -/*audio html when audio message playing*/ -.main-container .audio-playing { - position: absolute; - width: 200px; - height: 54px; - right: -210px; - top: 40px; - transition: all 0.1s ease-out; - background-color: black; - border-radius: 30px 0 0 30px; - display: inline-flex; -} - -.main-container .audio-playing.active{ - right: 0; -} -.main-container .audio-playing img{ - /*width: 30px;*/ - border-radius: 50%; - background-color: #ffda01; - padding: 10px; -} -.main-container .audio-playing p{ - color: white; - margin-left: 10px; - margin-top: 14px; -} - /* VIDEO QUALITY */ .main-console div.setting h1{ color: white; diff --git a/front/webpack.config.ts b/front/webpack.config.ts index 5ff37028..3a69b74a 100644 --- a/front/webpack.config.ts +++ b/front/webpack.config.ts @@ -94,6 +94,7 @@ module.exports = { // See https://github.com/sveltejs/svelte/issues/4946#issuecomment-662168782 if (warning.code === 'a11y-no-onchange') { return } + if (warning.code === 'a11y-autofocus') { return } // process as usual handleWarning(warning); From d43633e936448bc44740ebdb3f21164c2a135ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Wed, 2 Jun 2021 16:52:25 +0200 Subject: [PATCH 35/53] Added an animation when audio message played --- front/src/Components/UI/AudioPlaying.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front/src/Components/UI/AudioPlaying.svelte b/front/src/Components/UI/AudioPlaying.svelte index 1001c5b2..a2c6d321 100644 --- a/front/src/Components/UI/AudioPlaying.svelte +++ b/front/src/Components/UI/AudioPlaying.svelte @@ -1,4 +1,5 @@ -
+
Audio playing

Audio message