1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.EventSystems;
- using Sirenix.OdinInspector;
- namespace KairoEngine.UI.Tooltips
- {
- [HideMonoScript]
- 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();
- }
- }
- }
|