33 lines
749 B
C#
33 lines
749 B
C#
|
using UnityEngine;
|
|||
|
|
|||
|
namespace HK
|
|||
|
{
|
|||
|
public abstract class UIItemBase : MonoBehaviour
|
|||
|
{
|
|||
|
private GameObjectBinding _uiGameObjectBinding;
|
|||
|
|
|||
|
public Transform self => gameObject.transform;
|
|||
|
|
|||
|
public GameObjectBinding uiGameObjectBinding => _uiGameObjectBinding;
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
_uiGameObjectBinding = GetComponent<GameObjectBinding>();
|
|||
|
OnInit();
|
|||
|
}
|
|||
|
|
|||
|
internal T GetValue<T>(string name) where T : Component
|
|||
|
{
|
|||
|
return _uiGameObjectBinding.GetValue<T>(name);
|
|||
|
}
|
|||
|
|
|||
|
public virtual void OnInit()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public virtual void OnDispose()
|
|||
|
{
|
|||
|
GameObject.Destroy(this.gameObject);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|