Inventory implemented

This commit is contained in:
2022-05-18 14:51:42 +05:30
31 changed files with 2265 additions and 1045 deletions

View File

@@ -5,7 +5,7 @@ using TMPro;
using UnityEngine.UI;
public class ItemShop : MonoBehaviour
{
public ShopItemData selectedItem;
public InventoryItem selectedItem;
public Image itemImage;
public TMP_Text itemTxt;
@@ -21,7 +21,7 @@ public class ItemShop : MonoBehaviour
SelectShopItem(selectedItem);
}
public void SelectShopItem(ShopItemData selected){
public void SelectShopItem(InventoryItem selected){
selectedItem = selected;
if(selectedItem==null){Debug.LogError("Null shop item selected, Please check this"); return;}
@@ -44,6 +44,7 @@ public class ItemShop : MonoBehaviour
buyBtn.interactable=false;
await DBmanager.SetCoins(DBmanager.Coins - selectedItem.price);
DBmanager.SetGems(DBmanager.Gems- selectedItem.gems);
DBmanager.AddInventoryItem(selectedItem);
SelectShopItem(selectedItem);
}
}