public void UpdateData(ICharacterData character)
        {
            this.character = character;
            int selectedIdx = CacheItemSelectionManager.SelectedUI != null?CacheItemSelectionManager.IndexOf(CacheItemSelectionManager.SelectedUI) : -1;

            CacheItemSelectionManager.DeselectSelectedUI();
            CacheItemSelectionManager.Clear();

            if (character == null)
            {
                CacheItemList.HideAll();
                return;
            }

            IList <CharacterItem> nonEquipItems = character.NonEquipItems;
            IList <CharacterItem> filteredItems = new List <CharacterItem>();
            List <int>            filterIndexes = new List <int>();
            // Filter items to show by specific item types
            int counter = 0;

            foreach (CharacterItem nonEquipItem in nonEquipItems)
            {
                if (nonEquipItem.GetItem() == null)
                {
                    continue;
                }
                if (string.IsNullOrEmpty(nonEquipItem.GetItem().category) ||
                    filterCategories == null || filterCategories.Count == 0 ||
                    filterCategories.Contains(nonEquipItem.GetItem().category))
                {
                    if (filterItemTypes == null || filterItemTypes.Count == 0 ||
                        filterItemTypes.Contains(nonEquipItem.GetItem().itemType))
                    {
                        filteredItems.Add(nonEquipItem);
                        filterIndexes.Add(counter);
                    }
                }
                ++counter;
            }
            CacheItemList.Generate(filteredItems, (index, characterItem, ui) =>
            {
                UICharacterItem uiCharacterItem = ui.GetComponent <UICharacterItem>();
                uiCharacterItem.Setup(new CharacterItemTuple(characterItem, characterItem.level, InventoryType.NonEquipItems), this.character, filterIndexes[index]);
                uiCharacterItem.Show();
                UICharacterItemDragHandler dragHandler = uiCharacterItem.GetComponentInChildren <UICharacterItemDragHandler>();
                if (dragHandler != null)
                {
                    dragHandler.SetupForNonEquipItems(uiCharacterItem);
                }
                CacheItemSelectionManager.Add(uiCharacterItem);
                if (selectedIdx == index)
                {
                    uiCharacterItem.OnClickSelect();
                }
            });
        }
        public void UpdateData()
        {
            if (storageType == StorageType.None)
            {
                return;
            }

            int selectedIdx = CacheCharacterItemSelectionManager.SelectedUI != null?CacheCharacterItemSelectionManager.IndexOf(CacheCharacterItemSelectionManager.SelectedUI) : -1;

            CacheCharacterItemSelectionManager.DeselectSelectedUI();
            CacheCharacterItemSelectionManager.Clear();
            totalWeight = 0;
            usedSlots   = 0;
            IList <CharacterItem> characterItems = BasePlayerCharacterController.OwningCharacter.StorageItems;

            CacheCharacterItemList.Generate(characterItems, (index, characterItem, ui) =>
            {
                UICharacterItem uiCharacterItem = ui.GetComponent <UICharacterItem>();
                uiCharacterItem.Setup(new CharacterItemTuple(characterItem, characterItem.level, InventoryType.StorageItems), BasePlayerCharacterController.OwningCharacter, index);
                uiCharacterItem.Show();
                if (characterItem.NotEmptySlot())
                {
                    totalWeight += characterItem.GetItem().weight *characterItem.amount;
                    usedSlots++;
                }
                UICharacterItemDragHandler dragHandler = uiCharacterItem.GetComponentInChildren <UICharacterItemDragHandler>();
                if (dragHandler != null)
                {
                    dragHandler.SetupForStorageItems(uiCharacterItem);
                }
                CacheCharacterItemSelectionManager.Add(uiCharacterItem);
                if (selectedIdx == index)
                {
                    uiCharacterItem.OnClickSelect();
                }
            });
        }