2025-06-13 17:10:58 +09:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.EventSystems;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
2025-06-16 19:30:01 +09:00
|
|
|
|
namespace UVC.UI.Tooltip
|
2025-06-13 17:10:58 +09:00
|
|
|
|
{
|
|
|
|
|
|
public class TooltipHandler : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
|
|
|
|
|
{
|
|
|
|
|
|
public System.Action<string, Vector3> OnPointerEnterAction; // 툴팁 내용(키), 마우스 위치
|
|
|
|
|
|
public System.Action OnPointerExitAction;
|
2025-06-16 19:30:01 +09:00
|
|
|
|
public string Tooltip { get; set; }
|
2025-06-13 17:10:58 +09:00
|
|
|
|
|
|
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
|
|
|
|
{
|
2025-06-16 19:30:01 +09:00
|
|
|
|
if (!string.IsNullOrEmpty(Tooltip) && gameObject.GetComponent<Selectable>()?.interactable == true) // 버튼이 활성화 상태일 때만
|
2025-06-13 17:10:58 +09:00
|
|
|
|
{
|
2025-06-16 19:30:01 +09:00
|
|
|
|
OnPointerEnterAction?.Invoke(Tooltip, Input.mousePosition);
|
2025-06-13 17:10:58 +09:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnPointerExitAction?.Invoke();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|