/// <summary>Disconnects from the server and stops all network traffic.</summary>
        public void Disconnect()
        {
            isConnected = false;

            if (tcp.socket.Connected)
            {
                ClientSend.PlayerDisconnected(Instance.myId);
                tcp.socket.Close();
                Log("You have been disconnected from the server.");
            }

            SessionManager.Instance.DestroyAllPlayers();
        }
Example #2
0
        /// <summary>Disconnects from the server and stops all network traffic.</summary>
        public void Disconnect()
        {
            isConnected = false;

            if (tcp.socket.Connected)
            {
                ClientSend.PlayerDisconnected(Instance.myId);
                tcp.socket.Close();
                Log("You have been disconnected from the server.");
            }

            udp.Disconnect();

            SessionManager.Instance.DestroyAllPlayers();

            ConnectionPanel.ConnectButton.UpdateText("Connect");
            ConnectionPanel.ConnectionInfo.UpdateText("Disconnected.");
        }