Merge remote-tracking branch 'upstream/develop' into main

This commit is contained in:
_Bastler
2021-03-29 08:17:53 +02:00
8 changed files with 42 additions and 33 deletions
+3 -4
View File
@@ -471,9 +471,7 @@ export class GameScene extends ResizableScene implements CenterListener {
this.connection.onServerDisconnected(() => {
console.log('Player disconnected from server. Reloading scene.');
this.simplePeer.closeAllConnections();
this.simplePeer.unregister();
this.cleanupClosingScene();
const gameSceneKey = 'somekey' + Math.round(Math.random() * 10000);
const game: Phaser.Scene = new GameScene(this.room, this.MapUrlFile, gameSceneKey);
@@ -708,6 +706,7 @@ export class GameScene extends ResizableScene implements CenterListener {
audioManager.unloadAudio();
// We are completely destroying the current scene to avoid using a half-backed instance when coming back to the same map.
this.connection?.closeConnection();
this.simplePeer.closeAllConnections();
this.simplePeer?.unregister();
this.messageSubscription?.unsubscribe();
}
@@ -818,7 +817,7 @@ export class GameScene extends ResizableScene implements CenterListener {
const y = Math.floor(key / layer.width);
const x = key % layer.width;
possibleStartPositions.push({x: x*32, y: y*32});
possibleStartPositions.push({x: x * this.mapFile.tilewidth, y: y * this.mapFile.tilewidth});
});
// Get a value at random amongst allowed values
if (possibleStartPositions.length === 0) {