x
This commit is contained in:
@@ -17,11 +17,12 @@ class Game{
|
|||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
this.io.to(`game-${this.code}`).emit("waitForStart", this.players.length);
|
this.io.to(`game-${this.code}`).emit("waitForStart", this.players.length);
|
||||||
this.io.to(`game-${this.code}`).emit("randomTest", Math.floor(Math.random() * 1000) + 1);
|
this.io.to(`game-${this.code}`).emit("randomTest", Math.floor(Math.random() * 1000) + 1);
|
||||||
}, 1000);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
addUser(user){
|
addUser(user){
|
||||||
if(this.players.length >= 2) return 1;
|
if(this.players.length >= 2) return 1;
|
||||||
|
|
||||||
this.players.push(user);
|
this.players.push(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,13 +30,12 @@ class GameManager {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(oldLobbySave)
|
|
||||||
|
|
||||||
if(!wasInLobby) return 1;
|
if(!wasInLobby) return 1;
|
||||||
|
|
||||||
if(!oldLobbySave.gameCode){
|
if(!oldLobbySave.gameCode){
|
||||||
const code = this.generateNonExistingCode();
|
const code = this.generateNonExistingCode();
|
||||||
const game = new Game(this.io, this, code);
|
const game = new Game(this.io, this, code);
|
||||||
|
|
||||||
this.games.set(code, game);
|
this.games.set(code, game);
|
||||||
|
|
||||||
oldLobbySave.gameCode = code;
|
oldLobbySave.gameCode = code;
|
||||||
|
|||||||
Reference in New Issue
Block a user