Moving property reading inside startJitsi (startJitsi is called at 2 different places)
This commit is contained in:
parent
5cb9624b0b
commit
a5bdf68246
@ -49,6 +49,10 @@ export class GameMap {
|
|||||||
this.lastProperties = newProps;
|
this.lastProperties = newProps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getCurrentProperties(): Map<string, string|boolean|number> {
|
||||||
|
return this.lastProperties;
|
||||||
|
}
|
||||||
|
|
||||||
private getProperties(key: number): Map<string, string|boolean|number> {
|
private getProperties(key: number): Map<string, string|boolean|number> {
|
||||||
const properties = new Map<string, string|boolean|number>();
|
const properties = new Map<string, string|boolean|number>();
|
||||||
|
|
||||||
|
@ -631,11 +631,11 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private safeParseJSONstring(jsonString: string|undefined) {
|
private safeParseJSONstring(jsonString: string|undefined, propertyName: string) {
|
||||||
try {
|
try {
|
||||||
return jsonString ? JSON.parse(jsonString) : {};
|
return jsonString ? JSON.parse(jsonString) : {};
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.warn(jsonString, e);
|
console.warn('Invalid JSON found in property "' + propertyName + '" of the map:' + jsonString, e);
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -678,10 +678,7 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
|
|
||||||
this.connection.emitQueryJitsiJwtMessage(this.instance.replace('/', '-') + "-" + newValue, adminTag);
|
this.connection.emitQueryJitsiJwtMessage(this.instance.replace('/', '-') + "-" + newValue, adminTag);
|
||||||
} else {
|
} else {
|
||||||
const jitsiConfig = this.safeParseJSONstring(allProps.get("jitsiConfig") as string|undefined);
|
this.startJitsi(newValue as string, undefined);
|
||||||
const jitsiInterfaceConfig = this.safeParseJSONstring(allProps.get("jitsiInterfaceConfig") as string|undefined);
|
|
||||||
|
|
||||||
this.startJitsi(newValue as string, undefined, jitsiConfig, jitsiInterfaceConfig);
|
|
||||||
}
|
}
|
||||||
layoutManager.removeActionButton('jitsiRoom', this.userInputManager);
|
layoutManager.removeActionButton('jitsiRoom', this.userInputManager);
|
||||||
}
|
}
|
||||||
@ -1240,8 +1237,12 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
this.updateCameraOffset();
|
this.updateCameraOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public startJitsi(roomName: string, jwt?: string, config: object = {}, interfaceConfig: object = {}): void {
|
public startJitsi(roomName: string, jwt?: string): void {
|
||||||
jitsiFactory.start(roomName, this.playerName, jwt, config, interfaceConfig);
|
const allProps = this.gameMap.getCurrentProperties();
|
||||||
|
const jitsiConfig = this.safeParseJSONstring(allProps.get("jitsiConfig") as string|undefined, 'jitsiConfig');
|
||||||
|
const jitsiInterfaceConfig = this.safeParseJSONstring(allProps.get("jitsiInterfaceConfig") as string|undefined, 'jitsiInterfaceConfig');
|
||||||
|
|
||||||
|
jitsiFactory.start(roomName, this.playerName, jwt, jitsiConfig, jitsiInterfaceConfig);
|
||||||
this.connection.setSilent(true);
|
this.connection.setSilent(true);
|
||||||
mediaManager.hideGameOverlay();
|
mediaManager.hideGameOverlay();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user