Ejemplo n.º 1
0
        /// <summary>
        /// Add a user to the queue
        /// </summary>
        /// <param name="user"></param>
        public bool QueueUser(MRKToSUser user)
        {
            if (MatchState != State.Waiting)
            {
                MRKToSLogger.LogError($"Can not queue {user.Username} to the match, match has already started or is still idle");
                return(false);
            }

            if (FindQueuedUser(user.Username) != null)
            {
                MRKToSLogger.LogWarning($"User {user.Username} is already queued");
                return(false);
            }

            if (m_QueuedUsers.Count >= Settings.MaximumPlayerCount)
            {
                MRKToSLogger.LogWarning($"Can not que {user.Username} to the match, match has maximum player count");
                return(false);
            }

            m_QueuedUsers.Add(user);

            MRKToSLogger.LogInfo($"User {user.Username} has been added to the queue");
            LogQueueCount();

            MatchListener.OnQueueUserAdded(user);

            UpdatePregame();
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Remove a user from the queue
        /// </summary>
        /// <param name="user"></param>
        public bool DequeueUser(MRKToSUser user)
        {
            if (MatchState != State.Waiting)
            {
                MRKToSLogger.LogError($"Can not dequeue {user.Username} to the match, match has already started or is still idle");
                return(false);
            }

            if (FindQueuedUser(user.Username) == null)
            {
                MRKToSLogger.LogWarning($"User {user.Username} is not queued");
                return(false);
            }

            m_QueuedUsers.Remove(user);

            MRKToSLogger.LogInfo($"User {user.Username} has been removed from the queue");
            LogQueueCount();

            MatchListener.OnQueueUserRemoved(user);

            UpdatePregame();
            return(true);
        }