Sell started
This commit is contained in:
@@ -22,4 +22,8 @@ public class InventoryEntry{
|
||||
Item = item;
|
||||
Count = count;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Inventory{
|
||||
|
||||
}
|
||||
48
Assets/Game/Scripts/SellMenu.cs
Normal file
48
Assets/Game/Scripts/SellMenu.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
public class SellMenu : MonoBehaviour
|
||||
{
|
||||
[Header("Labels")]
|
||||
public TMP_Text usernameTxt;
|
||||
public TMP_Text coinsTxt;
|
||||
public TMP_Text gemsTxt;
|
||||
|
||||
[Header("Content")]
|
||||
public Transform inventoryParent;
|
||||
public Sprite emptySlotImage;
|
||||
void Start()
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Refresh(){
|
||||
usernameTxt.text = DBmanager.username;
|
||||
coinsTxt.text = DBmanager.Coins.ToString();
|
||||
gemsTxt.text = DBmanager.Gems.ToString();
|
||||
|
||||
Button[] inventorySlots = inventoryParent.GetComponentsInChildren<Button>();
|
||||
|
||||
if(inventorySlots.Length < DBmanager.Inventory.Count){
|
||||
Debug.LogError("NEED MORE SLOTS!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i =0; i < inventorySlots.Length; i++){
|
||||
if(i < DBmanager.Inventory.Count){
|
||||
inventorySlots[i].GetComponent<Image>().sprite =emptySlotImage;
|
||||
}else{
|
||||
inventorySlots[i].GetComponent<Image>().sprite = emptySlotImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Game/Scripts/SellMenu.cs.meta
Normal file
11
Assets/Game/Scripts/SellMenu.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a80dbd35a60f02048aaf7c3b7bf19bc3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user