53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
|
|
using UnityEngine;
|
|
using TMPro;
|
|
|
|
namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
|
|
{
|
|
public class AUIImageHPMPItem : AUIImagePicture
|
|
{
|
|
[SerializeField] TMP_Text m_TextAmount;
|
|
private int _lastTemplateId = int.MinValue;
|
|
private int _lastCount = int.MinValue;
|
|
|
|
public bool TrySetTemplateId(int templateId)
|
|
{
|
|
if (_lastTemplateId == templateId)
|
|
return false;
|
|
_lastTemplateId = templateId;
|
|
return true;
|
|
}
|
|
|
|
public bool TrySetCount(int count)
|
|
{
|
|
if (_lastCount == count)
|
|
return false;
|
|
_lastCount = count;
|
|
return true;
|
|
}
|
|
|
|
public void ResetRenderCache()
|
|
{
|
|
_lastTemplateId = int.MinValue;
|
|
_lastCount = int.MinValue;
|
|
}
|
|
public void SetText(string text)
|
|
{
|
|
if(m_TextAmount != null)
|
|
m_TextAmount.text = text;
|
|
}
|
|
|
|
/// <summary>
|
|
/// HP/MP item button should only execute its assigned shortcut.
|
|
/// It must NOT open the assign-skill UI when empty.
|
|
/// </summary>
|
|
public override void Execute()
|
|
{
|
|
if (pSC != null)
|
|
{
|
|
pSC.Execute();
|
|
}
|
|
}
|
|
}
|
|
}
|