Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2012-05-11 13:17:06 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-05-11 13:17:06 (GMT)
commit4c1f1a06277caee26a91ae4373871af95aa3358f (patch)
tree359782fee83a484d4556631108ebaaff45d1726b
parentdc965f1ed0fb0d059c53e53f670891495005f37d (diff)
send correct, level, game when sharing
-rw-r--r--RecallActivity.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/RecallActivity.py b/RecallActivity.py
index 9b1e843..0fcdbd2 100644
--- a/RecallActivity.py
+++ b/RecallActivity.py
@@ -133,12 +133,15 @@ class RecallActivity(activity.Activity):
def write_file(self, file_path):
""" Write the grid status to the Journal """
- dot_list = self._game.save_game()
+ dot_list, correct, level, game = self._game.save_game()
self.metadata['dotlist'] = ''
for dot in dot_list:
self.metadata['dotlist'] += str(dot)
if dot_list.index(dot) < len(dot_list) - 1:
self.metadata['dotlist'] += ' '
+ self.metadata['correct'] = str(correct)
+ self.metadata['level'] = str(level)
+ self.metadata['game'] = str(game)
def _restore(self):
""" Restore the game state from metadata """
@@ -146,7 +149,19 @@ class RecallActivity(activity.Activity):
dots = self.metadata['dotlist'].split()
for dot in dots:
dot_list.append(int(dot))
- self._game.restore_game(dot_list)
+ if 'correct' in self.metadata:
+ correct = int(self.metadata['correct'])
+ else:
+ correct = 0
+ if 'level' in self.metadata:
+ level = int(self.metadata['level'])
+ else:
+ level = 0
+ if 'game' in self.metadata:
+ game = int(self.metadata['game'])
+ else:
+ game = 0
+ self._game.restore_game(dot_list, correct, level, game)
# Collaboration-related methods
@@ -247,8 +262,8 @@ params=%r state=%d' % (id, initiator, type, service, params, state))
def _receive_new_game(self, payload):
''' Sharer can start a new game. '''
- dot_list = json_load(payload)
- self._game.restore_game(dot_list)
+ dot_list, correct, level, game = json_load(payload)
+ self._game.restore_game(dot_list, correct, level, game)
def send_dot_click(self, dot, color):
''' Send a dot click to all the players '''