diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-06-05 02:13:25 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-06-05 02:14:56 +0100 |
commit | 76431d4ff189b8531f7bc89dc80e9fa4b8e79bbd (patch) | |
tree | 00c687316e42d644fa58b9e5fcf9ea31eb17906a /cao-common.js | |
parent | a6a207603c0e1872f424e349cf38533f728b35c9 (diff) |
provide the state of the game to a newcomer
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'cao-common.js')
-rw-r--r-- | cao-common.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cao-common.js b/cao-common.js index cd6ec08..e46f39b 100644 --- a/cao-common.js +++ b/cao-common.js @@ -3,7 +3,7 @@ var CAO = function() { this.on_socket_close = function() { /* to override */ }; this.on_socket_error = function(evt) { /* to override */}; - this.on_join_game_ok = function() { /* to override */ }; + this.on_join_game_ok = function(state) { /* to override */ }; this.on_show_white_card = function(idx, desc) { /* to override */ }; this.on_pick_black_card_ok = function() { /* to override */ }; this.on_show_black_card = function(desc) { /* to override */ }; @@ -33,14 +33,14 @@ var CAO = function() { /* map_handle_response_ok {{{ */ map_handle_response_ok['join_game'] = function(result) { - self.on_join_game_ok(); + self.on_join_game_ok(result['state']); map_handle_response_ok['view_player_cards'](result); }; map_handle_response_ok['view_player_cards'] = function(result) { - for (var i in result) { - var idx = result[i][0]; - var desc = result[i][1]; + for (var i in result['cards']) { + var idx = result['cards'][i][0]; + var desc = result['cards'][i][1]; white_cards[idx] = desc; |