Class UITKNPCDialogue
UI Toolkit NPC dialogue panel. Receives server-authoritative dialogue state via broadcasts, renders the speaker, body text, and dynamic choice buttons, and sends the player's choice back to the server for validation.
public class UITKNPCDialogue : UITKCharacterControl
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKNPCDialogue
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.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.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.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.nameObject.hideFlags
Remarks
Content is written after Show, and again after a tree rebuild. A
UIDocument re-clones its UXML on every enable, so the speaker, body and choice
buttons written before Show() belonged to a tree that was discarded
microseconds later — the panel opened blank. The node arrives in a broadcast, is kept as
plain data, and is rendered from OnAfterShow() and
OnAfterStarting(). Both, because on a panel's first open hasStarted is
still false and the re-initialisation path bails out before OnAfterShow would help.
There is always a way out. A node whose choices have all been filtered away — every one already taken, every one's conditions unmet — used to render no buttons at all, and this panel has no close button of its own. The player was left with a dialogue box that could only be escaped, and escaping it left the session open on the server. A Leave button is added whenever no choice survives the filter, and closing the panel by any route tells the server the conversation is over.
Methods
Hide(bool)
Tells the server the conversation is over whenever this panel closes.
public override void Hide(bool overrideIsAlwaysOpen)
Parameters
overrideIsAlwaysOpenbool
Remarks
Escape, the close-on-escape registration and any other route through Hide all land here. Without it the server session outlived the panel, and every later dialogue message was validated against a conversation the player had walked away from.
OnAfterShow()
Renders the current node into the tree the player will actually see.
protected override void OnAfterShow()
OnAfterStarting()
Renders the current node again after the visual tree has been rebuilt.
protected override void OnAfterStarting()
OnClientSet()
Registers dialogue broadcast handlers when the client is set.
public override void OnClientSet()
OnClientUnset()
Unregisters dialogue broadcast handlers when the client is unset.
public override void OnClientUnset()
OnDestroying()
Clears dialogue state when the control is destroyed.
public override void OnDestroying()
OnStarting()
Queries the speaker, text, and choices elements.
public override void OnStarting()