// Client Methods

        /// <summary>
        /// Starts the local NetworkClient.
        /// </summary>
        /// <remarks>
        /// This does not connect the client to any server. This only opens the
        /// socket for a client.
        ///
        /// If a client is already active, another client will not be started.
        /// and the active client will be returned.
        /// </remarks>
        /// <param name="config">the NetworkClientConfig used to start the server.</param>
        /// <param name="interfaceType">INetworkInterface type to use, uses default if null.</param>
        /// <returns>the NetworkClient created or fetched.</returns>
        public INetworkClient StartClient(NetworkClientConfig config, Type interfaceType = null)
        {
            if (Client != null)
            {
                return(Client);
            }
            interfaceType = interfaceType ?? DefaultNetworkInterfaceType;
            Client        = new NetworkGameClient(interfaceType, config);
            return(Client);
        }
Esempio n. 2
0
        // Client Methods

        /// <summary>
        /// Starts the local NetworkClient.
        /// </summary>
        /// <remarks>
        /// This does not connect the client to any server. This only opens the
        /// socket for a client.
        ///
        /// If a client is already active, another client will not be started.
        /// and the active client will be returned.
        /// </remarks>
        /// <param name="config">the NetworkClientConfig used to start the server.</param>
        /// <returns>the NetworkClient created or fetched.</returns>
        public INetworkClient StartClient(NetworkClientConfig config)
        {
            return(Client ?? (Client = new NetworkGameClient(NetworkInterfaceType, config)));
        }