From ab88ba8d0e23999f4d55a2721f610eff2b1d2054 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Fri, 28 Feb 2020 02:33:14 -0500 Subject: More comments --- scripts/client.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'scripts/client.js') diff --git a/scripts/client.js b/scripts/client.js index b5dd4bf..ea62e26 100644 --- a/scripts/client.js +++ b/scripts/client.js @@ -13,12 +13,13 @@ function Client(serveraddr, game) { } Client.prototype = { + // Initialize the connection init: function() { this.soc.init(); }, - // Entry point for a message. - // If it's a close message, the + // Entry point for a message from the server. + // If it's a close message, we close the game if it is open and change the lobby to reflect the error/close. cb: function(m) { console.log(m); @@ -42,6 +43,7 @@ Client.prototype = { } }, + // Called when negotiating with the server for the first time and we are determining versions handshake: function(m) { switch (m.type) { case "verr": @@ -57,6 +59,7 @@ Client.prototype = { } }, + // Lobby switch, called when in the lobby and a message arrives from the server lobby: function (m) { switch (m.type) { case "plist": @@ -87,6 +90,7 @@ Client.prototype = { } }, + // Game switch, called when in game and a message arrives from the server game: function (m) { switch (m.type) { -- cgit v1.2.3