Server.Mobiles.IntelliSpawner.CountCreatures C# (CSharp) Méthode

CountCreatures() public méthode

public CountCreatures ( string creatureName ) : int
creatureName string
Résultat int
        public int CountCreatures(string creatureName)
        {
            Defrag();

            int count = 0;

            for (int i = 0; i < m_Spawned.Count; ++i)
                if (Insensitive.Equals(creatureName, m_Spawned[i].GetType().Name))
                    ++count;

            return count;
        }

Usage Example

        public IntelliSpawnerGump(IntelliSpawner spawner) : base(50, 50)
        {
            m_IntelliSpawner = spawner;

            AddPage(0);

            AddBackground(0, 0, 410, 371, 5054);

            AddLabel(160, 1, 0, "Creatures List");

            AddButton(5, 347, 0xFB1, 0xFB3, 0, GumpButtonType.Reply, 0);
            AddLabel(38, 347, 0x384, "Cancel");

            AddButton(5, 325, 0xFB7, 0xFB9, 1, GumpButtonType.Reply, 0);
            AddLabel(38, 325, 0x384, "Apply");

            AddButton(110, 325, 0xFB4, 0xFB6, 2, GumpButtonType.Reply, 0);
            AddLabel(143, 325, 0x384, "Bring to Home");

            AddButton(110, 347, 0xFA8, 0xFAA, 3, GumpButtonType.Reply, 0);
            AddLabel(143, 347, 0x384, "Total Respawn");

            for (int i = 0; i < 13; i++)
            {
                AddButton(5, (22 * i) + 20, 0xFA5, 0xFA7, 4 + (i * 2), GumpButtonType.Reply, 0);
                AddButton(38, (22 * i) + 20, 0xFA2, 0xFA4, 5 + (i * 2), GumpButtonType.Reply, 0);

                AddImageTiled(71, (22 * i) + 20, 309, 23, 0xA40);
                AddImageTiled(72, (22 * i) + 21, 307, 21, 0xBBC);

                string str = "";

                if (i < spawner.SpawnNames.Count)
                {
                    str = (string)spawner.SpawnNames[i];
                    int count = m_IntelliSpawner.CountCreatures(str);

                    AddLabel(382, (22 * i) + 20, 0, count.ToString());
                }

                AddTextEntry(75, (22 * i) + 21, 304, 21, 0, i, str);
            }
        }
All Usage Examples Of Server.Mobiles.IntelliSpawner::CountCreatures