Merge branch 'develop' of github.com:thecodingmachine/workadventure into develop

This commit is contained in:
_Bastler 2022-05-12 09:02:34 +02:00
commit 82dc53c9c9
12 changed files with 722 additions and 10 deletions

View File

@ -96,6 +96,7 @@ export class User implements Movable {
public get silent(): boolean { public get silent(): boolean {
return ( return (
this.availabilityStatus === AvailabilityStatus.DENY_PROXIMITY_MEETING ||
this.availabilityStatus === AvailabilityStatus.SILENT || this.availabilityStatus === AvailabilityStatus.SILENT ||
this.availabilityStatus === AvailabilityStatus.JITSI this.availabilityStatus === AvailabilityStatus.JITSI
); );

View File

@ -12,6 +12,7 @@ export class PlayerStatusDot extends Phaser.GameObjects.Container {
[AvailabilityStatus.ONLINE]: { filling: 0x8cc43f, outline: 0x427a25 }, [AvailabilityStatus.ONLINE]: { filling: 0x8cc43f, outline: 0x427a25 },
[AvailabilityStatus.SILENT]: { filling: 0xe74c3c, outline: 0xc0392b }, [AvailabilityStatus.SILENT]: { filling: 0xe74c3c, outline: 0xc0392b },
[AvailabilityStatus.JITSI]: { filling: 0x8cc43f, outline: 0x427a25 }, [AvailabilityStatus.JITSI]: { filling: 0x8cc43f, outline: 0x427a25 },
[AvailabilityStatus.DENY_PROXIMITY_MEETING]: { filling: 0xffffff, outline: 0x404040 },
[AvailabilityStatus.UNRECOGNIZED]: { filling: 0xffffff, outline: 0xffffff }, [AvailabilityStatus.UNRECOGNIZED]: { filling: 0xffffff, outline: 0xffffff },
[AvailabilityStatus.UNCHANGED]: { filling: 0xffffff, outline: 0xffffff }, [AvailabilityStatus.UNCHANGED]: { filling: 0xffffff, outline: 0xffffff },
}; };

View File

@ -93,7 +93,7 @@ import { followUsersColorStore } from "../../Stores/FollowStore";
import { GameSceneUserInputHandler } from "../UserInput/GameSceneUserInputHandler"; import { GameSceneUserInputHandler } from "../UserInput/GameSceneUserInputHandler";
import { i18nJson } from "../../i18n/locales"; import { i18nJson } from "../../i18n/locales";
import LL, { locale } from "../../i18n/i18n-svelte"; 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 { StringUtils } from "../../Utils/StringUtils";
import { startLayerNamesStore } from "../../Stores/StartLayerNamesStore"; import { startLayerNamesStore } from "../../Stores/StartLayerNamesStore";
import { JitsiCoWebsite } from "../../WebRtc/CoWebsite/JitsiCoWebsite"; import { JitsiCoWebsite } from "../../WebRtc/CoWebsite/JitsiCoWebsite";
@ -228,7 +228,6 @@ export class GameScene extends DirtyScene {
private jitsiDominantSpeaker: boolean = false; private jitsiDominantSpeaker: boolean = false;
private jitsiParticipantsCount: number = 0; private jitsiParticipantsCount: number = 0;
public readonly superLoad: SuperLoaderPlugin; public readonly superLoad: SuperLoaderPlugin;
private allowProximityMeeting: boolean = true;
constructor(private room: Room, MapUrlFile: string, customKey?: string | undefined) { constructor(private room: Room, MapUrlFile: string, customKey?: string | undefined) {
super({ super({
@ -1147,14 +1146,14 @@ export class GameScene extends DirtyScene {
this.iframeSubscriptionList.push( this.iframeSubscriptionList.push(
iframeListener.disablePlayerProximityMeetingStream.subscribe(() => { iframeListener.disablePlayerProximityMeetingStream.subscribe(() => {
this.allowProximityMeeting = false; denyProximityMeetingStore.set(true);
this.disableMediaBehaviors(); this.disableMediaBehaviors();
}) })
); );
this.iframeSubscriptionList.push( this.iframeSubscriptionList.push(
iframeListener.enablePlayerProximityMeetingStream.subscribe(() => { iframeListener.enablePlayerProximityMeetingStream.subscribe(() => {
this.allowProximityMeeting = true; denyProximityMeetingStore.set(false);
this.enableMediaBehaviors(); this.enableMediaBehaviors();
}) })
); );
@ -2225,7 +2224,7 @@ export class GameScene extends DirtyScene {
} }
public enableMediaBehaviors() { public enableMediaBehaviors() {
if (this.allowProximityMeeting) { if (!get(denyProximityMeetingStore)) {
mediaManager.showMyCamera(); mediaManager.showMyCamera();
} }
} }

View File

@ -59,6 +59,8 @@ class UIWebsiteManager {
website.margin.right = websiteEvent.margin.right; website.margin.right = websiteEvent.margin.right;
} }
} }
uiWebsitesStore.update(website);
}); });
} }

View File

@ -30,6 +30,10 @@ export class GameSceneUserInputHandler implements UserInputHandlerInterface {
return; return;
} }
if (!this.gameScene.userInputManager.isControlsEnabled) {
return;
}
for (const object of gameObjects) { for (const object of gameObjects) {
if (object instanceof Player || object instanceof RemotePlayer) { if (object instanceof Player || object instanceof RemotePlayer) {
return; return;

View File

@ -176,7 +176,6 @@ export class UserInputManager {
this.scene.input.keyboard.removeAllListeners(); this.scene.input.keyboard.removeAllListeners();
} }
//todo: should we also disable the joystick?
disableControls() { disableControls() {
this.scene.input.keyboard.removeAllKeys(); this.scene.input.keyboard.removeAllKeys();
this.isInputDisabled = true; this.isInputDisabled = true;
@ -186,6 +185,11 @@ export class UserInputManager {
this.initKeyBoardEvent(); this.initKeyBoardEvent();
this.isInputDisabled = false; this.isInputDisabled = false;
} }
get isControlsEnabled() {
return !this.isInputDisabled;
}
getEventListForGameTick(): ActiveEventList { getEventListForGameTick(): ActiveEventList {
const eventsMap = new ActiveEventList(); const eventsMap = new ActiveEventList();
if (this.isInputDisabled) { if (this.isInputDisabled) {
@ -266,7 +270,7 @@ export class UserInputManager {
this.scene.input.on( this.scene.input.on(
Phaser.Input.Events.POINTER_DOWN, Phaser.Input.Events.POINTER_DOWN,
(pointer: Phaser.Input.Pointer, gameObjects: Phaser.GameObjects.GameObject[]) => { (pointer: Phaser.Input.Pointer, gameObjects: Phaser.GameObjects.GameObject[]) => {
if (!pointer.wasTouch) { if (!pointer.wasTouch || this.isInputDisabled) {
return; return;
} }
this.userInputHandler.handlePointerDownEvent(pointer, gameObjects); this.userInputHandler.handlePointerDownEvent(pointer, gameObjects);

View File

@ -182,11 +182,13 @@ function createVideoConstraintStore() {
export const inJitsiStore = writable(false); export const inJitsiStore = writable(false);
export const silentStore = writable(false); export const silentStore = writable(false);
export const denyProximityMeetingStore = writable(false);
export const availabilityStatusStore = derived( export const availabilityStatusStore = derived(
[inJitsiStore, silentStore, privacyShutdownStore], [inJitsiStore, silentStore, privacyShutdownStore, denyProximityMeetingStore],
([$inJitsiStore, $silentStore, $privacyShutdownStore]) => { ([$inJitsiStore, $silentStore, $privacyShutdownStore, $denyProximityMeetingStore]) => {
if ($inJitsiStore) return AvailabilityStatus.JITSI; if ($inJitsiStore) return AvailabilityStatus.JITSI;
if ($denyProximityMeetingStore) return AvailabilityStatus.DENY_PROXIMITY_MEETING;
if ($silentStore) return AvailabilityStatus.SILENT; if ($silentStore) return AvailabilityStatus.SILENT;
if ($privacyShutdownStore) return AvailabilityStatus.AWAY; if ($privacyShutdownStore) return AvailabilityStatus.AWAY;
return AvailabilityStatus.ONLINE; return AvailabilityStatus.ONLINE;
@ -320,7 +322,10 @@ export const mediaStreamConstraintsStore = derived(
//currentAudioConstraint = false; //currentAudioConstraint = false;
} }
if ($availabilityStatusStore === AvailabilityStatus.SILENT) { if (
$availabilityStatusStore === AvailabilityStatus.DENY_PROXIMITY_MEETING ||
$availabilityStatusStore === AvailabilityStatus.SILENT
) {
currentVideoConstraint = false; currentVideoConstraint = false;
currentAudioConstraint = false; currentAudioConstraint = false;
} }

View File

@ -11,6 +11,11 @@ function createUIWebsiteStore() {
add: (uiWebsite: UIWebsite) => { add: (uiWebsite: UIWebsite) => {
update((currentArray) => [...currentArray, uiWebsite]); update((currentArray) => [...currentArray, uiWebsite]);
}, },
update: (uiWebsite: UIWebsite) => {
update((currentArray) =>
currentArray.map((currentWebsite) => (currentWebsite.id === uiWebsite.id ? uiWebsite : currentWebsite))
);
},
remove: (uiWebsite: UIWebsite) => { remove: (uiWebsite: UIWebsite) => {
update((currentArray) => currentArray.filter((currentWebsite) => currentWebsite.id !== uiWebsite.id)); update((currentArray) => currentArray.filter((currentWebsite) => currentWebsite.id !== uiWebsite.id));
}, },

View File

@ -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
}

View File

@ -0,0 +1,3 @@
WA.onInit().then(() => {
WA.controls.disablePlayerProximityMeeting();
});

View File

@ -379,6 +379,14 @@
<a href="#" class="testLink" data-testmap="UIWebsite/uiwebsite.json" target="_blank">Testing UIWebsites</a> <a href="#" class="testLink" data-testmap="UIWebsite/uiwebsite.json" target="_blank">Testing UIWebsites</a>
</td> </td>
</tr> </tr>
<tr>
<td>
<input type="radio" name="test-disableproximitymeeting"> Success <input type="radio" name="test-disableproximitymeeting"> Failure <input type="radio" name="test-disableproximitymeeting" checked> Pending
</td>
<td>
<a href="#" class="testLink" data-testmap="DisableProximityMeeting/disableProximityMeeting.json" target="_blank">Testing disable proximity meeting</a>
</td>
</tr>
</table> </table>
<h2>CoWebsite</h2> <h2>CoWebsite</h2>
<table class="table"> <table class="table">

View File

@ -10,6 +10,7 @@ enum AvailabilityStatus {
SILENT = 2; SILENT = 2;
AWAY = 3; AWAY = 3;
JITSI = 4; JITSI = 4;
DENY_PROXIMITY_MEETING = 5;
} }
message PositionMessage { message PositionMessage {