From 6c6789411ada78963fe7ed3faa408e54d03764fc Mon Sep 17 00:00:00 2001 From: jonny Date: Wed, 21 Apr 2021 11:20:17 +0200 Subject: [PATCH 001/141] added loadPage Api call --- front/src/Api/Events/LoadPageEvent.ts | 13 +++++++++++++ front/src/Api/IframeListener.ts | 7 +++++++ front/src/Phaser/Game/GameScene.ts | 6 ++++++ front/src/iframe_api.ts | 11 +++++++++++ 4 files changed, 37 insertions(+) create mode 100644 front/src/Api/Events/LoadPageEvent.ts diff --git a/front/src/Api/Events/LoadPageEvent.ts b/front/src/Api/Events/LoadPageEvent.ts new file mode 100644 index 00000000..6f8b9bcf --- /dev/null +++ b/front/src/Api/Events/LoadPageEvent.ts @@ -0,0 +1,13 @@ +import * as tg from "generic-type-guard"; + + + +export const isLoadPageEvent = + new tg.IsInterface().withProperties({ + url: tg.isString, + }).get(); + +/** + * A message sent from the iFrame to the game to add a message in the chat. + */ +export type LoadPageEvent = tg.GuardedType; diff --git a/front/src/Api/IframeListener.ts b/front/src/Api/IframeListener.ts index c875ebbb..f20e055c 100644 --- a/front/src/Api/IframeListener.ts +++ b/front/src/Api/IframeListener.ts @@ -12,6 +12,7 @@ import {ClosePopupEvent, isClosePopupEvent} from "./Events/ClosePopupEvent"; import {scriptUtils} from "./ScriptUtils"; import {GoToPageEvent, isGoToPageEvent} from "./Events/GoToPageEvent"; import {isOpenCoWebsite, OpenCoWebSiteEvent} from "./Events/OpenCoWebSiteEvent"; +import { isLoadPageEvent } from './Events/LoadPageEvent'; /** @@ -31,6 +32,10 @@ class IframeListener { private readonly _goToPageStream: Subject = new Subject(); public readonly goToPageStream = this._goToPageStream.asObservable(); + + private readonly _loadPageStream: Subject = new Subject(); + public readonly loadPageStream = this._loadPageStream.asObservable(); + private readonly _openCoWebSiteStream: Subject = new Subject(); public readonly openCoWebSiteStream = this._openCoWebSiteStream.asObservable(); @@ -103,6 +108,8 @@ class IframeListener { } else if (payload.type === 'removeBubble'){ this._removeBubbleStream.next(); + }else if (payload.type === 'loadPage' && isLoadPageEvent(payload.data)){ + this._loadPageStream.next(payload.data.url); } } diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 990f702c..ca13491c 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -841,6 +841,12 @@ ${escapedMessage} this.iframeSubscriptionList.push(iframeListener.enablePlayerControlStream.subscribe(()=>{ this.userInputManager.restoreControls(); })); + this.iframeSubscriptionList.push(iframeListener.loadPageStream.subscribe((url:string)=>{ + this.loadNextGame(url).then(()=>{ + this.scene.systems.settings.isTransition=true + this.onMapExit(url) + }) + })); let scriptedBubbleSprite : Sprite; this.iframeSubscriptionList.push(iframeListener.displayBubbleStream.subscribe(()=>{ scriptedBubbleSprite = new Sprite(this,this.CurrentPlayer.x + 25,this.CurrentPlayer.y,'circleSprite-white'); diff --git a/front/src/iframe_api.ts b/front/src/iframe_api.ts index 18d8d172..fb25c015 100644 --- a/front/src/iframe_api.ts +++ b/front/src/iframe_api.ts @@ -9,6 +9,7 @@ import {ClosePopupEvent} from "./Api/Events/ClosePopupEvent"; import {OpenTabEvent} from "./Api/Events/OpenTabEvent"; import {GoToPageEvent} from "./Api/Events/GoToPageEvent"; import {OpenCoWebSiteEvent} from "./Api/Events/OpenCoWebSiteEvent"; +import { LoadPageEvent } from './Api/Events/LoadPageEvent'; interface WorkAdventureApi { sendChatMessage(message: string, author: string): void; @@ -18,6 +19,7 @@ interface WorkAdventureApi { openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup; openTab(url : string): void; goToPage(url : string): void; + loadPage(url : string): void; openCoWebSite(url : string): void; closeCoWebSite(): void; disablePlayerControl() : void; @@ -122,6 +124,15 @@ window.WA = { },'*'); }, + loadPage(url : string) : void{ + window.parent.postMessage({ + "type" : 'loadPage', + "data" : { + url + } as LoadPageEvent + },'*'); + }, + openCoWebSite(url : string) : void{ window.parent.postMessage({ "type" : 'openCoWebSite', From 006195e8cc78998cd51cf70925551780f5524b67 Mon Sep 17 00:00:00 2001 From: jonny Date: Wed, 21 Apr 2021 11:54:37 +0200 Subject: [PATCH 002/141] rewrote to run in event loop --- front/src/Phaser/Game/GameScene.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index ca13491c..56647cfc 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -74,6 +74,7 @@ import CanvasTexture = Phaser.Textures.CanvasTexture; import GameObject = Phaser.GameObjects.GameObject; import FILE_LOAD_ERROR = Phaser.Loader.Events.FILE_LOAD_ERROR; import DOMElement = Phaser.GameObjects.DOMElement; +import EVENT_TYPE =Phaser.Scenes.Events import {Subscription} from "rxjs"; import {worldFullMessageStream} from "../../Connexion/WorldFullMessageStream"; import { lazyLoadCompanionResource } from "../Companion/CompanionTexturesLoadingManager"; @@ -843,8 +844,9 @@ ${escapedMessage} })); this.iframeSubscriptionList.push(iframeListener.loadPageStream.subscribe((url:string)=>{ this.loadNextGame(url).then(()=>{ - this.scene.systems.settings.isTransition=true - this.onMapExit(url) + this.events.once(EVENT_TYPE.POST_UPDATE,()=>{ + this.onMapExit(url); + }) }) })); let scriptedBubbleSprite : Sprite; From 8f6c65384a7a17c3df659fed8b63e3cd06327d70 Mon Sep 17 00:00:00 2001 From: jonny Date: Thu, 29 Apr 2021 10:43:51 +0200 Subject: [PATCH 003/141] added example script for map exit --- maps/tests/goToPageScript.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/maps/tests/goToPageScript.js b/maps/tests/goToPageScript.js index 2b2cf33b..0404bdb4 100644 --- a/maps/tests/goToPageScript.js +++ b/maps/tests/goToPageScript.js @@ -1,14 +1,16 @@ +/// var zoneName = "popUpGoToPageZone"; var urlPricing = "https://workadventu.re/pricing"; var urlGettingStarted = "https://workadventu.re/getting-started"; -var isCoWebSiteOpened = false; +var urlRelativeMap = "script_api.json"; +var isCoWebSiteOpened = false; WA.onChatMessage((message => { - WA.sendChatMessage('Poly Parrot says: "'+message+'"', 'Poly Parrot'); + WA.sendChatMessage('Poly Parrot says: "' + message + '"', 'Poly Parrot'); })); WA.onEnterZone(zoneName, () => { - WA.openPopup("popUp","Open Links",[ + WA.openPopup("popUp", "Open Links", [ { label: "Open Tab", className: "popUpElement", @@ -18,27 +20,34 @@ WA.onEnterZone(zoneName, () => { }) }, { - label: "Go To Page", className : "popUpElement", - callback:(popup => { + label: "Go To Page", className: "popUpElement", + callback: (popup => { WA.goToPage(urlPricing); popup.close(); }) - } - , + }, { - label: "openCoWebSite", className : "popUpElement", - callback:(popup => { + label: "openCoWebSite", className: "popUpElement", + callback: (popup => { WA.openCoWebSite(urlPricing); isCoWebSiteOpened = true; popup.close(); }) + }, { + label: "load grouped map", + className: "popUpElement", + callback: (popup => { + WA.loadPage(urlRelativeMap); + popup.close(); + }) + }]); }) WA.onLeaveZone(zoneName, () => { - if (isCoWebSiteOpened) { + if(isCoWebSiteOpened) { WA.closeCoWebSite(); isCoWebSiteOpened = false; } From 99926a89b260f4ba9f570f71faac23f6f47fa211 Mon Sep 17 00:00:00 2001 From: jonny Date: Thu, 29 Apr 2021 10:55:01 +0200 Subject: [PATCH 004/141] added goToPage.json with the loadPAge Api call to the index.html --- maps/tests/index.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/maps/tests/index.html b/maps/tests/index.html index f53bbae9..bb25b19c 100644 --- a/maps/tests/index.html +++ b/maps/tests/index.html @@ -41,6 +41,14 @@ Testing scripting API with a script + + + + Success Failure Pending + + + Testing scripting API with a script + From 99bd9d88d9db60c0fa750720b7306ee52f90e3bb Mon Sep 17 00:00:00 2001 From: jonny Date: Thu, 29 Apr 2021 10:56:56 +0200 Subject: [PATCH 005/141] renamed api method "exitSceneTo" --- front/src/iframe_api.ts | 4 ++-- maps/tests/goToPageScript.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/front/src/iframe_api.ts b/front/src/iframe_api.ts index fb25c015..56cffb1c 100644 --- a/front/src/iframe_api.ts +++ b/front/src/iframe_api.ts @@ -19,7 +19,7 @@ interface WorkAdventureApi { openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup; openTab(url : string): void; goToPage(url : string): void; - loadPage(url : string): void; + exitSceneTo(url : string): void; openCoWebSite(url : string): void; closeCoWebSite(): void; disablePlayerControl() : void; @@ -124,7 +124,7 @@ window.WA = { },'*'); }, - loadPage(url : string) : void{ + exitSceneTo(url : string) : void{ window.parent.postMessage({ "type" : 'loadPage', "data" : { diff --git a/maps/tests/goToPageScript.js b/maps/tests/goToPageScript.js index 0404bdb4..af5b7f9f 100644 --- a/maps/tests/goToPageScript.js +++ b/maps/tests/goToPageScript.js @@ -39,7 +39,7 @@ WA.onEnterZone(zoneName, () => { label: "load grouped map", className: "popUpElement", callback: (popup => { - WA.loadPage(urlRelativeMap); + WA.exitSceneTo(urlRelativeMap); popup.close(); }) From 2d8997c6d7bbfc8a96afbe2c7ba21f72a39da6d9 Mon Sep 17 00:00:00 2001 From: TabascoEye Date: Tue, 11 May 2021 17:38:28 +0200 Subject: [PATCH 006/141] 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 4b77e8c57754fcd6e50719a91ec2cc33177fbcda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Fri, 28 May 2021 09:31:04 +0200 Subject: [PATCH 007/141] Switching Camera controls in Svelte Moving Camera controls out of HTML + MediaManager and into Svelte components --- front/dist/index.tmpl.html | 4 +- front/src/Components/App.svelte | 5 ++ front/src/Components/CameraControls.svelte | 59 +++++++++++++++++++ front/src/Components/images/cinema-close.svg | 41 +++++++++++++ .../Components/images}/cinema.svg | 0 .../Components/images}/microphone-close.svg | 0 .../Components/images}/microphone.svg | 0 .../Components/images}/monitor-close.svg | 0 .../Components/images}/monitor.svg | 0 front/src/WebRtc/MediaManager.ts | 28 ++++----- 10 files changed, 121 insertions(+), 16 deletions(-) create mode 100644 front/src/Components/CameraControls.svelte create mode 100644 front/src/Components/images/cinema-close.svg rename front/{dist/resources/logos => src/Components/images}/cinema.svg (100%) rename front/{dist/resources/logos => src/Components/images}/microphone-close.svg (100%) rename front/{dist/resources/logos => src/Components/images}/microphone.svg (100%) rename front/{dist/resources/logos => src/Components/images}/monitor-close.svg (100%) rename front/{dist/resources/logos => src/Components/images}/monitor.svg (100%) diff --git a/front/dist/index.tmpl.html b/front/dist/index.tmpl.html index 7ef44116..1da7fad6 100644 --- a/front/dist/index.tmpl.html +++ b/front/dist/index.tmpl.html @@ -59,7 +59,7 @@ -
+