Files
Gen_Hack-and-Slash-Roguelit…/Client/Assets/Scripts/UI/ItemUI.cs

34 lines
723 B
C#
Raw Normal View History

2025-09-02 11:08:15 +08:00
using System;
2025-09-02 11:08:15 +08:00
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
2025-09-02 11:08:15 +08:00
namespace UI
{
2025-09-02 11:08:15 +08:00
public class ItemUI:MonoBehaviour
{
2025-09-02 11:08:15 +08:00
public Entity.InventorySlot inventorySlot;
public UIImageAnimator icon;
private void Start()
{
2025-09-02 11:08:15 +08:00
icon.gameObject.SetActive(false);
}
2025-09-02 11:08:15 +08:00
public void SetDisplayItem(Entity.InventorySlot slot)
{
2025-09-02 11:08:15 +08:00
inventorySlot = slot;
if (inventorySlot == null)
{
2025-09-02 11:08:15 +08:00
icon.gameObject.SetActive(false);
}
else
{
2025-09-02 11:08:15 +08:00
icon.gameObject.SetActive(true);
icon.SetSprites(inventorySlot.Item.Icon.ToArray());
}
}
}
}