30 lines
687 B
C#
30 lines
687 B
C#
using Cryville.Crtr.Browsing.Actions;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
namespace Cryville.Crtr.Browsing.UI {
|
|
internal class ActionButton : MonoBehaviour, IPointerClickHandler {
|
|
[SerializeField]
|
|
TextMeshProUGUI m_text;
|
|
|
|
ResourceBrowser _browser;
|
|
IResourceAction _action;
|
|
|
|
public void Load(ResourceBrowser browser, IResourceAction action) {
|
|
gameObject.SetActive(true);
|
|
_browser = browser;
|
|
_action = action;
|
|
m_text.text = action.Name;
|
|
}
|
|
public void Clear() {
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
public void OnPointerClick(PointerEventData eventData) {
|
|
if (_action == null) return;
|
|
_browser.InvokeAction(_action);
|
|
}
|
|
}
|
|
}
|