diff options
Diffstat (limited to 'draughts/public/javascripts/game.js')
-rw-r--r-- | draughts/public/javascripts/game.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/draughts/public/javascripts/game.js b/draughts/public/javascripts/game.js index a60401e..6fe82dd 100644 --- a/draughts/public/javascripts/game.js +++ b/draughts/public/javascripts/game.js @@ -113,14 +113,17 @@ ws.addEventListener("message", ({ data }) => { data = JSON.parse(data) switch (data.head) { case Messages.WELCOME: - colorPrefix = data.body setupPieceEventListeners() + if ((colorPrefix = data.body) == Color.BLUE) + alert("You are the blue player! Currently waiting for the opponent to join...") + else + alert("You are the red player!") break case Messages.RESIGN: - console.log("The opponent has resigned, you win!") + alert("The opponent has resigned, you win!") break case Messages.DISCONNECT: - console.log("The opponent has disconnected, you win!") + alert("The opponent has disconnected, you win!") break case Messages.COMMENCE: ourTurn = true |