diff frontends/quick_frontend/quick_app.py @ 87:66d784082930

Tarot game - Tarot plugin: game session start, first draft - wix: Tarot: names of players are now printed - wix: Tarot: game session start first draft - wix : Tarot: card can be compared and sorted
author Goffi <goffi@goffi.org>
date Tue, 11 May 2010 23:58:32 +0930
parents 4b5f2d55b6ac
children 23caf1051099
line wrap: on
line diff
--- a/frontends/quick_frontend/quick_app.py	Tue May 11 13:06:05 2010 +0930
+++ b/frontends/quick_frontend/quick_app.py	Tue May 11 23:58:32 2010 +0930
@@ -47,6 +47,7 @@
         self.bridge.register("roomUserLeft", self.roomUserLeft)
         self.bridge.register("roomNewSubject", self.roomNewSubject)
         self.bridge.register("tarotGameStarted", self.tarotGameStarted)
+        self.bridge.register("tarotGameNew", self.tarotGameNew)
         self.bridge.register("subscribe", self.subscribe)
         self.bridge.register("paramUpdate", self.paramUpdate)
         self.bridge.register("contactDeleted", self.contactDeleted)
@@ -250,15 +251,23 @@
     def tarotGameStarted(self, room_jid, players, profile):
         if not self.__check_profile(profile):
             return
-        print "Tarot Game Started \o/"
+        debug  (_("Tarot Game Started \o/"))
         if self.chat_wins.has_key(room_jid):
-            self.chat_wins[room_jid].startGame("Tarot")
-            debug (_("new Tarot game started in room [%(room_jid)s]") % {'room_jid':room_jid})
+            self.chat_wins[room_jid].startGame("Tarot", players)
+            debug (_("new Tarot game started in room [%(room_jid)s] with %(players)s") % {'room_jid':room_jid, 'players':[str(player) for player in players]})
+       
+    def tarotGameNew(self, room_jid, hand, profile):
+        if not self.__check_profile(profile):
+            return
+        debug (_("New Tarot Game"))
+        print "hand:", hand
+        if self.chat_wins.has_key(room_jid):
+            self.chat_wins[room_jid].getGame("Tarot").newGame(hand)
 
-        
+
 
     def subscribe(self, type, raw_jid, profile):
-        """Called when a subsciption maangement signal is received"""
+        """Called when a subsciption management signal is received"""
         if not self.__check_profile(profile):
             return
         entity = JID(raw_jid)