Пример #1
0
        internal void Update()
        {
            if (NPCLoader.NPCCount - 1 != npcSlots.Count)
            {
                // should only happen once
                npcSlots.Clear();
                for (int type = 1; type < NPCLoader.NPCCount; type++)
                {
                    NPC npc = new NPC();
                    npc.SetDefaults(type);
                    var slot = new UINPCSlot(npc);
                    npcSlots.Add(slot);
                }
            }

            if (!updateNeeded)
            {
                return;
            }
            updateNeeded = false;

            npcGrid.Clear();
            for (int type = 1; type < NPCLoader.NPCCount; type++)
            {
                var slot = npcSlots[type - 1];
                if (PassNPCFilters(slot))
                {
                    npcGrid._items.Add(slot);
                    npcGrid._innerList.Append(slot);
                }
            }
            npcGrid.UpdateOrder();
            npcGrid._innerList.Recalculate();

            lootGrid.Clear();
            if (queryLootNPC != null)
            {
                var drops = queryLootNPC.GetDrops();
                if (NewLootOnlyRadioButton.Selected && RecipeBrowserUI.instance.foundItems != null)
                {
                    drops.RemoveWhere(x => RecipeBrowserUI.instance.foundItems[x]);
                }
                foreach (var dropitem in drops)
                {
                    Item item = new Item();
                    item.SetDefaults(dropitem, false);
                    var slot = new UIBestiaryItemSlot(item);
                    lootGrid._items.Add(slot);
                    lootGrid._innerList.Append(slot);
                }
            }
            lootGrid.UpdateOrder();
            lootGrid._innerList.Recalculate();
        }