1
0
mirror of https://github.com/exane/not-gwent-online synced 2025-12-15 02:29:14 +00:00

some modal and notification changes

This commit is contained in:
exane
2015-07-04 18:30:08 +02:00
parent 0b76e18554
commit 4ed01e1035
4 changed files with 26 additions and 12 deletions

View File

@@ -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;
})();

View File

@@ -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);
}