예제 #1
0
    /*
     * // Callback triggered when this instance receives an incoming client connection
     * public override void ConnectRequest(UdpKit.UdpEndPoint endpoint, Bolt.IProtocolToken token)
     * {
     *  //*Example:* Accepting an incoming connection with user credentials in the data token.
     *  //   UserCredentials creds = (UserCredentials)token);
     *  ///   if(Authenticate(creds.username, creds.password)) {
     *  ///     BoltNetwork.Accept(connection.remoteEndPoint);
     *  ///   }
     *
     *
     *  print("S ConnectRequest 2");
     *  BoltNetwork.Accept(endpoint);
     * }
     */


    /*
     * public override void ConnectRequest(UdpKit.UdpEndPoint endpoint)
     * {
     *  print("Connection request of type 1");
     *  BoltNetwork.Accept(endpoint);
     * }
     */

    /*public override void ConnectRequest(UdpKit.UdpEndPoint endpoint, Bolt.IProtocolToken token)
     * {
     *  print("ACcept incoming connection");
     *  BoltNetwork.Accept(endpoint);
     * }*/

    /*public override void ConnectRequest(UdpKit.UdpEndPoint endpoint, Bolt.IProtocolToken token)
     * {
     *  print("Connection request ");
     *  CameraSpawnPoint csp = new CameraSpawnPoint(new Vector3(20, 20, 20));
     *  print("Connect request, setting spawn point: "+ csp.position);
     *  BoltNetwork.Accept(endpoint, csp, csp, csp);
     * }*/

    // Callback triggered when a client has become connected to this instance

    /*public override void Connected(BoltConnection connection)
     * {
     *  print("S Connected 1");
     *
     * }*/

    // Callback triggered when a client has become connected to this instance
    public override void Connected(BoltConnection c, Bolt.IProtocolToken acceptToken)
    {
        //*Example:* Using a protocol token with the Connected callback to pass a spawnpoint position to to new player entity.
        print("S Connected 2");
        print("AcceptToken: " + acceptToken);
        //Store this location along with the user's connection
        PlayerObjectRegistry.CreateClientPlayer(c, (CameraSpawnPoint)acceptToken);
    }
예제 #2
0
    public override void Connected(BoltConnection connection)
    {
        PlayerObjectRegistry.CreateClientPlayer(connection);

        GameManager.Instance.SetAllPlayerReadyState(false);

        var log = LogEvent.Create();

        log.Message = string.Format("{0} connected", connection.RemoteEndPoint);
        log.Send();
    }
예제 #3
0
 public override void Connected(BoltConnection connection)
 {
     PlayerObjectRegistry.CreateClientPlayer(connection);
 }
예제 #4
0
 // Creates a client player when connecting to the server.
 public override void Connected(BoltConnection arg)
 {
     PlayerObjectRegistry.CreateClientPlayer(arg);
     Debug.Log(arg.ConnectionId + " Connected");
 }