diff frontends/quick_frontend/quick_app.py @ 99:63c9067a1499

Tarot game: invalid cards management - tarot plugin: card validity check, new signal tarotGameInvalidCards - wix: when an invalid cards signal is received, the cards are back in the hand, and the state change so the player as to play again.
author Goffi <goffi@goffi.org>
date Fri, 18 Jun 2010 15:19:32 +0800
parents be206a3d1a9b
children 94011f553cd0
line wrap: on
line diff
--- a/frontends/quick_frontend/quick_app.py	Thu Jun 03 17:43:49 2010 +0930
+++ b/frontends/quick_frontend/quick_app.py	Fri Jun 18 15:19:32 2010 +0800
@@ -55,6 +55,7 @@
         self.bridge.register("tarotGameYourTurn", self.tarotMyTurn)
         self.bridge.register("tarotGameScore", self.tarotScore)
         self.bridge.register("tarotGameCardsPlayed", self.tarotCardsPlayed)
+        self.bridge.register("tarotGameInvalidCards", self.tarotInvalidCards)
         self.bridge.register("subscribe", self.subscribe)
         self.bridge.register("paramUpdate", self.paramUpdate)
         self.bridge.register("contactDeleted", self.contactDeleted)
@@ -324,6 +325,13 @@
         if self.chat_wins.has_key(room_jid):
             self.chat_wins[room_jid].getGame("Tarot").cardsPlayed(player, cards)
    
+    def tarotInvalidCards(self, room_jid, phase, played_cards, invalid_cards, profile):
+        if not self.__check_profile(profile):
+            return
+        debug (_("Cards played are not valid: %s") % invalid_cards)
+        if self.chat_wins.has_key(room_jid):
+            self.chat_wins[room_jid].getGame("Tarot").invalidCards(phase, played_cards, invalid_cards)
+   
     def subscribe(self, type, raw_jid, profile):
         """Called when a subsciption management signal is received"""
         if not self.__check_profile(profile):