diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/client.js | 7 | ||||
-rw-r--r-- | scripts/gui/lobby.js | 3 | ||||
-rw-r--r-- | scripts/socket/sock.js | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/scripts/client.js b/scripts/client.js index 815d4f2..d895bbd 100644 --- a/scripts/client.js +++ b/scripts/client.js @@ -50,7 +50,7 @@ class Client{ this.socket.addEventListener("error", this.socketError.bind(this)); this.socket.addEventListener("closed", this.socketClose.bind(this)); this.socket.addEventListener("handshake", this.handshake.bind(this)); - this.socket.addEventListener("menu", this.menuMsg.bind(this)); + this.socket.addEventListener("lobby", this.lobbyMsg.bind(this)); this.socket.addEventListener("game", this.gameMsg.bind(this)); this.socket.addEventListener("chat", this.chatMsg.bind(this)); this.socket.addEventListener("ping", this.pingMsg.bind(this)); @@ -158,7 +158,7 @@ class Client{ } // Menu switch, called when in the lobby and a message arrives from the server - menuMsg (e) + lobbyMsg (e) { let m = e.detail; @@ -176,8 +176,6 @@ class Client{ alert(`Failed to join game. ${m.data}`); break; case "leave": - this.table.reset(); - if (this.game.id !== m.data) { this.lobby.setState("Joining...", "loading", this.socket.server); this.socket.send("join", this.game); @@ -188,6 +186,7 @@ class Client{ this.inGame = false; break; case "join": + this.table.reset(); this.table.openTable(); this.lobby.setState("In Game", "ok", this.socket.server); this.inGame = true; diff --git a/scripts/gui/lobby.js b/scripts/gui/lobby.js index a303da8..64af615 100644 --- a/scripts/gui/lobby.js +++ b/scripts/gui/lobby.js @@ -155,8 +155,9 @@ class Lobby { // { data.games[n].max } max players in room gameList (data) { while (this.e.games.firstChild != null) { - this.e.games.remove(this.elements.games.firstChild) + this.e.games.removeChild(this.e.games.firstChild) } + console.log("eheh") for (let i of data.games) { if(typeof i != "object") diff --git a/scripts/socket/sock.js b/scripts/socket/sock.js index 73e20ee..b1a4280 100644 --- a/scripts/socket/sock.js +++ b/scripts/socket/sock.js @@ -1,6 +1,6 @@ 'use strict'; -const VALID_EVENTS = ["error", "closed", "handshake", "menu", "game", "chat", "ping"]; +const VALID_EVENTS = ["error", "closed", "handshake", "lobby", "game", "chat", "ping"]; // A wrapper around the wrapper class SockWorker extends EventTarget{ |