Implement action bar.

This commit is contained in:
2023-11-23 18:03:55 +08:00
parent e9d0f4ce1a
commit 522699152b
8 changed files with 142 additions and 14 deletions

View File

@@ -0,0 +1,29 @@
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);
}
}
}