84 lines
2.3 KiB
C#
84 lines
2.3 KiB
C#
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 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;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Set hint/tooltip text that will be displayed when the skill icon is clicked.
|
|
/// This is typically the skill description with requirements.
|
|
/// </summary>
|
|
/// <param name="hint">The hint text to display</param>
|
|
public void SetHint(string hint)
|
|
{
|
|
m_hintText = hint ?? string.Empty;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the stored hint/tooltip text.
|
|
/// </summary>
|
|
/// <returns>The hint text or empty string if none set</returns>
|
|
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;
|
|
}
|
|
}
|
|
}
|