Example #1
0
        /// <summary>
        /// Goes through all of the pending disconnect players and disconnects them
        /// Pending disconnects are always forced
        /// </summary>
        protected void DisconnectPending(Action <NetworkingPlayer, bool> disconnectMethod)
        {
            if (DisconnectingPlayers.Count == 0 && ForcedDisconnectingPlayers.Count == 0)
            {
                return;
            }

            lock (Players)
            {
                for (int i = DisconnectingPlayers.Count - 1; i >= 0; --i)
                {
                    disconnectMethod(DisconnectingPlayers[i], false);
                }

                for (int i = ForcedDisconnectingPlayers.Count - 1; i >= 0; --i)
                {
                    disconnectMethod(ForcedDisconnectingPlayers[i], true);
                }

                DisconnectingPlayers.Clear();
                ForcedDisconnectingPlayers.Clear();
            }
        }