示例#1
0
 def addUser(self, user):
     username = user.db_tuple.name
     
     for user_in_room in self.users.itervalues():
         reactor.callFromThread(user_in_room.conn.send,
                                ClientRoomCommand.adduser(self.name, username))
         
     self.users[username] = user
示例#2
0
 def removeUser(self, user):
     username = user.db_tuple.name
     remove_game_requests(user.conn, username,self.name)
     try:
         del self.users[username]
     except KeyError:
         pass
     
     for user_in_room in self.users.itervalues():
         reactor.callFromThread(user_in_room.conn.send,
                                ClientRoomCommand.removeuser(self.name, username))
示例#3
0
    def __init__(self, name):
        self.name = name
        Room.add(self)

        self.chat = Chat()
        self.users = {}     # {'name' : connected_user_instance}
        
        for cu in ConnectedUser.__users__.itervalues():
            reactor.callFromThread(cu.conn.send,
                                   ClientRoomCommand.created(self.name))
        self.public_games = []
示例#4
0
 def destroy(self):
     for cu in ConnectedUser.__users__.itervalues():
         reactor.callFromThread(cu.conn.send,
                                ClientRoomCommand.destroyed(self.name))
     
     Room.remove(self)