FIX: rewrote the way scene exits are triggered
This commit is contained in:
parent
c5af6df7fa
commit
09d6d22a5d
6 changed files with 135 additions and 129 deletions
|
@ -39,20 +39,16 @@ export class GameManager {
|
|||
public async loadMap(room: Room, scenePlugin: Phaser.Scenes.ScenePlugin): Promise<void> {
|
||||
const roomID = room.id;
|
||||
const mapUrl = await room.getMapUrl();
|
||||
console.log('Loading map '+roomID+' at url '+mapUrl);
|
||||
|
||||
const gameIndex = scenePlugin.getIndex(mapUrl);
|
||||
const gameIndex = scenePlugin.getIndex(roomID);
|
||||
if(gameIndex === -1){
|
||||
const game : Phaser.Scene = GameScene.createFromUrl(room, mapUrl);
|
||||
console.log('Adding scene '+mapUrl);
|
||||
scenePlugin.add(mapUrl, game, false);
|
||||
scenePlugin.add(roomID, game, false);
|
||||
}
|
||||
}
|
||||
|
||||
public async goToStartingMap(scenePlugin: Phaser.Scenes.ScenePlugin) {
|
||||
const url = await this.startRoom.getMapUrl();
|
||||
console.log('Starting scene '+url);
|
||||
scenePlugin.start(url);
|
||||
public goToStartingMap(scenePlugin: Phaser.Scenes.ScenePlugin): void {
|
||||
scenePlugin.start(this.startRoom.id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue