comparison libervia.tac @ 37:b306aa090438

Tarot game: game launching (first hand showed), and contract selection
author Goffi <goffi@goffi.org>
date Wed, 18 May 2011 01:45:28 +0200
parents 1d406077b49b
children 7bea2ae0c4fb
comparison
equal deleted inserted replaced
36:1d406077b49b 37:b306aa090438
126 126
127 def jsonrpc_getTarotCardsPaths(self): 127 def jsonrpc_getTarotCardsPaths(self):
128 """Give the path of all the tarot cards""" 128 """Give the path of all the tarot cards"""
129 return map(lambda x: x[len(LIBERVIA_DIR):],glob.glob(os.path.join(LIBERVIA_DIR,CARDS_DIR,'*_*.png'))); 129 return map(lambda x: x[len(LIBERVIA_DIR):],glob.glob(os.path.join(LIBERVIA_DIR,CARDS_DIR,'*_*.png')));
130 130
131 131 def jsonrpc_tarotGameReady(self, player, referee):
132 """Tell to the server that we are ready to start the game"""
133 profile = self.session.sat_profile
134 self.sat_host.bridge.tarotGameReady(player, referee)
135
136 def jsonrpc_tarotGameContratChoosed(self, player_nick, referee, contrat):
137 """Tell to the server that we are ready to start the game"""
138 profile = self.session.sat_profile
139 self.sat_host.bridge.tarotGameContratChoosed(player_nick, referee, contrat, profile)
132 140
133 class Register(jsonrpc.JSONRPC): 141 class Register(jsonrpc.JSONRPC):
134 """This class manage the registration procedure with SàT 142 """This class manage the registration procedure with SàT
135 It provide an api for the browser, check password and setup the web server""" 143 It provide an api for the browser, check password and setup the web server"""
136 144
351 print(u"Can't connect to SàT backend, are you sure it's launched ?") 359 print(u"Can't connect to SàT backend, are you sure it's launched ?")
352 import sys 360 import sys
353 sys.exit(1) 361 sys.exit(1)
354 self.bridge.register("connected", self.signal_handler.connected) 362 self.bridge.register("connected", self.signal_handler.connected)
355 self.bridge.register("connectionError", self.signal_handler.connectionError) 363 self.bridge.register("connectionError", self.signal_handler.connectionError)
356 for signal_name in ['presenceUpdate', 'personalEvent', 'newMessage', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted']: 364 for signal_name in ['presenceUpdate', 'personalEvent', 'newMessage', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew',
365 'tarotGameChooseContrat']:
357 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name)) 366 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name))
358 root.putChild('json_signal_api', self.signal_handler) 367 root.putChild('json_signal_api', self.signal_handler)
359 root.putChild('json_api', MethodHandler(self)) 368 root.putChild('json_api', MethodHandler(self))
360 root.putChild('register_api', _register) 369 root.putChild('register_api', _register)
361 root.putChild('blog', MicroBlog(self)) 370 root.putChild('blog', MicroBlog(self))