Refactoring Room.ts to fetch map url automatically from ID
This commit is contained in:
parent
0580c692d1
commit
aee06da7f9
7 changed files with 94 additions and 56 deletions
|
@ -17,7 +17,8 @@ export class GameManager {
|
|||
|
||||
public async init(scenePlugin: Phaser.Scenes.ScenePlugin) {
|
||||
this.startRoom = await connectionManager.initGameConnexion();
|
||||
this.loadMap(this.startRoom.url, this.startRoom.ID, scenePlugin);
|
||||
const url = await this.startRoom.getMapUrl();
|
||||
this.loadMap(url, this.startRoom.id, scenePlugin);
|
||||
}
|
||||
|
||||
public setPlayerName(name: string): void {
|
||||
|
@ -58,9 +59,10 @@ export class GameManager {
|
|||
return mapUrlStart.substring(startPos, endPos);
|
||||
}
|
||||
|
||||
public goToStartingMap(scenePlugin: Phaser.Scenes.ScenePlugin) {
|
||||
console.log('Starting scene '+this.startRoom.url);
|
||||
scenePlugin.start(this.startRoom.url, {startLayerName: 'global'});
|
||||
public async goToStartingMap(scenePlugin: Phaser.Scenes.ScenePlugin) {
|
||||
const url = await this.startRoom.getMapUrl();
|
||||
console.log('Starting scene '+url);
|
||||
scenePlugin.start(url, {startLayerName: 'global'});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue