diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-06-04 23:22:05 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-06-04 23:22:05 +0100 |
commit | 0c961c2a1252d0ee9d656516761b350f977d263d (patch) | |
tree | feb304dcb1c1bf65930327ee36e4dcedc2363b0f /CAO_Game.py | |
parent | 1cf99f4b45ae926052af21a7fe9c47bccfda5c91 (diff) |
transmit a new card to the player using a notification
when it's time for another turn, we send a notification to the user plus
its new card so he does not need to execute a query again.
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'CAO_Game.py')
-rw-r--r-- | CAO_Game.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/CAO_Game.py b/CAO_Game.py index a77b376..27a5567 100644 --- a/CAO_Game.py +++ b/CAO_Game.py @@ -140,7 +140,17 @@ class CAO_Game(): # reset the state of the players for p in self.players: if p.get_has_played: - p.receive_card(self.board.pick_white_card()) + idx = p.receive_card(self.board.pick_white_card()) + card_idx = p.cards[idx] + card_desc = self.white_desc[card_idx] + + p.send_notification({ + 'op': 'received_card', + 'card': { + 'id': idx, + 'desc': card_desc, + }, + }) p.set_has_played(False) self.board.recycle_black_card() |