From 6287b2a6afadce021700d6843012b9b9e7ac4954 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Thu, 11 Aug 2022 20:36:18 -0400 Subject: Change to lobby instead of menu for rpc --- scripts/client.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'scripts/client.js') 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; -- cgit v1.2.3