diff options
author | Rafael Ortiz <rafael@activitycentral.com> | 2012-12-19 15:56:18 (GMT) |
---|---|---|
committer | Rafael Ortiz <rafael@activitycentral.com> | 2012-12-19 15:56:18 (GMT) |
commit | 6416ee266f4591c28f34a889e262d0aa5e60fdaf (patch) | |
tree | f93b59af3daa5678b1545e3246b55f3dca03b222 | |
parent | eb8602a2ca6a2558bdf47b0a5f7944a3ba9d9086 (diff) |
matching game.py mainline
-rw-r--r-- | game.py | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -61,7 +61,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 = {} @@ -74,7 +74,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 @@ -113,6 +113,15 @@ class MemorizeGame(GObject): self.change_turn() self.model.data['running'] = 'False' + # Card 'state' is an awesome 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) @@ -370,7 +379,7 @@ class MemorizeGame(GObject): self.model.count = 0 self.model.def_grid(size) self.load_remote(self.model.grid, self.model.data, - self.model.data['mode'],False) + self.model.data['mode'], False) def set_load_mode(self, msg): self.emit('load_mode', msg) |