summaryrefslogtreecommitdiff
path: root/webcards/scripts/gui/table.js
diff options
context:
space:
mode:
authorKyle Gunger <corechg@gmail.com>2020-09-18 12:22:26 -0400
committerKyle Gunger <corechg@gmail.com>2020-09-18 12:22:26 -0400
commit9681347b8e9f6059c3f5f02528e0893bef5acca4 (patch)
tree16e5dff45804d13abeda17041668eff0485483c7 /webcards/scripts/gui/table.js
parent2ce432034eb35f763182de03fb7b42d2a07afc4b (diff)
Move webcards to seperate repo
Diffstat (limited to 'webcards/scripts/gui/table.js')
-rw-r--r--webcards/scripts/gui/table.js79
1 files changed, 0 insertions, 79 deletions
diff --git a/webcards/scripts/gui/table.js b/webcards/scripts/gui/table.js
deleted file mode 100644
index c4878a0..0000000
--- a/webcards/scripts/gui/table.js
+++ /dev/null
@@ -1,79 +0,0 @@
-// Table represents and manages the actual game. It accepts inputs from the server and tries to query the server when the player makes a move.
-class Table{
- constructor(e, drag, socket) {
- this.root = e;
- this.drag = drag;
-
- this.root.addEventListener("mouseup", drag.stopDraggingAll.bind(drag));
-
- //drag.addEventListener("dragstop", );
-
- this.socket = socket;
-
- this.decks = [];
- }
-
- openTable ()
- {
- let state = this.root.getAttribute("state")
- if((state == "close" || state == "closed") && state != "") {
- this.root.setAttribute("state", "closed");
- setTimeout(this.root.setAttribute.bind(this.root), 50, "state", "open");
- }
- }
-
- closeTable ()
- {
- let state = this.root.getAttribute("state")
- if(state != "close" && state != "closed") {
- this.root.setAttribute("state", "");
- setTimeout(this.root.setAttribute.bind(this.root), 50, "state", "close");
- }
- }
-
- handleClose ()
- {
- this.reset();
- }
-
- reset ()
- {
- while(this.root.firstElementChild != null)
- this.root.firstElementChild.remove();
-
- this.decks = [];
-
- this.closeTable();
- this.drag.stopDraggingAll();
- }
-
- /* Deck and card functions */
- newDeck(options)
- {
- var d = new Deck(options);
- this.decks.push(d);
- this.root.appendChild(d.e);
- }
-
- newCard(data, deck = 0)
- {
- var c = new Card(data);
- this.decks[deck].appendCard(c);
- this.drag.addTarget(c.e);
- }
-
- checkDeck(x, y)
- {
- for(let d of this.decks)
- {
- if(d.isInside(x, y))
- return true;
- }
- return false;
- }
-
- dragCheck(cap)
- {
- console.log(cap);
- }
-}