123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.EventSystems;
- namespace KairoEngine.UI.Tooltips
- {
- public class TooltipTrigger : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
- {
- private static LTDescr delay;
- public string header;
- public string content;
- public string tooltipType = "";
- public void OnPointerEnter(PointerEventData eventData)
- {
- if(MouseInputUIBlocker.BlockedByUI) return;
- if(string.IsNullOrEmpty(header) && string.IsNullOrEmpty(content)) return;
- delay = LeanTween.delayedCall(TooltipSystem.GetDelay(), () =>
- {
- TooltipSystem.Show(content, header, tooltipType);
- });
-
- }
- public void OnPointerExit(PointerEventData eventData)
- {
- if(delay != null) LeanTween.cancel(delay.uniqueId);
- TooltipSystem.Hide();
- }
- public void OnMouseEnter()
- {
- if(MouseInputUIBlocker.BlockedByUI) return;
- if(string.IsNullOrEmpty(header) && string.IsNullOrEmpty(content)) return;
- delay = LeanTween.delayedCall(TooltipSystem.GetDelay(), () =>
- {
- TooltipSystem.Show(content, header, tooltipType);
- });
-
- }
- public void OnMouseExit()
- {
- if(delay != null) LeanTween.cancel(delay.uniqueId);
- TooltipSystem.Hide();
- }
- }
- }
|