summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-06-08 22:23:49 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-06-08 22:23:49 +0100
commitb59ef579155f41e5a1f6b8869749eff403b1fcac (patch)
tree01d77c82fe97f6ec239962849f86788c5c1df5a1
parenteb9edafa80a60bfc642011de38fd28f0d9dc9274 (diff)
handle the notification for score update
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
-rw-r--r--cao-common.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/cao-common.js b/cao-common.js
index c911b31..f844762 100644
--- a/cao-common.js
+++ b/cao-common.js
@@ -17,6 +17,7 @@ var CAO = function() {
this.on_player_joined_game = function() { /* to override */ };
this.on_card_played = function() { /* to override */ };
this.on_cards_collected = function() { /* to override */ };
+ this.on_updated_score = function(new_score) { };
var request_queue = [];
@@ -27,6 +28,8 @@ var CAO = function() {
var white_cards = {};
var black_card;
+ var score = 0;
+
var map_handle_response_ok = {};
var map_handle_notif = {};
@@ -124,6 +127,12 @@ var CAO = function() {
self.on_cards_collected();
};
+ map_handle_notif['updated_score'] = function(result) {
+ self.score = result;
+
+ self.on_updated_score(self.score);
+ };
+
/* }}} */
this.run = function() {