コード例 #1
0
ファイル: client.py プロジェクト: p-blomberg/yamosg
	def __init__(self, sock, server, game):
		Connection.__init__(self, sock, server)
		
		self.game=game
		self.player=None
		self._encoder = encoder('plaintext')
		
		# client commands
		self._commands = {
			'SET': self._set_prop,
			"LOGIN": self.game.login,
			"LOGOUT": self.game.logout,
			"PING": self.ping,
			"PLAYERINFO": self.game.playerinfo,
			"NEWUSER": self.game.NewUser,
			"LIST_OF_ENTITIES": self.game.list_of_entities,
			"ENTINFO": self.game.entity_info,
			"ENTACTION": self.game.EntAction,
			"TYPEINFO": entity.typeinfo,
			"PLAYERS": self.game.Players,
			"QUIT": self.game.logout
		}
		
		# properties
		self._props = {
			'ENCODER': self._set_encoder
		}
コード例 #2
0
    def __init__(self, sock, server, game):
        Connection.__init__(self, sock, server)

        self.game = game
        self.player = None
        self._encoder = encoder('plaintext')

        # client commands
        self._commands = {
            'SET': self._set_prop,
            "LOGIN": self.game.login,
            "LOGOUT": self.game.logout,
            "PING": self.ping,
            "PLAYERINFO": self.game.playerinfo,
            "NEWUSER": self.game.NewUser,
            "LIST_OF_ENTITIES": self.game.list_of_entities,
            "ENTINFO": self.game.entity_info,
            "ENTACTION": self.game.EntAction,
            "TYPEINFO": entity.typeinfo,
            "PLAYERS": self.game.Players,
            "QUIT": self.game.logout
        }

        # properties
        self._props = {'ENCODER': self._set_encoder}
コード例 #3
0
ファイル: client.py プロジェクト: p-blomberg/yamosg
	def disconnect(self, message='Disconnected'):
		"""
		Force a client to disconnect.
		"""
		
		# notify client
		self.game.unicast(self, 'DISCONNECTED', message)
		
		# actual disconnect
		Connection.disconnect(self, message)
コード例 #4
0
    def disconnect(self, message='Disconnected'):
        """
		Force a client to disconnect.
		"""

        # notify client
        self.game.unicast(self, 'DISCONNECTED', message)

        # actual disconnect
        Connection.disconnect(self, message)
コード例 #5
0
ファイル: client.py プロジェクト: p-blomberg/yamosg
	def peer(self):
		if self.player:
			return str(Connection.peer(self)) + '::' + self.player.name
		else:
			return str(Connection.peer(self))
コード例 #6
0
 def peer(self):
     if self.player:
         return str(Connection.peer(self)) + '::' + self.player.name
     else:
         return str(Connection.peer(self))