public virtual void On_ShutDown(ShutdownEventArgs args)
        {
            for (int i = 0; i < Field_Config.Controllers.Count; ++i)
            {
                FieldController d = (FieldController)Field_Config.Controllers[i];

                if (d.HasStarted && d.Handeling != null)
                {
                    d.EndField(0);
                }
            }
        }
Example #2
0
        public void EndSelf()
        {
            if (Ended)
            {
                return;
            }

            if (InProgress)
            {
                Controller.EndField(0);
            }

            Ended = true;

            IEnumerator key = Teams.Keys.GetEnumerator();                // creates the key variable so we can iterate through the Teams dictionary

            for (int i = 0; i < Teams.Count; ++i)                        // Iterates through the Teams dictionary using a for loop
            {
                key.MoveNext();                                          // Moves the enumerator to its next item
                Field_Team d_team = (Field_Team)Teams[(int)key.Current]; // creates a variable referencing the currently iterated team

                for (int i2 = 0; i2 < d_team.Players.Count; ++i2)
                {
                    object o = (object)d_team.Players[i2];

                    if (o is PlayerMobile)
                    {
                        PlayerMobile pm = (PlayerMobile)d_team.Players[i2];

                        RefundBuyIn(pm);

                        pm.CloseGump(typeof(FieldSetup_Main));
                        pm.CloseGump(typeof(FieldSetup_Pending));
                        pm.CloseGump(typeof(FieldSetup_ParticipantSetup));
                        pm.CloseGump(typeof(FieldSetup_AddParticipant));
                        pm.CloseGump(typeof(FieldSetup_Rules_View));
                        pm.CloseGump(typeof(FieldSetup_ViewParticipants));
                        pm.CloseGump(typeof(FieldSetup_Rules_Armor_View));
                        pm.CloseGump(typeof(FieldSetup_Rules_Combat_View));
                        pm.CloseGump(typeof(FieldSetup_Rules_Items_View));
                        pm.CloseGump(typeof(FieldSetup_Rules_Skills_View));
                        pm.CloseGump(typeof(FieldSetup_Rules_Weapons_View));
                        pm.CloseGump(typeof(FieldSetup_Rules_Spells_View));
                        pm.CloseGump(typeof(FieldSetup_Rules_Spells_1st_View));
                        pm.CloseGump(typeof(FieldSetup_Rules_Spells_2nd_View));
                        pm.CloseGump(typeof(FieldSetup_Rules_Spells_3rd_View));
                        pm.CloseGump(typeof(FieldSetup_Rules_Spells_4th_View));
                        pm.CloseGump(typeof(FieldSetup_Rules_Spells_5th_View));
                        pm.CloseGump(typeof(FieldSetup_Rules_Spells_6th_View));
                        pm.CloseGump(typeof(FieldSetup_Rules_Spells_7th_View));
                        pm.CloseGump(typeof(FieldSetup_Rules_Spells_8th_View));
                    }
                }
            }

            EchoMessage(String.Format("The field duel has been cancelled."));
            if (Field_Config.Registry.Contains(this))
            {
                Field_Config.Registry.Remove(this);
            }
        }