This commit is contained in:
David Négrier 2020-06-22 16:11:48 +02:00
parent 9b174836cd
commit 3f927280a6
2 changed files with 3 additions and 3 deletions

View File

@ -158,7 +158,7 @@ export class Connection implements Connection {
.then((res) => { .then((res) => {
return new Promise<Connection>((resolve, reject) => { return new Promise<Connection>((resolve, reject) => {
let connection = new Connection(gameManager, name, characterSelected, res.data.token); const connection = new Connection(gameManager, name, characterSelected, res.data.token);
connection.onConnectError((error: object) => { connection.onConnectError((error: object) => {
console.log('An error occurred while connecting to socket server. Retrying'); console.log('An error occurred while connecting to socket server. Retrying');
@ -199,7 +199,7 @@ export class Connection implements Connection {
joinARoom(roomId: string, startX: number, startY: number, direction: string, moving: boolean): Promise<MessageUserPositionInterface[]> { joinARoom(roomId: string, startX: number, startY: number, direction: string, moving: boolean): Promise<MessageUserPositionInterface[]> {
const point = new Point(startX, startY, direction, moving); const point = new Point(startX, startY, direction, moving);
this.lastPositionShared = point; this.lastPositionShared = point;
let promise = new Promise<MessageUserPositionInterface[]>((resolve, reject) => { const promise = new Promise<MessageUserPositionInterface[]>((resolve, reject) => {
this.socket.emit(EventMessage.JOIN_ROOM, { roomId, position: {x: startX, y: startY, direction, moving }}, (userPositions: MessageUserPositionInterface[]) => { this.socket.emit(EventMessage.JOIN_ROOM, { roomId, position: {x: startX, y: startY, direction, moving }}, (userPositions: MessageUserPositionInterface[]) => {
//this.GameManager.initUsersPosition(userPositions); //this.GameManager.initUsersPosition(userPositions);
resolve(userPositions); resolve(userPositions);

View File

@ -190,7 +190,7 @@ export class GameScene extends Phaser.Scene {
this.simplePeer.closeAllConnections(); this.simplePeer.closeAllConnections();
let key = 'somekey'+Math.round(Math.random()*10000); const key = 'somekey'+Math.round(Math.random()*10000);
const game : Phaser.Scene = GameScene.createFromUrl(this.MapUrlFile, this.instance, key); const game : Phaser.Scene = GameScene.createFromUrl(this.MapUrlFile, this.instance, key);
this.scene.add(key, game, true, this.scene.add(key, game, true,
{ {