using BrewMonster.UI;
using UnityEngine;
using UnityEngine.UI;
namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
{
public class AUIImagePictureBase : MonoBehaviour
{
[Header("AUIImagePicture(Need Refactor)")]
[SerializeField] protected int slotIndex = -1;
[SerializeField] protected CECShortcut pSC;
[SerializeField] protected Image disPlayImage;
// Hint/tooltip data storage
protected string m_hintText = string.Empty;
public int GetSlotIndex => slotIndex;
public virtual void Awake()
{
}
public virtual void SetDataPtr(CECShortcut pvData, string strName = null)
{
pSC = pvData;
}
public CECShortcut GetDataPtr() => pSC;
public void SetSlotIndex(int index)
{
slotIndex = index;
}
public virtual void SetImage(Sprite sprite)
{
if (disPlayImage == null)
{
Debug.LogError("Skill Image is not assigned in AUIImagePicture");
return;
}
disPlayImage.sprite = sprite;
disPlayImage.gameObject.SetActive(true);
}
public void SetColor(Color color)
{
if (disPlayImage != null)
{
disPlayImage.color = color;
}
}
///
/// Set hint/tooltip text that will be displayed when the skill icon is clicked.
/// This is typically the skill description with requirements.
///
/// The hint text to display
public void SetHint(string hint)
{
m_hintText = hint ?? string.Empty;
}
///
/// Get the stored hint/tooltip text.
///
/// The hint text or empty string if none set
public string GetHint()
{
return m_hintText;
}
public virtual void Clear()
{
pSC = null;
SetDataPtr(null);
if (disPlayImage != null)
{
disPlayImage.gameObject.SetActive(false);
}
m_hintText = string.Empty;
}
}
}