Mercurial > libervia-backend
comparison frontends/quick_frontend/quick_app.py @ 95:be206a3d1a9b
Tarot game: score calculation
- plugin tarot: score validity is now checked (some of attackers and defender must equal 91)
- plugin tarot: new signal tarotGameScore to give the scores and winners/loosers
- wix: score are now displayed at the end of the game
- xml_tools: 'fixed' type is now managed in dataForm2xml
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 02 Jun 2010 15:57:23 +0930 |
parents | 2f87651a5ad8 |
children | 63c9067a1499 |
comparison
equal
deleted
inserted
replaced
94:1eb5ccead43c | 95:be206a3d1a9b |
---|---|
51 self.bridge.register("tarotGameStarted", self.tarotGameStarted) | 51 self.bridge.register("tarotGameStarted", self.tarotGameStarted) |
52 self.bridge.register("tarotGameNew", self.tarotGameNew) | 52 self.bridge.register("tarotGameNew", self.tarotGameNew) |
53 self.bridge.register("tarotGameChooseContrat", self.tarotChooseContrat) | 53 self.bridge.register("tarotGameChooseContrat", self.tarotChooseContrat) |
54 self.bridge.register("tarotGameShowCards", self.tarotShowCards) | 54 self.bridge.register("tarotGameShowCards", self.tarotShowCards) |
55 self.bridge.register("tarotGameYourTurn", self.tarotMyTurn) | 55 self.bridge.register("tarotGameYourTurn", self.tarotMyTurn) |
56 self.bridge.register("tarotGameScore", self.tarotScore) | |
56 self.bridge.register("tarotGameCardsPlayed", self.tarotCardsPlayed) | 57 self.bridge.register("tarotGameCardsPlayed", self.tarotCardsPlayed) |
57 self.bridge.register("subscribe", self.subscribe) | 58 self.bridge.register("subscribe", self.subscribe) |
58 self.bridge.register("paramUpdate", self.paramUpdate) | 59 self.bridge.register("paramUpdate", self.paramUpdate) |
59 self.bridge.register("contactDeleted", self.contactDeleted) | 60 self.bridge.register("contactDeleted", self.contactDeleted) |
60 self.bridge.register("updatedValue", self.updatedValue, "request") | 61 self.bridge.register("updatedValue", self.updatedValue, "request") |
306 return | 307 return |
307 debug (_("My turn to play")) | 308 debug (_("My turn to play")) |
308 if self.chat_wins.has_key(room_jid): | 309 if self.chat_wins.has_key(room_jid): |
309 self.chat_wins[room_jid].getGame("Tarot").MyTurn() | 310 self.chat_wins[room_jid].getGame("Tarot").MyTurn() |
310 | 311 |
312 def tarotScore(self, room_jid, xml_data, winners, loosers, profile): | |
313 """Called when the game is finished and the score are updated""" | |
314 if not self.__check_profile(profile): | |
315 return | |
316 debug (_("Tarot: score received")) | |
317 if self.chat_wins.has_key(room_jid): | |
318 self.chat_wins[room_jid].getGame("Tarot").showScores(xml_data, winners, loosers) | |
319 | |
311 def tarotCardsPlayed(self, room_jid, player, cards, profile): | 320 def tarotCardsPlayed(self, room_jid, player, cards, profile): |
312 if not self.__check_profile(profile): | 321 if not self.__check_profile(profile): |
313 return | 322 return |
314 debug (_("Card(s) played (%(player)s): %(cards)s") % {"player":player, "cards":cards}) | 323 debug (_("Card(s) played (%(player)s): %(cards)s") % {"player":player, "cards":cards}) |
315 if self.chat_wins.has_key(room_jid): | 324 if self.chat_wins.has_key(room_jid): |