|
@@ -4,6 +4,7 @@ using UnityEngine;
|
|
|
using UnityEngine.UI;
|
|
|
using UnityEngine.EventSystems;
|
|
|
using Sirenix.OdinInspector;
|
|
|
+using KairoEngine.Core;
|
|
|
|
|
|
namespace KairoEngine.UI.Tooltips
|
|
|
{
|
|
@@ -14,6 +15,7 @@ namespace KairoEngine.UI.Tooltips
|
|
|
public string header;
|
|
|
public string content;
|
|
|
public string tooltipType = "";
|
|
|
+ private bool visible = false;
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
|
{
|
|
|
if(MouseInputUIBlocker.BlockedByUI) return;
|
|
@@ -21,6 +23,8 @@ namespace KairoEngine.UI.Tooltips
|
|
|
delay = LeanTween.delayedCall(TooltipSystem.GetDelay(), () =>
|
|
|
{
|
|
|
TooltipSystem.Show(content, header, tooltipType);
|
|
|
+ visible = true;
|
|
|
+ CheckTooltip();
|
|
|
});
|
|
|
|
|
|
}
|
|
@@ -29,6 +33,7 @@ namespace KairoEngine.UI.Tooltips
|
|
|
{
|
|
|
if(delay != null) LeanTween.cancel(delay.uniqueId);
|
|
|
TooltipSystem.Hide();
|
|
|
+ visible = false;
|
|
|
}
|
|
|
|
|
|
public void OnMouseEnter()
|
|
@@ -38,6 +43,8 @@ namespace KairoEngine.UI.Tooltips
|
|
|
delay = LeanTween.delayedCall(TooltipSystem.GetDelay(), () =>
|
|
|
{
|
|
|
TooltipSystem.Show(content, header, tooltipType);
|
|
|
+ visible = true;
|
|
|
+ CheckTooltip();
|
|
|
});
|
|
|
|
|
|
}
|
|
@@ -46,6 +53,37 @@ namespace KairoEngine.UI.Tooltips
|
|
|
{
|
|
|
if(delay != null) LeanTween.cancel(delay.uniqueId);
|
|
|
TooltipSystem.Hide();
|
|
|
+ visible = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CheckTooltip()
|
|
|
+ {
|
|
|
+ TooltipTrigger t = this;
|
|
|
+ if(t.visible == false) return;
|
|
|
+ Timer.ExecuteRealTime(500, () => {
|
|
|
+ if(t == null)
|
|
|
+ {
|
|
|
+ TooltipSystem.Hide();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(t.gameObject == null)
|
|
|
+ {
|
|
|
+ t.visible = false;
|
|
|
+ TooltipSystem.Hide();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(!t.gameObject.activeSelf)
|
|
|
+ {
|
|
|
+ t.visible = false;
|
|
|
+ TooltipSystem.Hide();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(t.gameObject.activeSelf && t.visible == true)
|
|
|
+ {
|
|
|
+ CheckTooltip();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
}
|