public void Stop()
 {
     PermaDisconnected = true;
     NetworkClient.Instance.ClientConnected = false;
     Connected = false;
     NetworkStatisiticsManager.Remove(connection);
     connection.Dispose();
 }
Пример #2
0
 public bool Disconnect(NetworkConnection con)
 {
     NetworkClient.Instance.ClientConnected = false;
     if (con != null)
     {
         NetworkClient.PushMessage(new NetworkMessage
         {
             msgType = RecconectTry == m_RecconectTry ? InternalMessages.DISCONNECT : InternalMessages.DISCONNECT_BUT_WILL_RECONNECT,
             conn    = con,
             reader  = new NetworkReader()
         });
         NetworkStatisiticsManager.Remove(con);
         con.Dispose();
         Connected        = false;
         LastTryToConnect = Time.time + NetConfig.ReconnectTimeOut;
         return(true);
     }
     LastTryToConnect = Time.time + NetConfig.ReconnectTimeOut;
     Connected        = false;
     return(false);
 }
Пример #3
0
 public bool Disconnect(NetworkConnection con)
 {
     if (con != null)
     {
         uint conId = con.connectionId;
         NetworkServer.PushMessage(new NetworkMessage
         {
             msgType = InternalMessages.DISCONNECT,
             conn    = con,
             reader  = new NetworkReader()
         });
         NetworkStatisiticsManager.Remove(con);
         lock (m_Connections)
         {
             if (m_Connections.ContainsKey(conId))
             {
                 m_Connections.Remove(conId);
             }
         }
         con.Dispose();
     }
     return(true);
 }