summaryrefslogtreecommitdiff
path: root/scripts/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gui')
-rw-r--r--scripts/gui/chat.js17
-rw-r--r--scripts/gui/table.js34
2 files changed, 46 insertions, 5 deletions
diff --git a/scripts/gui/chat.js b/scripts/gui/chat.js
index 68b8f5d..fa4b88d 100644
--- a/scripts/gui/chat.js
+++ b/scripts/gui/chat.js
@@ -101,11 +101,20 @@ class Chat {
let autoscroll = c.e.scrollTop == c.e.scrollTopMax;
- let csp = document.createElement("span");
- csp.style.color = msg.color;
- csp.innerText = msg.user + ": ";
+ let csp = document.createElement("span")
let tsp = document.createElement("span");
- tsp.innerText = msg.text;
+
+ if(msg.server === true){
+ csp.style.color = "white";
+ csp.style.backgroundColor = "black";
+ csp.innerText = "[SERVER]";
+ tsp.innerText = " " + msg.text;
+ } else {
+ csp.style.color = msg.color;
+ csp.innerText = msg.user + ": ";
+ tsp.innerText = msg.text;
+ }
+
let d = document.createElement("div");
d.appendChild(csp);
d.appendChild(tsp);
diff --git a/scripts/gui/table.js b/scripts/gui/table.js
index 8fc1ea0..0d21262 100644
--- a/scripts/gui/table.js
+++ b/scripts/gui/table.js
@@ -83,6 +83,38 @@ class Table{
return null;
}
+ moveCard(card, newDeck)
+ {
+ for(let d of this.decks)
+ {
+ if (d.removeCardByID(card.getID()) !== null)
+ break;
+ }
+ card.resetPos();
+ newDeck.appendCard(card);
+ }
+
+ moveByID(cardID, deckID)
+ {
+ let card, deck;
+ for(let d of this.decks)
+ {
+ let c = d.hasCard(cardID)
+ if(c !== null)
+ card = c;
+
+ if(d.getID() == deckID)
+ deck = d;
+ }
+
+ this.moveCard(card, deck);
+ }
+
+ checkMove(cardID, deckID)
+ {
+ this.socket.send("game", {});
+ }
+
dragCheck(cap)
{
console.log(cap);
@@ -99,7 +131,7 @@ class Table{
if(c !== null)
{
if(d !== null)
- console.log({card: c.getID(), deck: d.getID()});
+ this.moveCard(c, d);
else
c.resetPos();
}