Class UITKPetControl
UI Toolkit pet control panel. Shows the pet's name and health, and issues follow/stay/summon/release commands.
public class UITKPetControl : UITKCharacterControl
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKPetControl
- 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
The pet's health is a live value, so this panel subscribes to the pet's health attribute rather than sampling it once at summon time. It previously read the attribute exactly twice — on summon and on character set — and then never again, so the bar showed the pet's health at the moment it appeared for the pet's whole life.
The fill fraction was also inverted (FinalValue / CurrentValue), which reads as a
full bar at any health at all and an over-full one below half, and the name block set the
GUILD label active inside a check on the NAME label.
Properties
Layer
Draw order tier for this panel. See UITKPanelLayer.
protected override UITKPanelLayer Layer { get; }
Property Value
Methods
OnAfterShow()
Called at the end of Show(), against the tree the player will actually see. Override to write content that changes from one opening to the next.
protected override void OnAfterShow()
Remarks
This exists because "set the text, then Show" does not work and fails silently. UnityEngine.UIElements.UIDocument clones the UXML on enable, so a panel that fills in its message, list rows or icon before calling Show() writes into a tree that is thrown away microseconds later, and the player sees whatever the UXML declares — an empty dialog, a blank tooltip, a selector with no rows.
Distinct from OnAfterStarting(), which re-applies state after the tree is rebuilt. This one runs on every show, rebuilt tree or not.
OnAfterStarting()
Re-applies the character once the visual tree exists.
protected override void OnAfterStarting()
Remarks
World entry calls FishMMO.Client.UIManager.SetCharacter(FishMMO.Shared.Core.IPlayerCharacter) for every control at once, and
a control that starts hidden has no visual tree until something shows it — so
OnPostSetCharacter() can run before OnStarting has cached any
elements. Overrides that write into those elements would then dereference null, and
even a null-safe one would leave the panel showing nothing, because the only call
that had data already happened. Running it again here is what makes the two orders
equivalent.
OnAttackWithPet()
Orders the pet to attack the player's current target.
public void OnAttackWithPet()
Remarks
The target is not sent: the server reads the player's own target controller, so the client cannot nominate something it is not actually targeting.
OnDestroying()
Releases the static pet subscriptions and the pet health subscription.
public override void OnDestroying()
OnFollowPet()
Sends a follow command to the pet.
public void OnFollowPet()
OnPostSetCharacter()
Binds the panel to whatever pet the character already has.
public override void OnPostSetCharacter()
OnPreSetCharacter()
Releases the outgoing character's pet binding before a new character is applied.
public override void OnPreSetCharacter()
OnPreUnsetCharacter()
Releases the pet binding and resets the panel.
public override void OnPreUnsetCharacter()
OnReleasePet()
Sends a release command to the pet.
public void OnReleasePet()
OnStanceAggressive()
Requests the aggressive stance.
public void OnStanceAggressive()
OnStanceDefensive()
Requests the defensive stance.
public void OnStanceDefensive()
OnStancePassive()
Requests the passive stance.
public void OnStancePassive()
OnStarting()
Queries elements and wires up the command buttons.
public override void OnStarting()
OnStayPet()
Sends a stay command to the pet.
public void OnStayPet()
OnSummonPet()
Sends a summon command to the pet.
public void OnSummonPet()
PetController_OnPetDestroyed()
Hides the panel when the pet is destroyed.
public void PetController_OnPetDestroyed()
PetController_OnPetOrdersChanged(Pet)
Refreshes the panel when the server confirms a stance or movement order change.
public void PetController_OnPetOrdersChanged(Pet pet)
Parameters
petPetThe pet whose orders changed.
PetController_OnPetSummoned(Pet)
Updates the panel when a pet is summoned and makes it visible.
public void PetController_OnPetSummoned(Pet pet)
Parameters
petPetThe summoned pet.