Beispiel #1
0
    def hello(self, message, team_name, actor_uuid):
        """ Register the actor with address `actor_uuid` as team `team_name`.
        """
        _logger.info("Received 'hello' from '%s'." % team_name)

        self._remove_dead_teams()

        if self.ref.remote:
            other_ref = self.ref.remote.create_proxy(actor_uuid)
        else:
            other_ref = actor_registry.get_by_uuid(actor_uuid)

        self.teams.append(other_ref)
        self.team_names.append(team_name)
        self.ref.reply("ok")

        if len(self.teams) == 2:
            _logger.info("Two players are available. Starting a game.")

            self.ref.notify("start_game")
 def connect(self, message, actor_uuid):
     if self.ref.remote:
         self.pong = self.ref.remote.create_proxy(actor_uuid)
     else:
         self.pong = actor_registry.get_by_uuid(actor_uuid)