/// <summary>
 /// Called on server from OnServerAuthenticateInternal when a client needs to authenticate
 /// </summary>
 /// <param name="conn">Connection to client.</param>
 public virtual void OnServerAuthenticate(NetworkConnectionToClient conn)
 {
     OnServerAuthenticated?.Invoke(conn);
 }
Esempio n. 2
0
 // InvokeCmd/Rpc/SyncEventDelegate can all use the same function here
 internal bool InvokeHandlerDelegate(int cmdHash, MirrorInvokeType invokeType, NetworkReader reader, NetworkConnectionToClient senderConnection = null)
 {
     if (GetInvokerForHash(cmdHash, invokeType, out Invoker invoker) && invoker.invokeClass.IsInstanceOfType(this))
     {
         currentSender = senderConnection;
         invoker.invokeFunction(this, reader, senderConnection);
         currentSender = null;
         return(true);
     }
     return(false);
 }
 // This will get more code in the near future
 internal void OnServerAuthenticateInternal(NetworkConnectionToClient conn)
 {
     OnServerAuthenticate(conn);
 }
Esempio n. 4
0
 protected void ServerAccept(NetworkConnectionToClient conn)
 {
     OnServerAuthenticated.Invoke(conn);
 }
Esempio n. 5
0
 protected void ServerReject(NetworkConnectionToClient conn)
 {
     conn.Disconnect();
 }
Esempio n. 6
0
 /// <summary>Called on server from OnServerAuthenticateInternal when a client needs to authenticate</summary>
 public virtual void OnServerAuthenticate(NetworkConnectionToClient conn)
 {
 }
Esempio n. 7
0
 public override bool OnCheckObserver(NetworkIdentity identity, NetworkConnectionToClient newObserver)
 {
     return(identity.gameObject.scene == newObserver.identity.gameObject.scene);
 }
Esempio n. 8
0
 /// <summary>
 /// This removes an external connection added with AddExternalConnection().
 /// </summary>
 /// <param name="connectionId">The id of the connection to remove.</param>
 /// <returns>True if the removal succeeded</returns>
 public void RemoveConnection(NetworkConnectionToClient conn)
 {
     connections.Remove(conn);
 }
Esempio n. 9
0
 private void OnServerAuthenticated(NetworkConnectionToClient connection)
 {
     // wait for client to send us an AddPlayerMessage
     connection.RegisterHandler <NetworkConnectionToClient, AddPlayerMessage>(OnServerAddPlayerInternal);
 }
Esempio n. 10
0
 // Callback used by the visibility system to determine if an observer
 // (player) can see the NetworkIdentity. If this function returns true,
 // the network connection will be added as an observer.
 //   conn: Network connection of a player.
 //   returns True if the player can see this object.
 public abstract bool OnCheckObserver(NetworkIdentity identity, NetworkConnectionToClient newObserver);