diff options
author | Ariel Calzada <ariel@acivitycentral.com> | 2013-01-10 14:29:43 (GMT) |
---|---|---|
committer | Ariel Calzada <ariel@acivitycentral.com> | 2013-01-10 14:29:43 (GMT) |
commit | de93f6def28f0107f4e1ba2999f23edcb65537e0 (patch) | |
tree | 82788a4431b1870c80bf99ed0b3eaf4489141595 /game.py | |
parent | 15218740927681efd27b52e576a35d2b45973cde (diff) |
when closing the game. The game resumes from that image next time
onwards.
Tests conducted ::
a)
(i)
User exits, without finishing the current game.
(ii)
When she next starts, she will proceed from the same game, from the same stage.
b)
(i)
User exits, without finishing the current game.
(ii)
She then transfers the journal-entry to another XO.
(iii)
Tries to resume the game, from the (transferred) journal entry.
(iv)
Game resumes, from the same stage.
Diffstat (limited to 'game.py')
-rw-r--r-- | game.py | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -57,7 +57,7 @@ class MemorizeGame(GObject): 'change-turn': (SIGNAL_RUN_FIRST, None, [TYPE_PYOBJECT]), } - def __init__(self): + def __init__(self, activity_instance): gobject.GObject.__init__(self) self.myself = None self.players_score = {} @@ -70,7 +70,7 @@ class MemorizeGame(GObject): self.messenger = None self.sentitive = True - self.model = Model() + self.model = Model(activity_instance=activity_instance) self.flip_block = False self._flop_cards = None @@ -109,6 +109,16 @@ class MemorizeGame(GObject): self.change_turn() self.model.data['running'] = 'False' + # Card 'state' is an aawesome field. + # Its takes on the following values :: + # + # 0 ==> for flopped cards. + # + # 1 ==> for flipped unmatched cards + # (can be a maximum of 1 such card). + # + # <stroke_color>, <fill_color> ==> for flipped matched cards + for card in self.model.grid: if card['state'] == '1': self.emit('flip-card', self.model.grid.index(card), False) |