76 lines
1.8 KiB
C#
76 lines
1.8 KiB
C#
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;
|
|
|
|
[Header("Your Request Material Setter")]
|
|
public GameObject yourReqPopup;
|
|
public TMP_InputField coinsInput;
|
|
public TMP_InputField gemsInput;
|
|
public TMP_InputField oxygenInput;
|
|
public TMP_InputField metalInput;
|
|
public int coinsAmount;
|
|
public int gemsAmount;
|
|
public int oxygenAmount;
|
|
public int metalAmount;
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ShowMaterialAmountSetter(){
|
|
|
|
}
|
|
|
|
public void CloseSellMenu(){
|
|
gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
|
|
public void Clear(){
|
|
metalAmount = coinsAmount = oxygenAmount = gemsAmount = 0;
|
|
// selected
|
|
Refresh();
|
|
}
|
|
}
|