Disconnect() private method

private Disconnect ( int hostId, int connectionId, byte &error ) : bool
hostId int
connectionId int
error byte
return bool
示例#1
0
 public override void DisconnectLocalClient()
 {
     if (NetworkManager.Get().enableLogging)
     {
         Debug.Log("Transport Disconnect Local Client");
     }
     Unet.Disconnect(serverHostID, serverConnectionID, out byte error);
 }
示例#2
0
        public override void DisconnectRemoteClient(ulong clientID)
        {
            if (NetworkManager.Get().enableLogging)
            {
                Debug.Log("Transport Disconnect Remote Client");
            }
            GetUnetConnectionDetails(clientID, out byte hostID, out ushort connectionID);

            Unet.Disconnect((int)hostID, (int)connectionID, out byte error);
        }
示例#3
0
 public void Disconnect()
 {
     address = string.Empty;
     isReady = false;
     ClientScene.HandleClientDisconnect(this);
     if (hostId != -1)
     {
         NetworkTransport.Disconnect(hostId, connectionId, out byte _);
         RemoveObservers();
     }
 }
示例#4
0
        // called by NetworkManager on clients when connection to host is lost.
        // return true to stay in online scene
        public bool LostHostOnClient(NetworkConnection conn)
        {
            if (LogFilter.logDebug)
            {
                Debug.Log("NetworkMigrationManager client OnDisconnectedFromHost");
            }

            if (UnityEngine.Application.platform == RuntimePlatform.WebGLPlayer)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("LostHostOnClient: Host migration not supported on WebGL");
                }
                return(false);
            }

            if (m_Client == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("NetworkMigrationManager LostHostOnHost client was never initialized.");
                }
                return(false);
            }

            if (!m_HostMigration)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("NetworkMigrationManager LostHostOnHost migration not enabled.");
                }
                return(false);
            }

            m_DisconnectedFromHost = true;
            DisablePlayerObjects();


            byte error;

            NetworkTransport.Disconnect(m_Client.hostId, m_Client.connection.connectionId, out error);

            if (m_OldServerConnectionId != -1)
            {
                // only call this if we actually connected
                SceneChangeOption sceneOption;
                OnClientDisconnectedFromHost(conn, out sceneOption);
                return(sceneOption == SceneChangeOption.StayInOnlineScene);
            }

            // never entered the online scene
            return(false);
        }
 /// <summary>
 /// <para>Disconnects this connection.</para>
 /// </summary>
 public void Disconnect()
 {
     this.address = "";
     this.isReady = false;
     ClientScene.HandleClientDisconnect(this);
     if (this.hostId != -1)
     {
         byte num;
         NetworkTransport.Disconnect(this.hostId, this.connectionId, out num);
         this.RemoveObservers();
     }
 }
示例#6
0
 public static bool Disconnect(int hostId, int connectionId, out byte error)
 {
     if (!isClient)
     {
         disconnectBuffer.ToBytes((ushort)connectionId, 1);
         return(NetworkTransport.Send(hostId, relayConnectionId, GetReliableChannel(), disconnectBuffer, 3, out error));
     }
     else
     {
         return(NetworkTransport.Disconnect(hostId, connectionId, out error));
     }
 }
        public bool LostHostOnClient(NetworkConnection conn)
        {
            if (LogFilter.logDebug)
            {
                Debug.Log("NetworkMigrationManager client OnDisconnectedFromHost");
            }
            bool result;

            if (Application.platform == RuntimePlatform.WebGLPlayer)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("LostHostOnClient: Host migration not supported on WebGL");
                }
                result = false;
            }
            else if (this.m_Client == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("NetworkMigrationManager LostHostOnHost client was never initialized.");
                }
                result = false;
            }
            else if (!this.m_HostMigration)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("NetworkMigrationManager LostHostOnHost migration not enabled.");
                }
                result = false;
            }
            else
            {
                this.m_DisconnectedFromHost = true;
                this.DisablePlayerObjects();
                byte b;
                NetworkTransport.Disconnect(this.m_Client.hostId, this.m_Client.connection.connectionId, out b);
                if (this.m_OldServerConnectionId != -1)
                {
                    NetworkMigrationManager.SceneChangeOption sceneChangeOption;
                    this.OnClientDisconnectedFromHost(conn, out sceneChangeOption);
                    result = (sceneChangeOption == NetworkMigrationManager.SceneChangeOption.StayInOnlineScene);
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }
        public void Disconnect()
        {
            this.address = string.Empty;
            this.isReady = false;
            ClientScene.HandleClientDisconnect(this);
            if (this.hostId == -1)
            {
                return;
            }
            byte b;

            NetworkTransport.Disconnect(this.hostId, this.connectionId, out b);
            this.RemoveObservers();
        }
        public void Disconnect()
        {
            address = "";
            isReady = false;
            ClientScene.HandleClientDisconnect(this);
            if (hostId == -1)
            {
                return;
            }
            byte error;

            NetworkTransport.Disconnect(hostId, connectionId, out error);

            RemoveObservers();
        }
示例#10
0
        public void Disconnect()
        {
            // don't clear address so we can still access it in NetworkManager.OnServerDisconnect
            // => it's reset in Initialize anyway and there is no address empty check anywhere either
            //address = "";
            isReady = false;
            ClientScene.HandleClientDisconnect(this);
            if (hostId == -1)
            {
                return;
            }
            byte error;

            NetworkTransport.Disconnect(hostId, connectionId, out error);

            RemoveObservers();
        }
 public bool Disconnect(int hostId, int connectionId, out byte error)
 {
     return(NetworkTransport.Disconnect(hostId, connectionId, out error));
 }