public override void MoveItemToBasket(ShopItemSlotUI item) { // Max stack of 1 for furniture upgrades. if (basketItems.Any(x => x.currentItem == item.currentItem)) { return; } base.MoveItemToBasket(item); }
public override void MoveItemToBasket(ShopItemSlotUI item) { var existingItem = basketItems.Find(x => x.currentItem == item.currentItem); // If it exists, add to its quantity if (existingItem != null) { existingItem.currentQuantity++; } else { var newItem = CreateBasketItemSlot(); newItem.SetItem(item.currentItem, item.currentPrice, 1); newItem.SetAction(() => RemoveItemFromBasket(newItem)); } Refresh(); }
protected void UpdateItemSlot(ShopItemSlotUI shopItem) => shopItem.SetItem(shopItem.currentItem, shopItem.currentPrice);