This commit is contained in:
David Négrier 2020-06-11 10:40:43 +02:00
parent 43c7c9ad07
commit f7265c213e

View File

@ -189,6 +189,9 @@ export class GameManager {
if (this.reconnectScene === null && this.currentGameScene) { if (this.reconnectScene === null && this.currentGameScene) {
// In case we are asked to reconnect even if switchToDisconnectedScene was not triggered (can happen when a laptop goes to sleep) // In case we are asked to reconnect even if switchToDisconnectedScene was not triggered (can happen when a laptop goes to sleep)
this.switchToDisconnectedScene(); this.switchToDisconnectedScene();
// Wait a bit for scene to load. Otherwise, starting ReconnectingSceneName and then starting GameScene one after the other fails for some reason.
setTimeout(() => this.reconnectToGameScene(lastPositionShared), 500);
return;
} }
const game : Phaser.Scene = GameScene.createFromUrl(this.oldMapUrlFile, this.oldInstance); const game : Phaser.Scene = GameScene.createFromUrl(this.oldMapUrlFile, this.oldInstance);
this.reconnectScene?.scene.add(this.oldSceneKey, game, true, { initPosition: lastPositionShared }); this.reconnectScene?.scene.add(this.oldSceneKey, game, true, { initPosition: lastPositionShared });