Cleanup indentation

This commit is contained in:
Ludwig Behm 2021-01-16 21:39:31 +01:00
parent 8175106763
commit db6809fe00

View file

@ -106,6 +106,12 @@ interface DeleteGroupEventInterface {
groupId: number
}
interface MapProperty {
name: string;
type: string;
value: string|number;
}
const defaultStartLayerName = 'start';
export class GameScene extends ResizableScene implements CenterListener {
@ -183,6 +189,16 @@ export class GameScene extends ResizableScene implements CenterListener {
})
}
public getMapProperty(name: string, type: string, dflt: any = null): any {
if (!Array.isArray(this.mapFile.properties)) {
return dflt;
}
const properties: MapProperty[] = this.mapFile.properties;
const prop = properties.find((prop: MapProperty) => prop.type === type && prop.name === name)
return prop ? prop.value : dflt;
}
//hook preload scene
preload(): void {
addLoader(this);
@ -1207,7 +1223,7 @@ export class GameScene extends ResizableScene implements CenterListener {
}
public startJitsi(roomName: string, jwt?: string): void {
const jitsiUrl = getMapProperty(this.mapFile, 'jitsiUrl', 'string', JITSI_URL);
const jitsiUrl = this.getMapProperty('jitsiUrl', 'string', JITSI_URL);
jitsiFactory.start(jitsiUrl, roomName, this.playerName, jwt);
this.connection.setSilent(true);
mediaManager.hideGameOverlay();