projectEli/Assets/Inventory System/Scripts/UI/InspectionWindowUI.cs
2023-03-16 15:44:34 -07:00

67 lines
1.7 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
namespace SimpleInventorySystem
{
public class InspectionWindowUI : WindowUI
{
public TextMeshProUGUI categoryText;
public TextMeshProUGUI WeightText;
public Button DropButton;
public GameObject ItemTraitPrefab;
public TextMeshProUGUI ShortDescriptionText;
// Start is called before the first frame update
void Start()
{
if (dragWindowUI != null)
{
dragWindowUI.title.text = ItemUI.itemName;
}
if(categoryText != null)
{
categoryText.text = $"{ItemUI.category} > {ItemUI.subCategory}";
}
if (WeightText != null)
{
WeightText.text = $"{ItemUI.weight} Lbs";
}
if(ShortDescriptionText != null)
{
ShortDescriptionText.text = $"{ItemUI.shortDescription}";
}
if (DropButton != null)
{
DropButton.onClick.AddListener(DropItem);
}
}
public void DropItem()
{
Debug.Log("Drop");
if (ItemUI != null)
{
ItemUI.DropItemAway();
CloseInspectionWindow();
}
}
public void CloseInspectionWindow()
{
if (DropButton != null)
{
DropButton.onClick.RemoveListener(DropItem);
}
dragWindowUI.CloseWindow();
}
// Update is called once per frame
void Update()
{
}
}
}