diff --git a/back/src/Model/User.ts b/back/src/Model/User.ts index e6f4d39e..8efbce87 100644 --- a/back/src/Model/User.ts +++ b/back/src/Model/User.ts @@ -96,6 +96,7 @@ export class User implements Movable { public get silent(): boolean { return ( + this.availabilityStatus === AvailabilityStatus.DENY_PROXIMITY_MEETING || this.availabilityStatus === AvailabilityStatus.SILENT || this.availabilityStatus === AvailabilityStatus.JITSI ); diff --git a/front/src/Phaser/Components/PlayerStatusDot.ts b/front/src/Phaser/Components/PlayerStatusDot.ts index 75292aee..38cdb0ac 100644 --- a/front/src/Phaser/Components/PlayerStatusDot.ts +++ b/front/src/Phaser/Components/PlayerStatusDot.ts @@ -12,6 +12,7 @@ export class PlayerStatusDot extends Phaser.GameObjects.Container { [AvailabilityStatus.ONLINE]: { filling: 0x8cc43f, outline: 0x427a25 }, [AvailabilityStatus.SILENT]: { filling: 0xe74c3c, outline: 0xc0392b }, [AvailabilityStatus.JITSI]: { filling: 0x8cc43f, outline: 0x427a25 }, + [AvailabilityStatus.DENY_PROXIMITY_MEETING]: { filling: 0xffffff, outline: 0x404040 }, [AvailabilityStatus.UNRECOGNIZED]: { filling: 0xffffff, outline: 0xffffff }, [AvailabilityStatus.UNCHANGED]: { filling: 0xffffff, outline: 0xffffff }, }; diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 23a628bd..24652212 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -93,7 +93,7 @@ import { followUsersColorStore } from "../../Stores/FollowStore"; import { GameSceneUserInputHandler } from "../UserInput/GameSceneUserInputHandler"; import { i18nJson } from "../../i18n/locales"; import LL, { locale } from "../../i18n/i18n-svelte"; -import { availabilityStatusStore, localVolumeStore } from "../../Stores/MediaStore"; +import { availabilityStatusStore, denyProximityMeetingStore, localVolumeStore } from "../../Stores/MediaStore"; import { StringUtils } from "../../Utils/StringUtils"; import { startLayerNamesStore } from "../../Stores/StartLayerNamesStore"; import { JitsiCoWebsite } from "../../WebRtc/CoWebsite/JitsiCoWebsite"; @@ -228,7 +228,6 @@ export class GameScene extends DirtyScene { private jitsiDominantSpeaker: boolean = false; private jitsiParticipantsCount: number = 0; public readonly superLoad: SuperLoaderPlugin; - private allowProximityMeeting: boolean = true; constructor(private room: Room, MapUrlFile: string, customKey?: string | undefined) { super({ @@ -1147,14 +1146,14 @@ export class GameScene extends DirtyScene { this.iframeSubscriptionList.push( iframeListener.disablePlayerProximityMeetingStream.subscribe(() => { - this.allowProximityMeeting = false; + denyProximityMeetingStore.set(true); this.disableMediaBehaviors(); }) ); this.iframeSubscriptionList.push( iframeListener.enablePlayerProximityMeetingStream.subscribe(() => { - this.allowProximityMeeting = true; + denyProximityMeetingStore.set(false); this.enableMediaBehaviors(); }) ); @@ -2225,7 +2224,7 @@ export class GameScene extends DirtyScene { } public enableMediaBehaviors() { - if (this.allowProximityMeeting) { + if (!get(denyProximityMeetingStore)) { mediaManager.showMyCamera(); } } diff --git a/front/src/Phaser/Game/UI/UIWebsiteManager.ts b/front/src/Phaser/Game/UI/UIWebsiteManager.ts index ce3bb0d6..a717138d 100644 --- a/front/src/Phaser/Game/UI/UIWebsiteManager.ts +++ b/front/src/Phaser/Game/UI/UIWebsiteManager.ts @@ -59,6 +59,8 @@ class UIWebsiteManager { website.margin.right = websiteEvent.margin.right; } } + + uiWebsitesStore.update(website); }); } diff --git a/front/src/Phaser/UserInput/GameSceneUserInputHandler.ts b/front/src/Phaser/UserInput/GameSceneUserInputHandler.ts index c8cc9bc5..d34a38c9 100644 --- a/front/src/Phaser/UserInput/GameSceneUserInputHandler.ts +++ b/front/src/Phaser/UserInput/GameSceneUserInputHandler.ts @@ -30,6 +30,10 @@ export class GameSceneUserInputHandler implements UserInputHandlerInterface { return; } + if (!this.gameScene.userInputManager.isControlsEnabled) { + return; + } + for (const object of gameObjects) { if (object instanceof Player || object instanceof RemotePlayer) { return; diff --git a/front/src/Phaser/UserInput/UserInputManager.ts b/front/src/Phaser/UserInput/UserInputManager.ts index c974d4e4..e10cfc30 100644 --- a/front/src/Phaser/UserInput/UserInputManager.ts +++ b/front/src/Phaser/UserInput/UserInputManager.ts @@ -176,7 +176,6 @@ export class UserInputManager { this.scene.input.keyboard.removeAllListeners(); } - //todo: should we also disable the joystick? disableControls() { this.scene.input.keyboard.removeAllKeys(); this.isInputDisabled = true; @@ -186,6 +185,11 @@ export class UserInputManager { this.initKeyBoardEvent(); this.isInputDisabled = false; } + + get isControlsEnabled() { + return !this.isInputDisabled; + } + getEventListForGameTick(): ActiveEventList { const eventsMap = new ActiveEventList(); if (this.isInputDisabled) { @@ -266,7 +270,7 @@ export class UserInputManager { this.scene.input.on( Phaser.Input.Events.POINTER_DOWN, (pointer: Phaser.Input.Pointer, gameObjects: Phaser.GameObjects.GameObject[]) => { - if (!pointer.wasTouch) { + if (!pointer.wasTouch || this.isInputDisabled) { return; } this.userInputHandler.handlePointerDownEvent(pointer, gameObjects); diff --git a/front/src/Stores/MediaStore.ts b/front/src/Stores/MediaStore.ts index ea7eefb8..efa6d5dc 100644 --- a/front/src/Stores/MediaStore.ts +++ b/front/src/Stores/MediaStore.ts @@ -182,11 +182,13 @@ function createVideoConstraintStore() { export const inJitsiStore = writable(false); export const silentStore = writable(false); +export const denyProximityMeetingStore = writable(false); export const availabilityStatusStore = derived( - [inJitsiStore, silentStore, privacyShutdownStore], - ([$inJitsiStore, $silentStore, $privacyShutdownStore]) => { + [inJitsiStore, silentStore, privacyShutdownStore, denyProximityMeetingStore], + ([$inJitsiStore, $silentStore, $privacyShutdownStore, $denyProximityMeetingStore]) => { if ($inJitsiStore) return AvailabilityStatus.JITSI; + if ($denyProximityMeetingStore) return AvailabilityStatus.DENY_PROXIMITY_MEETING; if ($silentStore) return AvailabilityStatus.SILENT; if ($privacyShutdownStore) return AvailabilityStatus.AWAY; return AvailabilityStatus.ONLINE; @@ -320,7 +322,10 @@ export const mediaStreamConstraintsStore = derived( //currentAudioConstraint = false; } - if ($availabilityStatusStore === AvailabilityStatus.SILENT) { + if ( + $availabilityStatusStore === AvailabilityStatus.DENY_PROXIMITY_MEETING || + $availabilityStatusStore === AvailabilityStatus.SILENT + ) { currentVideoConstraint = false; currentAudioConstraint = false; } diff --git a/front/src/Stores/UIWebsiteStore.ts b/front/src/Stores/UIWebsiteStore.ts index 37c17156..92fccd11 100644 --- a/front/src/Stores/UIWebsiteStore.ts +++ b/front/src/Stores/UIWebsiteStore.ts @@ -11,6 +11,11 @@ function createUIWebsiteStore() { add: (uiWebsite: UIWebsite) => { update((currentArray) => [...currentArray, uiWebsite]); }, + update: (uiWebsite: UIWebsite) => { + update((currentArray) => + currentArray.map((currentWebsite) => (currentWebsite.id === uiWebsite.id ? uiWebsite : currentWebsite)) + ); + }, remove: (uiWebsite: UIWebsite) => { update((currentArray) => currentArray.filter((currentWebsite) => currentWebsite.id !== uiWebsite.id)); }, diff --git a/maps/tests/DisableProximityMeeting/disableProximityMeeting.json b/maps/tests/DisableProximityMeeting/disableProximityMeeting.json new file mode 100644 index 00000000..fd1bab92 --- /dev/null +++ b/maps/tests/DisableProximityMeeting/disableProximityMeeting.json @@ -0,0 +1,679 @@ +{ "compressionlevel":-1, + "height":10, + "infinite":false, + "layers":[ + { + "data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + "height":10, + "id":1, + "name":"floor", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":10, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":10, + "id":2, + "name":"start", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":10, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 23, 23, 23, 23, 23, + 0, 0, 0, 0, 0, 23, 23, 23, 23, 23, + 0, 0, 0, 0, 0, 23, 23, 23, 23, 23, + 0, 0, 0, 0, 0, 23, 23, 23, 23, 23, + 0, 0, 0, 0, 0, 23, 23, 23, 23, 23, + 0, 0, 0, 0, 0, 23, 23, 23, 23, 23, + 0, 0, 0, 0, 0, 23, 23, 23, 23, 23, + 0, 0, 0, 0, 0, 23, 23, 23, 23, 23, + 0, 0, 0, 0, 0, 23, 23, 23, 23, 23, + 0, 0, 0, 0, 0, 23, 23, 23, 23, 23], + "height":10, + "id":5, + "name":"second_carpet", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":10, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 12, 12, 12, 12, 12, + 0, 0, 0, 0, 0, 12, 12, 12, 12, 12, + 0, 0, 0, 0, 0, 12, 12, 12, 12, 12, + 0, 0, 0, 0, 0, 12, 12, 12, 12, 12, + 0, 0, 0, 0, 0, 12, 12, 12, 12, 12], + "height":10, + "id":7, + "name":"first_carpet", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":10, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "id":3, + "name":"floorLayer", + "objects":[ + { + "height":96.1395797597459, + "id":1, + "name":"Tests", + "rotation":0, + "text": + { + "fontfamily":"Sans Serif", + "pixelsize":8, + "text":"You can't talk to anyone", + "wrap":true + }, + "type":"", + "visible":true, + "width":158.381128664136, + "x":1.64026713939023, + "y":221.821616458465 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 82, 0, + 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 19, 27, 0, + 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":10, + "id":8, + "name":"objects", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":10, + "x":0, + "y":0 + }], + "nextlayerid":9, + "nextobjectid":3, + "orientation":"orthogonal", + "properties":[ + { + "name":"script", + "type":"string", + "value":"script.js" + }], + "renderorder":"right-down", + "tiledversion":"1.8.4", + "tileheight":32, + "tilesets":[ + { + "columns":11, + "firstgid":1, + "image":"..\/tileset1.png", + "imageheight":352, + "imagewidth":352, + "margin":0, + "name":"tileset1", + "spacing":0, + "tilecount":121, + "tileheight":32, + "tiles":[ + { + "id":1, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":2, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":3, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":4, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":5, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":6, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":7, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":8, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":9, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":10, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + + { + "id":12, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":16, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":17, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":18, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":19, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":20, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":21, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":23, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":24, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":25, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + + { + "id":26, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":27, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":28, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":29, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":30, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":31, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":32, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":34, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":35, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":42, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + + { + "id":43, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":45, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":46, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":59, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":60, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":70, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":71, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":80, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":81, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":89, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + + { + "id":91, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":93, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":94, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":95, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":96, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":97, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":100, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":102, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":103, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":104, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + + { + "id":105, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":106, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":107, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":108, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":114, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }, + { + "id":115, + "properties":[ + { + "name":"collides", + "type":"bool", + "value":true + }] + }], + "tilewidth":32 + }], + "tilewidth":32, + "type":"map", + "version":"1.8", + "width":10 +} \ No newline at end of file diff --git a/maps/tests/DisableProximityMeeting/script.js b/maps/tests/DisableProximityMeeting/script.js new file mode 100644 index 00000000..1c1ee875 --- /dev/null +++ b/maps/tests/DisableProximityMeeting/script.js @@ -0,0 +1,3 @@ +WA.onInit().then(() => { + WA.controls.disablePlayerProximityMeeting(); +}); diff --git a/maps/tests/index.html b/maps/tests/index.html index 5c849315..2d9c0a84 100644 --- a/maps/tests/index.html +++ b/maps/tests/index.html @@ -379,6 +379,14 @@ Testing UIWebsites + + + Success Failure Pending + + + Testing disable proximity meeting + +

CoWebsite

diff --git a/messages/protos/messages.proto b/messages/protos/messages.proto index d1a3eebf..a92477a8 100644 --- a/messages/protos/messages.proto +++ b/messages/protos/messages.proto @@ -10,6 +10,7 @@ enum AvailabilityStatus { SILENT = 2; AWAY = 3; JITSI = 4; + DENY_PROXIMITY_MEETING = 5; } message PositionMessage {