Fixing broken reconnection

This commit is contained in:
David Négrier 2020-12-18 15:58:49 +01:00
parent 84de023d82
commit df114bc1ce

View File

@ -155,9 +155,9 @@ export class GameScene extends ResizableScene implements CenterListener {
private playerName!: string; private playerName!: string;
private characterLayers!: string[]; private characterLayers!: string[];
constructor(private room: Room, MapUrlFile: string) { constructor(private room: Room, MapUrlFile: string, customKey?: string|undefined) {
super({ super({
key: room.id key: customKey ?? room.id
}); });
this.Terrains = []; this.Terrains = [];
this.groups = new Map<number, Sprite>(); this.groups = new Map<number, Sprite>();
@ -517,7 +517,7 @@ export class GameScene extends ResizableScene implements CenterListener {
this.simplePeer.unregister(); this.simplePeer.unregister();
const gameSceneKey = 'somekey' + Math.round(Math.random() * 10000); 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, this.scene.add(gameSceneKey, game, true,
{ {
initPosition: { initPosition: {