protected override void OnTick()
            {
                Queue m_Queue = new Queue();

                foreach (ArenaMatchResultEntry arenaMatchResultEntry in m_ArenaMatchResultEntries)
                {
                    if (arenaMatchResultEntry == null)
                    {
                        continue;
                    }
                    if (arenaMatchResultEntry.Deleted)
                    {
                        continue;
                    }

                    TimeSpan expirationLength = MatchResultExpiration;

                    //Test: Add Tournament Expiration

                    if (arenaMatchResultEntry.m_CompletionDate + expirationLength <= DateTime.UtcNow)
                    {
                        m_Queue.Enqueue(arenaMatchResultEntry);
                    }
                }

                while (m_Queue.Count > 0)
                {
                    ArenaMatchResultEntry entryResult = (ArenaMatchResultEntry)m_Queue.Dequeue();

                    if (entryResult != null)
                    {
                        entryResult.Delete();
                    }
                }
            }
Example #2
0
        public override void OnDelete()
        {
            Queue m_TeamsQueue       = new Queue();
            Queue m_ParticipantQueue = new Queue();

            foreach (ArenaTeam arenaTeam in m_Teams)
            {
                if (arenaTeam == null)
                {
                    continue;
                }

                m_TeamsQueue.Enqueue(arenaTeam);

                foreach (ArenaParticipant participant in arenaTeam.m_Participants)
                {
                    if (participant == null)
                    {
                        continue;
                    }

                    m_ParticipantQueue.Enqueue(participant);

                    if (participant.m_Player != null)
                    {
                        participant.m_Player.m_ArenaPlayerSettings.m_ArenaMatch = null;
                    }
                }
            }

            while (m_ParticipantQueue.Count > 0)
            {
                ArenaParticipant arenaParticipant = (ArenaParticipant)m_ParticipantQueue.Dequeue();

                arenaParticipant.Delete();
            }

            while (m_TeamsQueue.Count > 0)
            {
                ArenaTeam arenaTeam = (ArenaTeam)m_TeamsQueue.Dequeue();

                arenaTeam.Delete();
            }

            if (m_ArenaGroupController != null)
            {
                if (m_ArenaGroupController.m_MatchListings.Contains(this))
                {
                    m_ArenaGroupController.m_MatchListings.Remove(this);
                }
            }

            if (m_ArenaMatchResultEntry != null)
            {
                m_ArenaMatchResultEntry.Delete();
            }

            base.OnDelete();
        }