Exemple #1
0
    public void PresentItem(IShopItemModel shopItemModel)
    {
        gameObject.SetActive(true);
        itemImage.sprite = shopItemModel.GetItemSprite();
        var itemStatModel = shopItemModel.GetItemStats();
        int itemLevel     = inventory.GetItemLevel(shopItemModel);

        for (int i = 0; i < stats.Length; i++)
        {
            if (i < itemStatModel.Length)
            {
                stats[i].enabled = true;
                stats[i].PresentStat(shopItemModel, itemStatModel[i], itemLevel);
            }
            else
            {
                stats[i].enabled = false;
            }
        }
        var cost = shopItemModel.GetGoldCost(itemLevel);

        costAmountText.text = "Upgrade " + cost.ToString();
        /// Move costAmountCoin depending on size of gold cost
        Debug.Log("Move costAmountCoin depending on size of gold cost");

        upgradeButton.onClick.RemoveAllListeners();
        upgradeButton.interactable = playerCurrency.CanAfford(CurrencyType.Gold, cost);
        if (upgradeButton.interactable)
        {
            upgradeButton.onClick.AddListener(delegate
            {
                BuyItem(shopItemModel);
            });
        }
    }
 internal void ShowItem(PlayerItemInventory inventory, PlayerItem playerItem, IShopItemModel itemModel)
 {
     this.inventory = inventory;
     item           = playerItem;
     SetIsPicked(playerItem.isActiveItem);
     gameObject.SetActive(true);
     image.sprite   = itemModel.GetItemSprite();
     levelText.text = playerItem.itemLevel.ToString();
 }