예제 #1
0
    public void AddItemToggle(WearableItem item, int amount)
    {
        if (item == null)
        {
            return;
        }
        if (itemToggles.ContainsKey(item.id))
        {
            return;
        }

        ItemToggle newToggle;

        if (item.IsCollectible())
        {
            newToggle = itemToggleFactory.CreateItemToggleFromRarity(item.rarity, itemContainer);
            newToggle.transform.SetAsFirstSibling();
        }
        else
        {
            newToggle = itemToggleFactory.CreateBaseWearable(itemContainer);
        }

        newToggle.Initialize(item, false, amount);
        newToggle.OnClicked     += ToggleClicked;
        newToggle.OnSellClicked += SellClicked;
        itemToggles.Add(item.id, newToggle);

        bool active = string.IsNullOrEmpty(currentBodyShape) || item.SupportsBodyShape(currentBodyShape);

        newToggle.gameObject.SetActive(active);
    }
예제 #2
0
    public void RemoveWearable(WearableItem wearableItem)
    {
        if (wearableItem == null)
        {
            return;
        }

        if (!selectorsByCategory.ContainsKey(wearableItem.category))
        {
            Debug.LogError($"Category couldn't find selector for category: {wearableItem.category} ");
            return;
        }

        selectorsByCategory[wearableItem.category].RemoveItemToggle(wearableItem.id);
        if (wearableItem.IsCollectible())
        {
            collectiblesItemSelector.RemoveItemToggle(wearableItem.id);
        }
    }
예제 #3
0
    public void AddWearable(WearableItem wearableItem, int amount)
    {
        if (wearableItem == null)
        {
            return;
        }

        if (!selectorsByCategory.ContainsKey(wearableItem.data.category))
        {
            Debug.LogError($"Category couldn't find selector for category: {wearableItem.data.category} ");
            return;
        }

        selectorsByCategory[wearableItem.data.category].AddItemToggle(wearableItem, amount);
        if (wearableItem.IsCollectible())
        {
            collectiblesItemSelector.AddItemToggle(wearableItem, amount);
        }
    }