2025-09-03 19:59:22 +08:00
|
|
|
|
2025-08-28 16:20:24 +08:00
|
|
|
using System;
|
2025-09-03 19:59:22 +08:00
|
|
|
using System.Linq;
|
2025-08-27 19:56:49 +08:00
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
2025-09-03 19:59:22 +08:00
|
|
|
|
2025-08-27 19:56:49 +08:00
|
|
|
namespace UI
|
|
|
|
{
|
2025-09-03 19:59:22 +08:00
|
|
|
public class ItemUI:MonoBehaviour
|
2025-08-27 19:56:49 +08:00
|
|
|
{
|
2025-09-03 19:59:22 +08:00
|
|
|
public Entity.InventorySlot inventorySlot;
|
|
|
|
public UIImageAnimator icon;
|
2025-08-28 16:20:24 +08:00
|
|
|
|
2025-09-03 19:59:22 +08:00
|
|
|
private void Start()
|
2025-08-27 19:56:49 +08:00
|
|
|
{
|
2025-09-03 19:59:22 +08:00
|
|
|
icon.gameObject.SetActive(false);
|
2025-08-27 19:56:49 +08:00
|
|
|
}
|
|
|
|
|
2025-09-03 19:59:22 +08:00
|
|
|
public void SetDisplayItem(Entity.InventorySlot slot)
|
2025-08-27 19:56:49 +08:00
|
|
|
{
|
2025-09-03 19:59:22 +08:00
|
|
|
inventorySlot = slot;
|
|
|
|
if (inventorySlot == null)
|
2025-08-27 19:56:49 +08:00
|
|
|
{
|
2025-09-03 19:59:22 +08:00
|
|
|
icon.gameObject.SetActive(false);
|
2025-08-27 19:56:49 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2025-09-03 19:59:22 +08:00
|
|
|
icon.gameObject.SetActive(true);
|
|
|
|
icon.SetSprites(inventorySlot.Item.Icon.ToArray());
|
2025-08-27 19:56:49 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|