예제 #1
0
        void update_list()
        {
            CreatureList.Groups.Clear();
            CreatureList.Items.Clear();

            List <EncounterCard> cards = null;

            if (fCreatures != null)
            {
                cards = new List <EncounterCard>();
                foreach (Creature creature in fCreatures)
                {
                    cards.Add(new EncounterCard(creature.ID));
                }
            }
            else
            {
                cards = EncounterBuilder.FindCreatures(fTemplateSlot, fLevel, NameBox.Text);
            }

            BinarySearchTree <string> bst = new BinarySearchTree <string>();

            foreach (EncounterCard card in cards)
            {
                ICreature c = Session.FindCreature(card.CreatureID, SearchType.Global);
                bst.Add(c.Category);
            }

            List <string> cats = bst.SortedList;

            cats.Add("Miscellaneous Creatures");
            foreach (string cat in cats)
            {
                CreatureList.Groups.Add(cat, cat);
            }

            foreach (EncounterCard card in cards)
            {
                ICreature c = Session.FindCreature(card.CreatureID, SearchType.Global);

                ListViewItem lvi = CreatureList.Items.Add(card.Title);
                lvi.SubItems.Add(card.Info);
                lvi.Tag = card;

                if ((c.Category != null) && (c.Category != ""))
                {
                    lvi.Group = CreatureList.Groups[c.Category];
                }
                else
                {
                    lvi.Group = CreatureList.Groups["Miscellaneous Creatures"];
                }
            }
        }
예제 #2
0
        private void update_list()
        {
            this.CreatureList.Groups.Clear();
            this.CreatureList.Items.Clear();
            List <EncounterCard> encounterCards = null;

            if (this.fCreatures == null)
            {
                encounterCards = EncounterBuilder.FindCreatures(this.fTemplateSlot, this.fLevel, this.NameBox.Text);
            }
            else
            {
                encounterCards = new List <EncounterCard>();
                foreach (Masterplan.Data.Creature fCreature in this.fCreatures)
                {
                    encounterCards.Add(new EncounterCard(fCreature.ID));
                }
            }
            BinarySearchTree <string> binarySearchTree = new BinarySearchTree <string>();

            foreach (EncounterCard encounterCard in encounterCards)
            {
                ICreature creature = Session.FindCreature(encounterCard.CreatureID, SearchType.Global);
                binarySearchTree.Add(creature.Category);
            }
            List <string> sortedList = binarySearchTree.SortedList;

            sortedList.Add("Miscellaneous Creatures");
            foreach (string str in sortedList)
            {
                this.CreatureList.Groups.Add(str, str);
            }
            foreach (EncounterCard encounterCard1 in encounterCards)
            {
                ICreature    creature1 = Session.FindCreature(encounterCard1.CreatureID, SearchType.Global);
                ListViewItem item      = this.CreatureList.Items.Add(encounterCard1.Title);
                item.SubItems.Add(encounterCard1.Info);
                item.Tag = encounterCard1;
                if (creature1.Category == null || !(creature1.Category != ""))
                {
                    item.Group = this.CreatureList.Groups["Miscellaneous Creatures"];
                }
                else
                {
                    item.Group = this.CreatureList.Groups[creature1.Category];
                }
            }
        }