Exit trigger action
- [x] Add trigger message custom - [x] Add trigger for exit map - [x] Update documentation
This commit is contained in:
parent
18fb508828
commit
5f88a1a0b9
@ -33,9 +33,14 @@ import {ReconnectingSceneName} from "../Reconnecting/ReconnectingScene";
|
|||||||
import {lazyLoadPlayerCharacterTextures} from "../Entity/PlayerTexturesLoadingManager";
|
import {lazyLoadPlayerCharacterTextures} from "../Entity/PlayerTexturesLoadingManager";
|
||||||
import {
|
import {
|
||||||
CenterListener,
|
CenterListener,
|
||||||
|
EXIT_MESSAGE_PROPERTIES, JITSI_MESSAGE_PROPERTIES,
|
||||||
layoutManager,
|
layoutManager,
|
||||||
LayoutMode,
|
LayoutMode,
|
||||||
ON_ACTION_TRIGGER_BUTTON, TRIGGER_JITSI_PROPERTIES, TRIGGER_WEBSITE_PROPERTIES
|
ON_ACTION_TRIGGER_BUTTON,
|
||||||
|
TRIGGER_EXIT_PROPERTIES,
|
||||||
|
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;
|
||||||
@ -621,11 +626,27 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private triggerOnMapLayerPropertyChange(){
|
private triggerOnMapLayerPropertyChange(){
|
||||||
|
/* @deprecated
|
||||||
this.gameMap.onPropertyChange('exitSceneUrl', (newValue, oldValue) => {
|
this.gameMap.onPropertyChange('exitSceneUrl', (newValue, oldValue) => {
|
||||||
if (newValue) this.onMapExit(newValue as string);
|
if (newValue) this.onMapExit(newValue as string);
|
||||||
});
|
});*/
|
||||||
this.gameMap.onPropertyChange('exitUrl', (newValue, oldValue) => {
|
this.gameMap.onPropertyChange('exitUrl', (newValue, oldValue, allProps) => {
|
||||||
if (newValue) this.onMapExit(newValue as string);
|
if (newValue === undefined) {
|
||||||
|
layoutManager.removeActionButton('exitUrl', this.userInputManager);
|
||||||
|
} else {
|
||||||
|
const exitTriggerValue = allProps.get(TRIGGER_EXIT_PROPERTIES);
|
||||||
|
if (exitTriggerValue && exitTriggerValue === ON_ACTION_TRIGGER_BUTTON) {
|
||||||
|
let message = allProps.get(EXIT_MESSAGE_PROPERTIES);
|
||||||
|
if(message === undefined){
|
||||||
|
message = 'Click on SPACE to entrer in next map';
|
||||||
|
}
|
||||||
|
layoutManager.addActionButton('exitUrl', message.toString(), () => {
|
||||||
|
this.onMapExit(newValue as string);
|
||||||
|
}, this.userInputManager);
|
||||||
|
} else {
|
||||||
|
this.onMapExit(newValue as string);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.gameMap.onPropertyChange('openWebsite', (newValue, oldValue, allProps) => {
|
this.gameMap.onPropertyChange('openWebsite', (newValue, oldValue, allProps) => {
|
||||||
if (newValue === undefined) {
|
if (newValue === undefined) {
|
||||||
@ -639,7 +660,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 = 'Click on SPACE to open the web site';
|
||||||
|
}
|
||||||
|
layoutManager.addActionButton('openWebsite', message.toString(), () => {
|
||||||
openWebsiteFunction();
|
openWebsiteFunction();
|
||||||
}, this.userInputManager);
|
}, this.userInputManager);
|
||||||
}else{
|
}else{
|
||||||
@ -655,7 +680,6 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
const openJitsiRoomFunction = () => {
|
const openJitsiRoomFunction = () => {
|
||||||
if (JITSI_PRIVATE_MODE) {
|
if (JITSI_PRIVATE_MODE) {
|
||||||
const adminTag = allProps.get("jitsiRoomAdminTag") as string|undefined;
|
const adminTag = allProps.get("jitsiRoomAdminTag") as string|undefined;
|
||||||
|
|
||||||
this.connection.emitQueryJitsiJwtMessage(this.instance.replace('/', '-') + "-" + newValue, adminTag);
|
this.connection.emitQueryJitsiJwtMessage(this.instance.replace('/', '-') + "-" + newValue, adminTag);
|
||||||
} else {
|
} else {
|
||||||
this.startJitsi(newValue as string);
|
this.startJitsi(newValue as string);
|
||||||
@ -665,14 +689,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 = 'Click 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);
|
||||||
|
@ -26,6 +26,11 @@ 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 TRIGGER_EXIT_PROPERTIES = 'exitTrigger';
|
||||||
|
|
||||||
|
export const WEBSITE_MESSAGE_PROPERTIES = 'openWebsiteTriggerMessage';
|
||||||
|
export const JITSI_MESSAGE_PROPERTIES = 'jitsiTriggerMessage';
|
||||||
|
export const EXIT_MESSAGE_PROPERTIES = 'exitTriggerMessage';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is in charge of the video-conference layout.
|
* This class is in charge of the video-conference layout.
|
||||||
|
Loading…
Reference in New Issue
Block a user