it works!!!
currently waits for 400 frames regardless of fps, should probably be changed in the future but it works well enough rn
This commit is contained in:
parent
32eed3d283
commit
a76e06271f
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue