private void GenerateEntries(SpellBookCategory category)
        {
            List <int> spellsToAdd = new List <int>();

            for (int i = 0; i < category.EntryList.Count; i++)
            {
                if (category.EntryList[i] is SpellBookSpell spellEntry)
                {
                    if (spellBook.GetReaderSpellLevel(spellEntry.Spell) >= spellEntry.Spell.TierCount)
                    {
                        continue;
                    }
                    if (spellBook.ReaderSpellsConflictWith(spellEntry))
                    {
                        continue;
                    }
                }

                spellsToAdd.Add(i);
            }

            // Double for loop until we can add items to the dynamic list individually.

            entryList.AddItems(spellsToAdd.Count);
            for (int i = 0; i < spellsToAdd.Count; i++)
            {
                entryList.Entries[i].GetComponent <GUI_SpellBookEntry>().SetValues(this, category.EntryList[spellsToAdd[i]]);
            }
        }
        public void SelectCategory(SpellBookCategory category)
        {
            entryList.Clear();
            GenerateEntries(category);

            currentCategory = category;
        }
        public void SetValues(GUI_SpellBook spellBook, SpellBookCategory category)
        {
            this.spellBook = spellBook;
            this.category  = category;

            nameLabel.SetValueServer(category.Name);
            descriptionLabel.SetValueServer(category.Description);
        }
Exemple #4
0
 private void GenerateEntries(SpellBookCategory category)
 {
     entryList.AddItems(category.EntryList.Count);
     for (int i = 0; i < category.EntryList.Count; i++)
     {
         entryList.Entries[i].GetComponent <GUI_SpellBookSpellEntry>().SetValues(this, category.EntryList[i]);
     }
 }