From 4ed01e103519de70376a8b5e46422b5e1e2618f5 Mon Sep 17 00:00:00 2001 From: exane Date: Sat, 4 Jul 2015 18:30:08 +0200 Subject: [PATCH] some modal and notification changes --- client/scss/_backbone.modal.theme.sass | 4 ---- client/scss/_base.scss | 7 ++++++- server/Battle.js | 10 +++++++++- server/Battleside.js | 17 +++++++++++------ 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/client/scss/_backbone.modal.theme.sass b/client/scss/_backbone.modal.theme.sass index a8df351..881c5fe 100644 --- a/client/scss/_backbone.modal.theme.sass +++ b/client/scss/_backbone.modal.theme.sass @@ -1,10 +1,6 @@ -.bbm-wrapper - background: rgba(0,0,0,.75) - -webkit-transition: background-color .3s .bbm-modal background: white - box-shadow: 0 0px 6px rgba(0,0,0,.6), 0 1px 2px rgba(0,0,0,.9) /* BLOCKS */ diff --git a/client/scss/_base.scss b/client/scss/_base.scss index a8fb563..4cca4e9 100644 --- a/client/scss/_base.scss +++ b/client/scss/_base.scss @@ -48,7 +48,7 @@ body { } .bbm-wrapper { - background: rgba(6, 13, 22, 0.9); + //background: rgba(6, 13, 22, 0.9); padding: 7% 0 0 0; } @@ -58,6 +58,7 @@ body { max-width: 100%; border-radius: 0; margin: auto; + background: rgba(6, 13, 22, 0.9); } .btn-sub { @@ -79,6 +80,10 @@ body { transform: translate(-50%, 0px); left: 50%; width: 500px; + background: rgba(6, 13, 22, 0.9); + //padding: 15px; + padding: 50px 0; + margin-top: -30px; } .card { diff --git a/server/Battle.js b/server/Battle.js index 0e960d7..5c824e5 100644 --- a/server/Battle.js +++ b/server/Battle.js @@ -111,7 +111,9 @@ var Battle = (function(){ Promise.when(this.p1.reDraw(2), this.p2.reDraw(2)) .then(function(){ this.on("NextTurn", this.switchTurn); - this.switchTurn(Math.random() > 0.5 ? this.p1 : this.p2); + var side = Math.random() > 0.5 ? this.p1 : this.p2; + this.sendNotification(side.getName() + " begins!"); + this.switchTurn(side); }.bind(this)); } @@ -377,6 +379,12 @@ var Battle = (function(){ }) } + r.sendNotificationTo = function(side, msg) { + side.send("notification", { + message: msg + }, true) + } + return Battle; })(); diff --git a/server/Battleside.js b/server/Battleside.js index 5dbd6f6..47c094c 100644 --- a/server/Battleside.js +++ b/server/Battleside.js @@ -857,32 +857,37 @@ Battleside = (function(){ if(!left) return; left--; var card = self.hand.remove(id)[0]; - //console.log("hand -> deck: ", card.getName()); + self.deck.add(card); self.deck.shuffle(); self.draw(1); + if(!left){ self.send("redraw:close", null, true); - //console.log("redraw finished"); + self.wait(); deferred.resolve("done"); - //self.socket.off("redraw:reDrawCard", h1); + self.sendNotificationTo(self.foe, self.getName() + " finished redraw phase.") + } - /*self.update(self);*/ + self.battle.updateSelf(self); }) this.receive("redraw:close_client", function(){ - //console.log("redraw finished!"); + self.wait(); deferred.resolve("done"); - //self.socket.off("redraw:close_client", h2); + self.sendNotificationTo(self.foe, self.getName() + " finished redraw phase.") }) return deferred; } + r.sendNotificationTo = function(side, msg){ + this.battle.sendNotificationTo(side, msg); + } r.sendNotification = function(msg){ this.battle.sendNotification(msg); }