public void StopClient()
    {
//		OnStopClient();

        if (LogFilter.logDebug)
        {
            Debug.Log("NetworkManager StopClient");
        }
        isNetworkActive = false;
        if (client != null)
        {
            // only shutdown this client, not ALL clients.
            client.Disconnect();
            client.Shutdown();
            client = null;
        }

//		StopMatchMaker();

        ClientScene.DestroyAllClientObjects();

//		if (!string.IsNullOrEmpty(m_OfflineScene))
//		{
//			ClientChangeScene(m_OfflineScene, false);
//		}
//		CleanupNetworkIdentities();
    }
    public NetworkClient StartClient(ConnectionConfig config, int hostPort)
    {
        LogFilter.currentLogLevel = 0;

//		InitializeSingleton();
//
//		matchInfo = info;
//		if (m_RunInBackground)
        Application.runInBackground = true;

        isNetworkActive = true;

//		if (m_GlobalConfig != null)
//		{
//			NetworkTransport.Init(m_GlobalConfig);
//		}

        client          = new MyNetClient();
        client.hostPort = hostPort;

//		config = new ConnectionConfig();
//		byte clientChannelId = config.AddChannel(QosType.StateUpdate);  // QosType.UnreliableFragmented
//
//		// add client host
//		HostTopology topology = new HostTopology(config, 1);
//		client.Configure(topology);

//		if (config != null)
//		{
//			if ((config.UsePlatformSpecificProtocols) && (UnityEngine.Application.platform != RuntimePlatform.PS4) && (UnityEngine.Application.platform != RuntimePlatform.PSP2))
//				throw new System.ArgumentOutOfRangeException("Platform specific protocols are not supported on this platform");
//
//			client.Configure(config, 1);
//		}

//		else
//		{
//			if (m_CustomConfig && m_ConnectionConfig != null)
//			{
//				m_ConnectionConfig.Channels.Clear();
//				for (int i = 0; i < m_Channels.Count; i++)
//				{
//					m_ConnectionConfig.AddChannel(m_Channels[i]);
//				}
//				if ((m_ConnectionConfig.UsePlatformSpecificProtocols) && (UnityEngine.Application.platform != RuntimePlatform.PS4) && (UnityEngine.Application.platform != RuntimePlatform.PSP2))
//					throw new ArgumentOutOfRangeException("Platform specific protocols are not supported on this platform");
//				client.Configure(m_ConnectionConfig, m_MaxConnections);
//			}
//		}

        RegisterClientMessages(client);

//		if (matchInfo != null)
//		{
//			if (LogFilter.logDebug) { Debug.Log("NetworkManager StartClient match: " + matchInfo); }
//			client.Connect(matchInfo);
//		}
//		else if (m_EndPoint != null)
//		{
//			if (LogFilter.logDebug) { Debug.Log("NetworkManager StartClient using provided SecureTunnel"); }
//			client.Connect(m_EndPoint);
//		}
//		else
        {
            if (string.IsNullOrEmpty(m_NetworkAddress))
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("Must set the Network Address field in the manager");
                }
                return(null);
            }
            if (LogFilter.logDebug)
            {
                Debug.Log("NetworkManager StartClient address:" + m_NetworkAddress + " port:" + m_NetworkPort);
            }

//			if (m_UseSimulator)
//			{
//				client.ConnectWithSimulator(m_NetworkAddress, m_NetworkPort, m_SimulatedLatency, m_PacketLossPercentage);
//			}
//			else
            {
                client.Connect(m_NetworkAddress, m_NetworkPort);
                client.PrepareNetClient();
            }
        }

//		OnStartClient(client);
//		s_Address = m_NetworkAddress;

        return(client);
    }