Exemple #1
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();
        }
Exemple #2
0
        public void CancelMatch()
        {
            BroadcastMessage("The current arena match you were in has been canceled.", 1256);

            List <PlayerMobile> m_Players = new List <PlayerMobile>();

            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)
                    {
                        m_Players.Add(participant.m_Player);
                    }

                    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();
            }

            Delete();

            foreach (PlayerMobile player in m_Players)
            {
                if (player.HasGump(typeof(ArenaGump)) && player.m_ArenaGumpObject != null)
                {
                    player.CloseGump(typeof(ArenaGump));
                    player.SendGump(new ArenaGump(player, player.m_ArenaGumpObject));
                }
            }
        }