protected virtual void SetupIglooCustomizationButton(IglooCustomizationButton button, int index)
 {
     if (index < numberOfStaticButtons)
     {
         button.SetupCatalogButton();
     }
     else
     {
         button.SetupItemButton();
         int index2 = index - numberOfStaticButtons;
         DecorationDefinitionType key = inventoryCountPairs[index2].Key;
         button.gameObject.name = key.Name + "_button";
         button.Init(key.Icon, BreadcrumbType, GetIntegerDefinitionId(key), canDrag: true);
         inventoryProgressionStatus.TryGetValue(key.GetId(), out var value);
         if (!SetLockableButtonLockedStatus(button, key, value))
         {
             int value2 = inventoryCountPairs[index2].Value;
             button.SetItemCount(value2, showItemCountsWithZeroCount, tintItemsWithZeroCount);
             if (value2 <= 0)
             {
                 button.SetCanDrag(drag: false);
             }
         }
         AccessibilitySettings component = button.GetComponent <AccessibilitySettings>();
         if (component != null)
         {
             component.CustomToken = key.Name;
         }
     }
     button.SetDragReferences(scrollRect, index, 0f);
 }
示例#2
0
        protected void onObjectAddedOrRemoved(ManipulatableObject manipulatableObject)
        {
            inventoryCountPairs = GetAvailableItems();
            if (manipulatableObject.Type != decorationDefinitionType || inventoryCountPairs == null)
            {
                return;
            }
            inventoryCountPairs = sortInventoryList(inventoryCountPairs);
            bool flag  = false;
            int  count = inventoryCountPairs.Count;

            for (int i = 0; i < count; i++)
            {
                DecorationDefinitionType key = inventoryCountPairs[i].Key;
                if (key.GetId() == manipulatableObject.DefinitionId)
                {
                    if (PooledScrollRect.IsIndexCellVisible(i + numberOfStaticButtons))
                    {
                        IglooCustomizationButton component = PooledScrollRect.GetCellAtIndex(i + numberOfStaticButtons).GetComponent <IglooCustomizationButton>();
                        component.SetItemCount(inventoryCountPairs[i].Value, showItemCountsWithZeroCount, tintItemsWithZeroCount);
                    }
                    objectAddedOrRemoved(i, manipulatableObject);
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                manipulatedObjectNotFound(manipulatableObject);
            }
        }