summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-07-31 19:51:07 -0400
committerKyle Gunger <kgunger12@gmail.com>2022-07-31 19:51:07 -0400
commit5b4e72d70522eb61fd8cf2bbd619bb7ed4da2cfb (patch)
tree336fbb6bc81f78e6b469f97730ee39518feafb99
parentaecd8926c6c7bd7bcc0751e38b4459b57a87821c (diff)
Add table toggle
-rw-r--r--client.html2
-rw-r--r--scripts/client.js6
-rw-r--r--scripts/gui/table.js13
-rw-r--r--styles/client/base.css15
4 files changed, 33 insertions, 3 deletions
diff --git a/client.html b/client.html
index 9b92a09..26f3c18 100644
--- a/client.html
+++ b/client.html
@@ -120,6 +120,8 @@
<button>Send</button>
</div>
</div>
+
+ <button class="toggle-table" onclick="game.table.toggleTable()"></button>
</body>
</html> \ No newline at end of file
diff --git a/scripts/client.js b/scripts/client.js
index bceb7a4..92f518c 100644
--- a/scripts/client.js
+++ b/scripts/client.js
@@ -163,7 +163,11 @@ class Client{
{
let m = e.detail;
- if (TABLE_RPC.includes(m.type))
+ if(m.type == "nojoin") {
+ alert(`Failed to join game. ${m.data}`);
+ } else if (m.type == "join") {
+ console.log("join not impl")
+ } else if (TABLE_RPC.includes(m.type))
this.table[m.type](m.data);
}
diff --git a/scripts/gui/table.js b/scripts/gui/table.js
index 87120e3..f17abb1 100644
--- a/scripts/gui/table.js
+++ b/scripts/gui/table.js
@@ -23,7 +23,7 @@ class Table{
openTable ()
{
let state = this.root.getAttribute("state")
- if((state == "close" || state == "closed") && state != "") {
+ if(state == "close" || state == "closed") {
this.root.setAttribute("state", "closed");
setTimeout(this.root.setAttribute.bind(this.root), 50, "state", "open");
}
@@ -33,12 +33,21 @@ class Table{
closeTable ()
{
let state = this.root.getAttribute("state")
- if(state != "close" && state != "closed") {
+ if((state != "close" && state != "closed") && state != "") {
this.root.setAttribute("state", "");
setTimeout(this.root.setAttribute.bind(this.root), 50, "state", "close");
}
}
+ toggleTable ()
+ {
+ let state = this.root.getAttribute("state")
+ if(state == "close" || state == "closed")
+ this.openTable();
+ else if (state == "open")
+ this.closeTable()
+ }
+
// Handle a game closing (expectedly or unexpectedly)
handleClose ()
{
diff --git a/styles/client/base.css b/styles/client/base.css
index 0ecba9b..51ac5fd 100644
--- a/styles/client/base.css
+++ b/styles/client/base.css
@@ -194,6 +194,21 @@ div.settings {
opacity: 0;
}
+button.toggle-table {
+ position: absolute;
+ bottom: 5px;
+ left: 5px;
+ transform-origin: bottom left;
+ z-index: 4;
+}
+
+button.toggle-table::before {
+ font-family: "IcoFont";
+ font-size: xx-large;
+
+ content: '\edb9';
+}
+
@keyframes slide-in {
from {
transform: translate(0, -100vh);