summaryrefslogtreecommitdiff
path: root/CAO_Client.py
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-06-14 22:31:48 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-06-14 22:37:40 +0100
commit0fb08748e5285e5d4adc6135eec8889887a63299 (patch)
tree3a82c2899f33a8d4234b07799cff00865c8e141c /CAO_Client.py
parentad12c67adcc8e3c0f29814b1b95959ac4b9f4a4d (diff)
use a python package instead of just modules
The package is contained in the CAO/ folder. server.py is still at the root of the repository though. Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'CAO_Client.py')
-rw-r--r--CAO_Client.py73
1 files changed, 0 insertions, 73 deletions
diff --git a/CAO_Client.py b/CAO_Client.py
deleted file mode 100644
index c3554ac..0000000
--- a/CAO_Client.py
+++ /dev/null
@@ -1,73 +0,0 @@
-from CAO_Status import cao_error
-from CAO_Game import CAO_Game
-
-class CAO_Client():
- def __init__(self, socket, handler, game_manager):
- self.game = None
- self.game_manager = game_manager
-
- self.handler = handler
- self.socket = socket
- self.player = None
-
- def join_game(self, game_name, lang):
- if self.game is not None:
- return cao_error('You are already in a game')
-
- if lang is None:
- lang = 'en'
-
- game = self.game_manager.join_game(game_name, lang)
- # XXX self.game will be assigned by game.try_join()
-
- if game is None:
- return cao_error('Invalid language')
-
- return game.try_join(self)
-
- def set_game(self, game):
- self.game = game
- def set_player(self, player):
- self.player = player
-
- def play_white_card(self, card_id):
- if self.game is None:
- return cao_error('You have to join a game first')
- return self.game.try_play_card(self.player, card_id)
-
- def pick_black_card(self):
- if self.game is None:
- return cao_error('You have to join a game first')
- return self.game.try_become_judge(self.player)
-
- def collect_cards(self):
- if self.game is None:
- cao_error('You have to join a game first')
- return self.game.try_collect_cards(self.player)
-
- def designate_card(self, card_id):
- if self.game is None:
- return cao_error('You have to join a game first')
- return self.game.try_designate_card(self.player, card_id)
-
- def view_player_cards(self):
- if self.game is None:
- return cao_error('You have to join a game first')
- return self.game.try_view_player_cards(self.player)
-
- def view_played_cards(self):
- if self.game is None:
- return cao_error('You have to join a game first')
- return self.game.try_view_played_cards(self.player)
-
- def view_black_card(self):
- if self.game is None:
- return cao_error('You have to join a game first')
- return self.game.try_view_black_card(self.player)
-
- def send_notification(self, message):
- self.socket.send_message(self.handler, message)
-
- def disconnect(self):
- if self.player is not None:
- self.player.client = None