示例#1
0
    void InitNetwork()
    {
        WSServerState.Reset();

        if (DebugStandalone)
        {
            WSServer.Stop();
            WSServerState.Reset();
            WSClient.Disconnect();
            WSClientState.Reset();
            WSServer.StartFake();
            WSClient.ConnectFake();
        }
        else if (IsClient)
        {
            WSServer.Stop();
            WSServerState.Reset();
            WSClient.Connect();
        }
        else
        {
            WSClient.Disconnect();
            WSClientState.Reset();
            if (!WSServer.IsRunning)
            {
                WSServer.Start();
            }
        }
    }
示例#2
0
 void OnApplicationQuit()
 {
     WSServer.Stop();
     WSClient.Disconnect();
 }
示例#3
0
		private void OnDestroy()
		{
			if (TCPClientState.Connected) tcpClient.Disconnect();
			if (UDPClientState.Connected) udpClient.Disconnect();
			if (WSClientState.Connected) wsClient.Disconnect();
		}