summaryrefslogtreecommitdiff
path: root/scripts/client.js
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-08-11 20:36:18 -0400
committerKyle Gunger <kgunger12@gmail.com>2022-08-11 20:36:18 -0400
commit6287b2a6afadce021700d6843012b9b9e7ac4954 (patch)
tree0394f95c4327d4242330c8deeac5282629339add /scripts/client.js
parent5cba3d84eae256cdb4fd79d6e2bed83e21f7a646 (diff)
Change to lobby instead of menu for rpc
Diffstat (limited to 'scripts/client.js')
-rw-r--r--scripts/client.js7
1 files changed, 3 insertions, 4 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;