CheckConnectionIsReadyToBegin() private static method

private static CheckConnectionIsReadyToBegin ( NetworkConnection conn ) : bool
conn NetworkConnection
return bool
示例#1
0
        public void CheckReadyToBegin()
        {
            string name = SceneManager.GetSceneAt(0).name;

            if (!(name != this.m_LobbyScene))
            {
                int num  = 0;
                int num2 = 0;
                for (int i = 0; i < NetworkServer.connections.Count; i++)
                {
                    NetworkConnection networkConnection = NetworkServer.connections[i];
                    if (networkConnection != null)
                    {
                        num2++;
                        num += NetworkLobbyManager.CheckConnectionIsReadyToBegin(networkConnection);
                    }
                }
                if (this.m_MinPlayers <= 0 || num >= this.m_MinPlayers)
                {
                    if (num >= num2)
                    {
                        this.m_PendingPlayers.Clear();
                        this.OnLobbyServerPlayersReady();
                    }
                }
            }
        }
        /// <summary>
        ///   <para>CheckReadyToBegin checks all of the players in the lobby to see if their readyToBegin flag is set.</para>
        /// </summary>
        public void CheckReadyToBegin()
        {
            if (SceneManager.GetSceneAt(0).name != this.m_LobbyScene)
            {
                return;
            }
            int num = 0;

            foreach (NetworkConnection connection in NetworkServer.connections)
            {
                if (connection != null)
                {
                    num += NetworkLobbyManager.CheckConnectionIsReadyToBegin(connection);
                }
            }
            if (this.m_MinPlayers > 0 && num < this.m_MinPlayers)
            {
                return;
            }
            this.m_PendingPlayers.Clear();
            this.OnLobbyServerPlayersReady();
        }
        public void CheckReadyToBegin()
        {
            if (Application.loadedLevelName != this.m_LobbyScene)
            {
                return;
            }
            int num = 0;

            foreach (NetworkConnection current in NetworkServer.connections)
            {
                if (current != null)
                {
                    if (!NetworkLobbyManager.CheckConnectionIsReadyToBegin(current))
                    {
                        return;
                    }
                    num++;
                }
            }
            foreach (NetworkConnection current2 in NetworkServer.localConnections)
            {
                if (current2 != null)
                {
                    if (!NetworkLobbyManager.CheckConnectionIsReadyToBegin(current2))
                    {
                        return;
                    }
                    num++;
                }
            }
            if (this.m_MinPlayers > 0 && num < this.m_MinPlayers)
            {
                return;
            }
            this.m_PendingPlayers.Clear();
            this.OnLobbyServerPlayersReady();
        }