Table of Contents

Class UITKTooltip

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

UI Toolkit tooltip control. Displays a text box near the mouse cursor and keeps it inside the panel.

public class UITKTooltip : UITKControl
Inheritance
Object
Component
Behaviour
MonoBehaviour
UITKTooltip
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.didStart
MonoBehaviour.didAwake
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.GetComponentIndex()
Component.CompareTag(TagHandle)
Component.transform
Component.transformHandle
Component.gameObject
Component.tag
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags

Remarks

The tooltip is one shared panel that every hoverable element in the game opens, and it has no idea what it is describing. That is what made it stick: the row under the pointer is destroyed by a container refresh, or its whole panel is closed, or the scene changes, and nothing ever sent the matching Hide — so a tooltip for an item that no longer exists stayed on screen following the cursor around.

The fix is an owner. Open(string, VisualElement) records the element the tooltip belongs to and the tooltip closes itself the moment that element stops being a live, displayed part of a panel. HideFor(VisualElement) lets a caller close only its own tooltip, so a stale PointerLeave from a row the player has already moved off cannot close the tooltip that a different row has since opened.

Properties

Layer

Draw order tier for this panel. See UITKPanelLayer.

protected override UITKPanelLayer Layer { get; }

Property Value

UITKPanelLayer

Methods

Hide(bool)

Clears the owner whenever the tooltip is hidden, however it was hidden.

public override void Hide(bool overrideIsAlwaysOpen)

Parameters

overrideIsAlwaysOpen bool

When true, the call is a no-op.

HideFor(VisualElement)

Closes the tooltip only if it is currently showing for owner.

public void HideFor(VisualElement owner)

Parameters

owner VisualElement

The element whose tooltip should be closed. When null, or when it is an ancestor of the current owner, the tooltip closes.

OnAfterShow()

Writes the pending text into the live tree once the document has finished cloning.

protected override void OnAfterShow()

OnAfterStarting()

Re-applies the tooltip text after a visual tree rebuild.

protected override void OnAfterStarting()

OnClientSet()

Subscribes to scene changes so a tooltip cannot survive one.

public override void OnClientSet()

Remarks

A world scene unload destroys everything the tooltip could be describing, and the hover that opened it never gets its matching PointerLeave.

OnDestroying()

Drops the scene subscription.

public override void OnDestroying()

OnQuitToLogin()

Closes the tooltip when the client quits to the login screen.

public override void OnQuitToLogin()

OnStarting()

Resolves cached elements and prepares the tooltip for absolute positioning.

public override void OnStarting()

OnTick()

Repositions the tooltip to follow the mouse and closes it when its owner goes away.

protected override void OnTick()

Remarks

An override rather than a private void Update. Unity binds only the most-derived Update, so declaring one here silently disabled UITKControl.Update — and with it the focus polling every panel relies on.

Open(string)

Opens the tooltip with the specified text and shows it near the cursor.

public void Open(string text)

Parameters

text string

Text to display in the tooltip.

Open(string, VisualElement)

Opens the tooltip for a specific element, closing it automatically when that element is removed, hidden or destroyed.

public void Open(string text, VisualElement owner)

Parameters

text string

Text to display in the tooltip.

owner VisualElement

The element being described. May be null.