diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2021-10-15 21:01:22 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2021-10-15 21:01:22 -0400 |
commit | 6c4896d3aa9d618f024b54c8d51f25ca3f625744 (patch) | |
tree | a70ceb0b6d477141e7791b21cb6eaa79316529df /scripts/gui/table.js | |
parent | fcf01353f94b11b8ca6db8ead14d2ec89a0275f4 (diff) |
[Themes] Theme selection and small fixes
Diffstat (limited to 'scripts/gui/table.js')
-rw-r--r-- | scripts/gui/table.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/scripts/gui/table.js b/scripts/gui/table.js index 0d21262..9aac2ae 100644 --- a/scripts/gui/table.js +++ b/scripts/gui/table.js @@ -83,7 +83,7 @@ class Table{ return null; } - moveCard(card, newDeck) + moveCard(card, newDeck, index = -1) { for(let d of this.decks) { @@ -91,10 +91,14 @@ class Table{ break; } card.resetPos(); - newDeck.appendCard(card); + + if(index < 0) + newDeck.appendCard(card); + else + newDeck.addCardAt(card, index); } - moveByID(cardID, deckID) + moveByID(cardID, deckID, index = -1) { let card, deck; for(let d of this.decks) @@ -107,12 +111,12 @@ class Table{ deck = d; } - this.moveCard(card, deck); + this.moveCard(card, deck, index); } - checkMove(cardID, deckID) + checkMove(cardID, deckID, index = -1) { - this.socket.send("game", {}); + this.socket.send("game", {type: "move", card: cardID, deck: deckID, pos: index}); } dragCheck(cap) @@ -131,7 +135,7 @@ class Table{ if(c !== null) { if(d !== null) - this.moveCard(c, d); + this.checkMove(c.getID(), d.getID()); else c.resetPos(); } |