summaryrefslogtreecommitdiff
path: root/scripts/client.js
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2021-02-15 14:55:16 -0500
committerKyle Gunger <kgunger12@gmail.com>2021-02-15 14:55:16 -0500
commitfcf01353f94b11b8ca6db8ead14d2ec89a0275f4 (patch)
tree89b01bd941854f83477ba6cb3b7e283f95bf710a /scripts/client.js
parent8798a7f1fbdbf13ca31d21c0242fbfa26bf36b6a (diff)
Get on track for moving cards around
Diffstat (limited to 'scripts/client.js')
-rw-r--r--scripts/client.js31
1 files changed, 28 insertions, 3 deletions
diff --git a/scripts/client.js b/scripts/client.js
index 904e299..7f98c7b 100644
--- a/scripts/client.js
+++ b/scripts/client.js
@@ -1,7 +1,7 @@
'use strict';
const VERSION = "1.0.0";
-const DefaultSettings = {
+const DefaultUserOps = {
a: {
type: "color",
title: "Player Color",
@@ -24,6 +24,24 @@ const DefaultSettings = {
}
}
+const DefaultGameOps = {
+ a: {
+ type: "checkbox",
+ title: "Unlisted",
+ args: []
+ },
+ b: {
+ type: "checkbox",
+ title: "Use Password",
+ args: []
+ },
+ c: {
+ type: "text",
+ title: "Set Password",
+ args: [Math.floor(Math.random() * 10000), ""]
+ }
+}
+
// Client acts as the message hub for the whole game.
// WebSocket messages come into Client and Client redirects them to the lobby or table based on the state of the game.
// Client also performs the handshake for first starting the connection and messages everyone if the connection errors or closes.
@@ -48,9 +66,12 @@ class Client{
this.chat.addChannel("global");
this.chat.switchChannel("global");
- this.settings = new Settings(DefaultSettings);
+ this.settings = new Settings(DefaultUserOps);
this.settings.putSettings(this.lobby.e.settings);
+ this.gameOptions = new Settings(DefaultGameOps);
+ this.gameOptions.putSettings(this.lobby.top.newGame);
+
this.game = game;
}
@@ -89,8 +110,12 @@ class Client{
case "ready":
this.settings.cleanup();
+ this.gameOptions.cleanup();
- this.settings = new Settings(m.data);
+ this.settings = new Settings(m.data.user);
+ this.gameOptions = new Settings(m.data.game);
+
+ this.gameOptions.putSettings(this.lobby.top.newGame);
if(this.lobby.top.mobileSettingsOpen())
this.settings.putSettings(this.lobby.top.mobileSettings);