2025-11-17 16:56:03 +08:00
|
|
|
using OM.Animora.Runtime;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.EventSystems;
|
|
|
|
|
|
|
|
|
|
namespace OM.Animora.Demos
|
|
|
|
|
{
|
|
|
|
|
public class Demo3Button : MonoBehaviour,IPointerEnterHandler,IPointerExitHandler,IPointerClickHandler
|
|
|
|
|
{
|
|
|
|
|
[SerializeField] private AnimoraPlayer hoverAnimation;
|
|
|
|
|
[SerializeField] private AnimoraPlayer clickAnimation;
|
|
|
|
|
[SerializeField] private AnimoraPlayer releaseAnimation;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
|
|
|
{
|
|
|
|
|
clickAnimation?.StopAnimation();
|
|
|
|
|
releaseAnimation?.StopAnimation();
|
2025-11-17 20:29:03 +08:00
|
|
|
|
2025-11-17 16:56:03 +08:00
|
|
|
hoverAnimation?.PlayAnimation();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
|
|
|
{
|
|
|
|
|
hoverAnimation?.StopAnimation();
|
|
|
|
|
clickAnimation?.StopAnimation();
|
2025-11-17 20:29:03 +08:00
|
|
|
|
2025-11-17 16:56:03 +08:00
|
|
|
releaseAnimation?.PlayAnimation();
|
2025-11-17 20:29:03 +08:00
|
|
|
|
2025-11-17 16:56:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnPointerClick(PointerEventData eventData)
|
|
|
|
|
{
|
|
|
|
|
hoverAnimation?.StopAnimation();
|
|
|
|
|
releaseAnimation?.StopAnimation();
|
2025-11-17 20:29:03 +08:00
|
|
|
|
2025-11-17 16:56:03 +08:00
|
|
|
clickAnimation?.PlayAnimation();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|