def handle(self, gameId): player = Player.byUser(self.user) if player is None: self.response.out.write("") return game = Game.byId(gameId) out = [player.email for player in game.players] self.response.out.write(json.dumps(out))
def handle(self, gameId): player = Player.byUser(self.user) if player is None: self.response.out.write("") return game = Game.byId(gameId) msg = self.request.get('msg') game.broadcast({ "sender": player.username, "message":msg})
def handle(self, gameId): print "PlayJoin %s" % gameId game = Game.byId(gameId) if game is None: self.response.out.write("Invalid game") return player = Player.byUser(self.user) # Player joining this game fresh if player is None: player = Player.joinGame(self.user, game) # Player was in another game, leave it. if player.game.gameId != game.gameId: player.leaveGame() player = Player.joinGame(self.user, game) render(self, 'play.html', { 'me': player.user, 'token': player.token, 'game_key': player.game })