From a76e06271f613e0a98f9c274e34ecaaf45206072 Mon Sep 17 00:00:00 2001 From: Zeo <67521686+ThatZeoGal@users.noreply.github.com> Date: Sun, 21 Apr 2024 13:58:54 -0500 Subject: [PATCH] it works!!! currently waits for 400 frames regardless of fps, should probably be changed in the future but it works well enough rn --- .../Prefabs/GameView/GameTex.renderTexture | 4 +-- .../Prefabs/GameView/OverlayTex.renderTexture | 4 +-- Assets/Scenes/Editor.unity | 12 ++++---- Assets/Scripts/LevelEditor/Tooltip.cs | 29 ++++++++++++++++++- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/Assets/Resources/Prefabs/GameView/GameTex.renderTexture b/Assets/Resources/Prefabs/GameView/GameTex.renderTexture index 8c4b7c141..5ea586cec 100644 --- a/Assets/Resources/Prefabs/GameView/GameTex.renderTexture +++ b/Assets/Resources/Prefabs/GameView/GameTex.renderTexture @@ -14,8 +14,8 @@ RenderTexture: m_DownscaleFallback: 0 m_IsAlphaChannelOptional: 0 serializedVersion: 5 - m_Width: 1057 - m_Height: 595 + m_Width: 1249 + m_Height: 703 m_AntiAliasing: 2 m_MipCount: -1 m_DepthStencilFormat: 92 diff --git a/Assets/Resources/Prefabs/GameView/OverlayTex.renderTexture b/Assets/Resources/Prefabs/GameView/OverlayTex.renderTexture index 0adc9aee6..90af6dee6 100644 --- a/Assets/Resources/Prefabs/GameView/OverlayTex.renderTexture +++ b/Assets/Resources/Prefabs/GameView/OverlayTex.renderTexture @@ -14,8 +14,8 @@ RenderTexture: m_DownscaleFallback: 0 m_IsAlphaChannelOptional: 0 serializedVersion: 5 - m_Width: 1585 - m_Height: 892 + m_Width: 1873 + m_Height: 1054 m_AntiAliasing: 1 m_MipCount: -1 m_DepthStencilFormat: 92 diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index 94da93bb5..410667920 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -13155,7 +13155,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 171581557} m_HandleRect: {fileID: 171581556} m_Direction: 2 - m_Value: 0 + m_Value: 1 m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: @@ -25415,7 +25415,7 @@ MonoBehaviour: m_HandleRect: {fileID: 1589389271} m_Direction: 2 m_Value: 1 - m_Size: 1 + m_Size: 0.99995804 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -30235,6 +30235,8 @@ MonoBehaviour: background: {fileID: 1585542810} text: {fileID: 151438065} group: {fileID: 1090036112} + timer: 0 + timerActive: 0 --- !u!225 &1090036112 CanvasGroup: m_ObjectHideFlags: 0 @@ -31578,7 +31580,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: 0, y: 199.06123} + m_AnchoredPosition: {x: 0, y: 122.12238} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!222 &1154875945 @@ -41324,8 +41326,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1220118245} m_HandleRect: {fileID: 1220118244} m_Direction: 2 - m_Value: 1 - m_Size: 1 + m_Value: 1.0000005 + m_Size: 0.61358607 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: diff --git a/Assets/Scripts/LevelEditor/Tooltip.cs b/Assets/Scripts/LevelEditor/Tooltip.cs index 4042057b1..9e7625076 100644 --- a/Assets/Scripts/LevelEditor/Tooltip.cs +++ b/Assets/Scripts/LevelEditor/Tooltip.cs @@ -15,6 +15,8 @@ namespace HeavenStudio.Editor [SerializeField] private RectTransform background; [SerializeField] private TMP_Text text; [SerializeField] private CanvasGroup group; + [SerializeField] private int timer = 0; + [SerializeField] private bool timerActive = false; public static Tooltip instance { get; private set; } @@ -27,6 +29,14 @@ namespace HeavenStudio.Editor private void Update() { + if (timerActive) + { + timer++; + if (timer >= 400) + { + group.alpha = 1; + } + } Vector3 anchoredPosition = Input.mousePosition; Camera camera = Editor.instance.EditorCamera; Vector3 canvasScale = Editor.instance.MainCanvas.transform.localScale; @@ -73,6 +83,8 @@ namespace HeavenStudio.Editor Vector2 textSize; Vector2 paddingSize; + // tooltip types: 0 = only corner, 1 = delayed on mouse, 2 = instant on mouse + // idk the best place to put this comment so i'm putting it everywhere lmao switch (type) { case 0: @@ -87,8 +99,21 @@ namespace HeavenStudio.Editor background.sizeDelta = textSize + paddingSize; Editor.instance.tooltipText.text = altTooltipText.Replace("\n", ""); Editor.instance.tooltipText.ForceMeshUpdate(); - return; + break; case 1: + group.alpha = 0; + + text.text = tooltipText; + text.ForceMeshUpdate(); + + textSize = text.GetRenderedValues(false); + paddingSize = new Vector2(8, 8); + + background.sizeDelta = textSize + paddingSize; + Editor.instance.tooltipText.text = altTooltipText.Replace("\n", ""); + Editor.instance.tooltipText.ForceMeshUpdate(); + + timerActive = true; break; case 2: group.alpha = 1; @@ -109,6 +134,8 @@ namespace HeavenStudio.Editor private void OnExitPrivate() { group.alpha = 0; + timerActive = false; + timer = 0; } private void SetText(string tooltipText)