From df114bc1ce02a997879a218bd01c8476cc9caa2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Fri, 18 Dec 2020 15:58:49 +0100 Subject: [PATCH 1/2] Fixing broken reconnection --- front/src/Phaser/Game/GameScene.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index a5248ff7..734e0f96 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -155,14 +155,14 @@ export class GameScene extends ResizableScene implements CenterListener { private playerName!: string; private characterLayers!: string[]; - constructor(private room: Room, MapUrlFile: string) { + constructor(private room: Room, MapUrlFile: string, customKey?: string|undefined) { super({ - key: room.id + key: customKey ?? room.id }); this.Terrains = []; this.groups = new Map(); this.instance = room.getInstance(); - + this.MapUrlFile = MapUrlFile; this.RoomId = room.id; @@ -517,7 +517,7 @@ export class GameScene extends ResizableScene implements CenterListener { this.simplePeer.unregister(); const gameSceneKey = 'somekey' + Math.round(Math.random() * 10000); - const game: Phaser.Scene = new GameScene(this.room, this.MapUrlFile); + const game: Phaser.Scene = new GameScene(this.room, this.MapUrlFile, gameSceneKey); this.scene.add(gameSceneKey, game, true, { initPosition: { @@ -1220,6 +1220,6 @@ export class GameScene extends ResizableScene implements CenterListener { }); })) } - + } From 36f886aed6fef8b92ab5091f294dda1bd4525225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Fri, 18 Dec 2020 16:08:04 +0100 Subject: [PATCH 2/2] Fixing cat running too fast on reconnect scene because animations were duplicated --- front/src/Phaser/Game/GameScene.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 734e0f96..2a331069 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -579,8 +579,8 @@ export class GameScene extends ResizableScene implements CenterListener { this.ConsoleGlobalMessageManager = new ConsoleGlobalMessageManager(this.connection, this.userInputManager, this.connection.isAdmin()); - this.scene.wake(); - this.scene.sleep(ReconnectingSceneName); + this.scene.wake(); + this.scene.stop(ReconnectingSceneName); //init user position and play trigger to check layers properties this.gameMap.setPosition(this.CurrentPlayer.x, this.CurrentPlayer.y);