示例#1
0
    def info_parser(self, message):
        newrooms = [r for r in message[u'rooms'] if r not in self.rooms]
        self.rooms.extend(newrooms)
        self.gametypes.extend(message[u'available_games']) #FIXME must update properly
        self.update_users(message[u'users'])

        self.signal_ui(ui_messages.user_list(self.users))
        self.signal_ui(ui_messages.room_list(self.rooms))
        self.signal_ui(ui_messages.enable_chat())
示例#2
0
    def lobby_parse(self, message):
        if message[u"action"] == u"lobby_info":
            newrooms = [r for r in message[u"rooms"] if r not in self.rooms]
            self.rooms.append(newrooms)
            self.update_users(message[u"users"])
        elif message[u"action"] == u"lobby_session_logon":
            # FIXME should use logon_bcast(), right?
            self.signal_ui(ui_messages.logon(message[u"username"]))
            self.signal_ui(ui_messages.enable_chat())

        self.read_handler = self.common_parse
示例#3
0
    def game_creation_response(self, message):
        """ Our game request has been answered """

        status = message[u'status']

        if status == 'successful':
            logging.info('Game creation has been accepted')
            info = message[u'game_id']

        elif message[u'status'] == 'rejected':
            info = message[u'reason']
            logging.info('Game creation has been rejected: {0}'.format(
                info))
            self.signal_ui(ui_messages.enable_chat())

        self.signal_ui(ui_messages.game_creation_response(status,info))
        self.read_handler = self.common_parse