Quizz game: first draft
This commit is contained in:
parent
32a4841507
commit
fb41ecbbf5
7 changed files with 539 additions and 2 deletions
|
|
@ -63,6 +63,9 @@ class QuickApp():
|
|||
self.bridge.register("tarotGameScore", self.tarotScore)
|
||||
self.bridge.register("tarotGameCardsPlayed", self.tarotCardsPlayed)
|
||||
self.bridge.register("tarotGameInvalidCards", self.tarotInvalidCards)
|
||||
self.bridge.register("quizGameStarted", self.quizGameStarted)
|
||||
self.bridge.register("quizGameNew", self.quizGameNew)
|
||||
self.bridge.register("quizGameQuestion", self.quizGameQuestion)
|
||||
self.bridge.register("subscribe", self.subscribe)
|
||||
self.bridge.register("paramUpdate", self.paramUpdate)
|
||||
self.bridge.register("contactDeleted", self.contactDeleted)
|
||||
|
|
@ -372,6 +375,30 @@ class QuickApp():
|
|||
if self.chat_wins.has_key(room_jid):
|
||||
self.chat_wins[room_jid].getGame("Tarot").invalidCards(phase, played_cards, invalid_cards)
|
||||
|
||||
def quizGameStarted(self, room_jid, referee, players, profile):
|
||||
if not self.check_profile(profile):
|
||||
print "gof: NOT CHECK PROFILE", profile
|
||||
return
|
||||
debug (_("Quiz Game Started \o/"))
|
||||
if self.chat_wins.has_key(room_jid):
|
||||
self.chat_wins[room_jid].startGame("Quiz", referee, players)
|
||||
debug (_("new Quiz game started by [%(referee)s] in room [%(room_jid)s] with %(players)s") % {'referee':referee, 'room_jid':room_jid, 'players':[str(player) for player in players]})
|
||||
|
||||
def quizGameNew(self, room_jid, data, profile):
|
||||
if not self.check_profile(profile):
|
||||
return
|
||||
debug (_("New Quiz Game"))
|
||||
if self.chat_wins.has_key(room_jid):
|
||||
self.chat_wins[room_jid].getGame("Quiz").quizGameNew(data)
|
||||
|
||||
def quizGameQuestion(self, room_jid, question_id, question, timer, profile):
|
||||
"""Called when a new question is asked"""
|
||||
if not self.check_profile(profile):
|
||||
return
|
||||
debug (_(u"Quiz: new question: %s") % question)
|
||||
if self.chat_wins.has_key(room_jid):
|
||||
self.chat_wins[room_jid].getGame("Quiz").quizGameQuestion(question_id, question, timer)
|
||||
|
||||
def _subscribe_cb(self, answer, data):
|
||||
entity, profile = data
|
||||
if answer:
|
||||
|
|
|
|||
Loading…
Reference in a new issue