projectEli/Assets/Inventory System/Scripts/UI/InspectionWindowUI.cs

67 lines
1.7 KiB
C#
Raw Normal View History

2023-03-15 11:43:15 +00:00
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}";
}
2023-03-16 22:44:34 +00:00
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();
2023-03-15 11:43:15 +00:00
}
// Update is called once per frame
void Update()
{
}
}
}