Squashed commit of the following:

commit af4dab5546
Author: AbstractConcept <abstract.concept@mail.com>
Date:   Mon Oct 31 19:58:41 2022 -0500

    Code refactor

commit e14a12f2ab
Author: AbstractConcept <abstract.concept@mail.com>
Date:   Mon Oct 31 00:44:53 2022 -0500

    Code refactor

commit 5ca7e486f8
Author: AbstractConcept <abstract.concept@mail.com>
Date:   Fri Oct 28 19:52:58 2022 -0500

    Code refactor

commit a55ba7b95b
Author: AbstractConcept <abstract.concept@mail.com>
Date:   Fri Oct 28 00:28:51 2022 -0500

    Code refactor

commit 757badf4f6
Author: AbstractConcept <abstract.concept@mail.com>
Date:   Thu Oct 27 00:56:04 2022 -0500

    Code refactor
This commit is contained in:
AbstractConcept 2022-10-31 20:00:38 -05:00
parent cd4711a8e5
commit bb2cc29393
603 changed files with 9200 additions and 7528 deletions

View file

@ -1,82 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace RimWorldAnimationStudio
{
public class Tooltip : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
public string message = "Undefined";
public string executedCommand;
public float delay = 0f;
public Vector2 offset = new Vector2(5f, -15f);
public bool flipX = false;
private GameObject tooltip;
private Text tooltipText;
private bool isActive;
private bool isDisplayed;
private float activeTime = -1f;
public void Start()
{
tooltip = Workspace.Instance.transform.Find("TooltipMessage")?.gameObject;
tooltipText = tooltip?.GetComponentInChildren<Text>();
}
public void Update()
{
if (tooltip == null || isActive == false || (activeTime + delay) > Time.unscaledTime) return;
if (isDisplayed == false)
{
tooltip.GetComponent<RectTransform>().pivot = flipX ? new Vector2(1, 1) : new Vector2(0, 1);
tooltipText.text = message;
if (executedCommand != null && executedCommand != "")
{ tooltipText.text += " (" + KeybindConfig.GetKeybindLabel(executedCommand) + ")"; }
tooltip.transform.position = (Vector2)transform.position + offset;
tooltip.gameObject.SetActive(true);
LayoutRebuilder.ForceRebuildLayoutImmediate(tooltip.GetComponent<RectTransform>());
isDisplayed = true;
}
}
public void OnDisable()
{
if (isActive)
{ OnPointerExit(new PointerEventData(EventSystem.current)); }
}
public void OnPointerEnter(PointerEventData pointerEventData)
{
isActive = true;
activeTime = Time.unscaledTime;
}
public void OnPointerExit(PointerEventData pointerEventData)
{
isActive = false;
isDisplayed = false;
tooltip.gameObject.SetActive(false);
}
public void CalculateLayoutInputHorizontal()
{
throw new NotImplementedException();
}
public void CalculateLayoutInputVertical()
{
throw new NotImplementedException();
}
}
}