diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-06-04 05:54:16 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-06-04 05:54:16 +0100 |
commit | 0cae8115a93589e37943590db45967beec841a07 (patch) | |
tree | ad5bbecff01e42362d3670b90000fa77e9d38cc9 /CAO_Game.py | |
parent | 7d191b337b3114ceaa2ea69b538d3cd4f83bc094 (diff) |
added a system of notification
what the client will receive will look like:
{'type': TYPE, 'content': CONTENT}
TYPE will be either 'notification' or 'response'
CONTENT will be the content of the notification or the response
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'CAO_Game.py')
-rw-r--r-- | CAO_Game.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/CAO_Game.py b/CAO_Game.py index 7275f56..470eb71 100644 --- a/CAO_Game.py +++ b/CAO_Game.py @@ -48,6 +48,10 @@ class CAO_Game(): self.players.append(player) + for p in self.players: + if p is not player: + p.send_notification('somebody has joined the game') + return self.try_view_player_cards(player) @@ -61,6 +65,10 @@ class CAO_Game(): self.state = self.WAITING_COLLECTION + for p in self.players: + if p is not player: + p.send_notification('a judge has been designed') + return self.try_view_black_card(player) @@ -82,6 +90,8 @@ class CAO_Game(): self.board.play_card(player, card) + self.judge.send_notification('somebody played a card') + return cao_success({'card_id': card_id}) @@ -97,6 +107,10 @@ class CAO_Game(): # we prevent the others to play self.state = self.WAITING_DESIGNATION + for p in self.players: + if p is not player: + p.send_notification('somebody collected the cards') + return self.try_view_played_cards(player) @@ -132,6 +146,10 @@ class CAO_Game(): self.board.recycle_black_card() self.judge = None # useful or not ... + for p in self.players: + if p is not player: + p.send_notification('we need a new judge') + self.state = self.WAITING_NEW_JUDGE return cao_success(None) |