using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace SoftKitty
{
///
/// This module displays short hint text in a small floating window, useful when the mouse hovers over buttons or icons. To use this module, simply add the component to any UI element and fill in the hint text.
///
public class HintManager : MonoBehaviour
{
#region Variables
private static HintManager instance;
public RectTransform Rect;
public Text TextContent;
public CanvasGroup HintBg;
private float hintTime = 0F;
private HintText hintScript;
#endregion
#region Internal Methods
public void _showHint(string _text, HintText _hintScript)
{
TextContent.text = _text;
hintScript = _hintScript;
hintTime = 2F;
}
private void Update()
{
if (hintTime > 0F)
{
hintTime -= Time.unscaledDeltaTime;
if (!HintBg.gameObject.activeSelf) HintBg.gameObject.SetActive(true);
HintBg.alpha = Mathf.Clamp01(hintTime * 4F);
HintBg.GetComponent().sizeDelta = new Vector2(TextContent.rectTransform.sizeDelta.x + 50F, 35F);
if (!hintScript.GetHover())
{
hintTime = Mathf.Min(hintTime, 0.25F);
}
else
{
HintBg.GetComponent().position = TransferPos(MousePositionWithinScreenRect(), Rect, GetComponentInParent