Merge pull request #655 from thecodingmachine/exitTriggerAction

Message trigger action
This commit is contained in:
grégoire parant 2021-02-17 19:47:46 +01:00 committed by GitHub
commit c3286e61cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 77 additions and 11 deletions

View File

@ -33,9 +33,13 @@ import {ReconnectingSceneName} from "../Reconnecting/ReconnectingScene";
import {lazyLoadPlayerCharacterTextures, loadCustomTexture} from "../Entity/PlayerTexturesLoadingManager"; import {lazyLoadPlayerCharacterTextures, loadCustomTexture} from "../Entity/PlayerTexturesLoadingManager";
import { import {
CenterListener, CenterListener,
JITSI_MESSAGE_PROPERTIES,
layoutManager, layoutManager,
LayoutMode, LayoutMode,
ON_ACTION_TRIGGER_BUTTON, TRIGGER_JITSI_PROPERTIES, TRIGGER_WEBSITE_PROPERTIES ON_ACTION_TRIGGER_BUTTON,
TRIGGER_JITSI_PROPERTIES,
TRIGGER_WEBSITE_PROPERTIES,
WEBSITE_MESSAGE_PROPERTIES
} from "../../WebRtc/LayoutManager"; } from "../../WebRtc/LayoutManager";
import Texture = Phaser.Textures.Texture; import Texture = Phaser.Textures.Texture;
import Sprite = Phaser.GameObjects.Sprite; import Sprite = Phaser.GameObjects.Sprite;
@ -659,7 +663,11 @@ export class GameScene extends ResizableScene implements CenterListener {
const openWebsiteTriggerValue = allProps.get(TRIGGER_WEBSITE_PROPERTIES); const openWebsiteTriggerValue = allProps.get(TRIGGER_WEBSITE_PROPERTIES);
if(openWebsiteTriggerValue && openWebsiteTriggerValue === ON_ACTION_TRIGGER_BUTTON) { if(openWebsiteTriggerValue && openWebsiteTriggerValue === ON_ACTION_TRIGGER_BUTTON) {
layoutManager.addActionButton('openWebsite', 'Click on SPACE to open the web site', () => { let message = allProps.get(WEBSITE_MESSAGE_PROPERTIES);
if(message === undefined){
message = 'Press on SPACE to open the web site';
}
layoutManager.addActionButton('openWebsite', message.toString(), () => {
openWebsiteFunction(); openWebsiteFunction();
}, this.userInputManager); }, this.userInputManager);
}else{ }else{
@ -686,14 +694,18 @@ export class GameScene extends ResizableScene implements CenterListener {
const jitsiTriggerValue = allProps.get(TRIGGER_JITSI_PROPERTIES); const jitsiTriggerValue = allProps.get(TRIGGER_JITSI_PROPERTIES);
if(jitsiTriggerValue && jitsiTriggerValue === ON_ACTION_TRIGGER_BUTTON) { if(jitsiTriggerValue && jitsiTriggerValue === ON_ACTION_TRIGGER_BUTTON) {
layoutManager.addActionButton('jitsiRoom', 'Click on SPACE to enter in jitsi meet room', () => { let message = allProps.get(JITSI_MESSAGE_PROPERTIES);
if (message === undefined) {
message = 'Press on SPACE to enter in jitsi meet room';
}
layoutManager.addActionButton('jitsiRoom', message.toString(), () => {
openJitsiRoomFunction(); openJitsiRoomFunction();
}, this.userInputManager); }, this.userInputManager);
}else{ }else{
openJitsiRoomFunction(); openJitsiRoomFunction();
} }
} }
}) });
this.gameMap.onPropertyChange('silent', (newValue, oldValue) => { this.gameMap.onPropertyChange('silent', (newValue, oldValue) => {
if (newValue === undefined || newValue === false || newValue === '') { if (newValue === undefined || newValue === false || newValue === '') {
this.connection.setSilent(false); this.connection.setSilent(false);

View File

@ -24,9 +24,13 @@ export interface CenterListener {
} }
export const ON_ACTION_TRIGGER_BUTTON = 'onaction'; export const ON_ACTION_TRIGGER_BUTTON = 'onaction';
export const TRIGGER_WEBSITE_PROPERTIES = 'openWebsiteTrigger'; export const TRIGGER_WEBSITE_PROPERTIES = 'openWebsiteTrigger';
export const TRIGGER_JITSI_PROPERTIES = 'jitsiTrigger'; export const TRIGGER_JITSI_PROPERTIES = 'jitsiTrigger';
export const WEBSITE_MESSAGE_PROPERTIES = 'openWebsiteTriggerMessage';
export const JITSI_MESSAGE_PROPERTIES = 'jitsiTriggerMessage';
/** /**
* This class is in charge of the video-conference layout. * This class is in charge of the video-conference layout.
* It receives positioning requests for videos and does its best to place them on the screen depending on the active layout mode. * It receives positioning requests for videos and does its best to place them on the screen depending on the active layout mode.

View File

@ -49,6 +49,11 @@
"name":"jitsiTrigger", "name":"jitsiTrigger",
"type":"string", "type":"string",
"value":"onaction" "value":"onaction"
},
{
"name":"jitsiTriggerMessage",
"type":"string",
"value":"Test trigger message"
}], }],
"type":"tilelayer", "type":"tilelayer",
"visible":true, "visible":true,
@ -225,6 +230,11 @@
"name":"openWebsiteTrigger", "name":"openWebsiteTrigger",
"type":"string", "type":"string",
"value":"onaction" "value":"onaction"
},
{
"name":"openWebsiteTriggerMessage",
"type":"string",
"value":"Test d'envoi d'un message"
}], }],
"type":"tilelayer", "type":"tilelayer",
"visible":true, "visible":true,
@ -275,6 +285,16 @@
"name":"exit_stairs", "name":"exit_stairs",
"opacity":1, "opacity":1,
"properties":[ "properties":[
{
"name":"exitTrigger",
"type":"string",
"value":"onaction"
},
{
"name":"exitTriggerMessage",
"type":"string",
"value":"Test d'envoi d'un message"
},
{ {
"name":"exitUrl", "name":"exitUrl",
"type":"string", "type":"string",
@ -293,10 +313,20 @@
"name":"exit_lyon", "name":"exit_lyon",
"opacity":1, "opacity":1,
"properties":[ "properties":[
{
"name":"exitTrigger",
"type":"string",
"value":"onaction"
},
{
"name":"exitTriggerMessage",
"type":"string",
"value":"Test d'envoi d'un message"
},
{ {
"name":"exitUrl", "name":"exitUrl",
"type":"string", "type":"string",
"value":"..\/..\/..\/fjhzfiunzedoazmnj\/aurelgit.github.io\/wokalys\/map.json" "value":"\/@\/tcm\/workadventure\/lyon"
}], }],
"type":"tilelayer", "type":"tilelayer",
"visible":true, "visible":true,
@ -312,9 +342,19 @@
"opacity":1, "opacity":1,
"properties":[ "properties":[
{ {
"name":"exitSceneUrl", "name":"exitTrigger",
"type":"string", "type":"string",
"value":"https:\/\/npeguin.github.io\/coders-map\/map.json" "value":"onaction"
},
{
"name":"exitTriggerMessage",
"type":"string",
"value":"Test d'envoi d'un message"
},
{
"name":"exitUrl",
"type":"string",
"value":"\/@\/tcm\/workadventure\/coder"
}], }],
"type":"tilelayer", "type":"tilelayer",
"visible":true, "visible":true,
@ -330,9 +370,19 @@
"opacity":1, "opacity":1,
"properties":[ "properties":[
{ {
"name":"exitSceneUrl", "name":"exitTrigger",
"type":"string", "type":"string",
"value":"https:\/\/npeguin.github.io\/corridor-map\/map.json" "value":"onaction"
},
{
"name":"exitTriggerMessage",
"type":"string",
"value":"Test d'envoi d'un message"
},
{
"name":"exitUrl",
"type":"string",
"value":"\/@\/tcm\/workadventure\/corridor"
}], }],
"type":"tilelayer", "type":"tilelayer",
"visible":true, "visible":true,
@ -433,7 +483,7 @@
"nextobjectid":2, "nextobjectid":2,
"orientation":"orthogonal", "orientation":"orthogonal",
"renderorder":"right-down", "renderorder":"right-down",
"tiledversion":"1.3.3", "tiledversion":"1.4.3",
"tileheight":32, "tileheight":32,
"tilesets":[ "tilesets":[
{ {
@ -2379,6 +2429,6 @@
}], }],
"tilewidth":32, "tilewidth":32,
"type":"map", "type":"map",
"version":1.2, "version":1.4,
"width":46 "width":46
} }