Lobby Start Mechanik und abfangen aller Möglichen Fehler

This commit is contained in:
2025-03-25 12:01:11 +01:00
parent d299a90067
commit 2e15735b2d
7 changed files with 84 additions and 8 deletions

View File

@@ -1,8 +1,18 @@
const LobbyManager = require("../LobbyManager");
class TemporaryLobby{
/** @param { string } code @param {Array<SocketUser>} users */
constructor(code, users){
/** @param { string } code @param {Array<SocketUser>} users @param {LobbyManager} lobbyManager*/
constructor(code, users, lobbyManager){
this.code = code;
this.users = users;
this.lobbyManager = lobbyManager;
setTimeout(this.selfDestroy.bind(this), 5000);
}
selfDestroy(){
const i = this.lobbyManager.oldLobbys.findIndex(x => x.code == this.code);
this.lobbyManager.oldLobbys.splice(i, 1);
}
}