diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-06-09 03:10:24 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-06-09 03:11:26 +0100 |
commit | 2b378e3eb7e3851f5e69d9705f9318f77481cba9 (patch) | |
tree | db874c17f3016c69a5e0aa50f3b202faf07ea05b /cao-common.js | |
parent | de25bd15fc3a6b197b8005d75e75c5c595fd087e (diff) |
ui: allow to get the played cards from the ifaces
the card descripts and their associated callbacks are saved in the page.
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'cao-common.js')
-rw-r--r-- | cao-common.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cao-common.js b/cao-common.js index e39317f..2742606 100644 --- a/cao-common.js +++ b/cao-common.js @@ -59,11 +59,16 @@ var CAO = function() { return white_cards[idx]['event']; }; + this.get_played_card_event = function(idx) { + return played_cards[idx]['event']; + }; + this.change_state = function(state) { game_state = state; switch (state) { case 'waiting_judge': + played_cards = []; self.reset_nbr_played_cards(); judge = false; @@ -135,7 +140,10 @@ var CAO = function() { for (var i in result) { var desc = result[i]; - played_cards.push(desc); + played_cards.push({ + 'desc': desc, + 'event': self.gen_callback_played_card(i), + }); self.on_show_played_card(i, desc); } }; @@ -144,8 +152,6 @@ var CAO = function() { self.change_state('waiting_judge'); self.on_designate_card_ok(); - - played_cards = []; }; /* }}} */ |