private void HandleCollectionButtonClicked(StoreItemButton button) { var item = button.Item; if (modelController.CanSellItem(item)) { screenView.ShowFadeLabel(button, 1); modelController.SellItem(item); } button.UpdateAppearance(); }
public void RemoveStoreButton(Item selectedItem) { itemsToSell.Remove(selectedItem); StoreItemButton buttonToRemove = null; foreach (StoreItemButton itemButton in itemButtons) { if (itemButton.item == selectedItem) { buttonToRemove = itemButton; break; } } if (buttonToRemove != null) { itemButtons.Remove(buttonToRemove); Destroy(buttonToRemove.gameObject); ArrangeButtons(); } }
/// <summary> /// Attempts to purchase item. All error handling is done here /// </summary> /// <returns> /// The to purchase item. /// </returns> /// <param name='button'> /// Button. /// </param> PurchaseItemError CanPurchaseItem(StoreItemButton button) { if (UserBase.I.userAssets.coins < button.item.purchaseInto.costInCoin) return PurchaseItemError.NotEnoughCoin; if (UserBase.I.userAssets.cash < button.item.purchaseInto.costInCash) return PurchaseItemError.NotEnoughCash; if (UserBase.I.userAssets.IsItemPurchased(button.item) == true) //only purchase if we havent already purchased { if (button.item.GetItemType() != ItemType.Cnsmbl && button.item.GetItemType() != ItemType.Buff) return PurchaseItemError.AlreadyPurchased; } return PurchaseItemError.None; }
public void ShowFadeLabel(StoreItemButton button, int count) { SpawnFadeLabel(button.GetComponent <RectTransform>(), button.Item.Reward * count); }