UnityEngine.Networking.ClientScene.ClearLocalPlayers C# (CSharp) Method

ClearLocalPlayers() static private method

static private ClearLocalPlayers ( ) : void
return void
        internal static void ClearLocalPlayers()
        {
            s_LocalPlayers.Clear();
        }

Usage Example

コード例 #1
0
        /// <summary>
        ///   <para>This is used by a client that has lost the connection to the old host, to reconnect to the new host of a game.</para>
        /// </summary>
        /// <param name="serverIp">The IP address of the new host.</param>
        /// <param name="serverPort">The port of the new host.</param>
        /// <returns>
        ///   <para>True if able to reconnect.</para>
        /// </returns>
        public bool ReconnectToNewHost(string serverIp, int serverPort)
        {
            if (!NetworkClient.active)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError((object)"Reconnect - NetworkClient must be active");
                }
                return(false);
            }
            if (this.m_Connection == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError((object)"Reconnect - no old connection exists");
                }
                return(false);
            }
            if (LogFilter.logInfo)
            {
                Debug.Log((object)("NetworkClient Reconnect " + serverIp + ":" + (object)serverPort));
            }
            ClientScene.HandleClientDisconnect(this.m_Connection);
            ClientScene.ClearLocalPlayers();
            this.m_Connection.Disconnect();
            this.m_Connection = (NetworkConnection)null;
            this.m_ClientId   = NetworkTransport.AddHost(this.m_HostTopology, 0);
            string hostNameOrAddress = serverIp;

            this.m_ServerPort = serverPort;
            if (Application.platform == RuntimePlatform.WebGLPlayer)
            {
                this.m_ServerIp     = hostNameOrAddress;
                this.m_AsyncConnect = NetworkClient.ConnectState.Resolved;
            }
            else if (serverIp.Equals("127.0.0.1") || serverIp.Equals("localhost"))
            {
                this.m_ServerIp     = "127.0.0.1";
                this.m_AsyncConnect = NetworkClient.ConnectState.Resolved;
            }
            else
            {
                if (LogFilter.logDebug)
                {
                    Debug.Log((object)("Async DNS START:" + hostNameOrAddress));
                }
                this.m_AsyncConnect = NetworkClient.ConnectState.Resolving;
                Dns.BeginGetHostAddresses(hostNameOrAddress, new AsyncCallback(NetworkClient.GetHostAddressesCallback), (object)this);
            }
            return(true);
        }
All Usage Examples Of UnityEngine.Networking.ClientScene::ClearLocalPlayers