Class UITKClientLauncher
Renders the launcher through a UI Toolkit UnityEngine.UIElements.UIDocument.
public class UITKClientLauncher : MonoBehaviour, ILauncherView
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKClientLauncher
- Implements
- 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
Deliberately a plain UnityEngine.MonoBehaviour rather than a UITKControl,
matching ClientLauncher itself, which is not a UIControl.
UITKControl exists to be a game UI panel: it registers with the static
UIManager in Awake, takes an injected Client, and responds to
quit-to-login. None of that applies before a Client exists, and registering the
launcher into a manager that outlives the launcher scene would leave a stale entry
behind across the handoff to post-boot.
Every setter records its value whether or not the visual tree has been built yet, and
the recorded state is re-applied in FishMMO.Client.UITKClientLauncher.OnEnable(). Component initialisation
order is not guaranteed, so ClientLauncher may well set the title before
this component's UIDocument has produced a root — without buffering, those early
calls would silently go nowhere and the launcher would come up blank.
Fields
Document
The UIDocument that owns the launcher's visual tree. Assign in the Inspector.
[Tooltip("UIDocument backing the launcher UI.")]
public UIDocument Document
Field Value
- UIDocument
Methods
ClearStatus()
Clears any status message so a stale error does not linger into a new state.
public void ClearStatus()
SetButtonAction(Action)
Replaces the primary button's click handler. Passing null clears it.
public void SetButtonAction(Action action)
Parameters
actionAction
Remarks
Implementations must replace rather than add. The state machine calls this on every transition, and an implementation that accumulated handlers would fire every action the launcher had ever been in.
SetButtonInteractable(bool)
Enables or disables interaction with the primary button.
public void SetButtonInteractable(bool interactable)
Parameters
interactablebool
SetButtonText(string)
Sets the label on the primary (Play/Connect/Update) button.
public void SetButtonText(string text)
Parameters
textstring
SetInstallSize(long?)
Reports how much disk space the installation occupies, or null when it could not be determined.
public void SetInstallSize(long? sizeBytes)
Parameters
sizeByteslong?
Remarks
Null is a real and expected outcome — a permission-restricted install directory, or a measurement that has not run yet. Views must show "unavailable" rather than "0 B", which would read as an empty installation.
SetNewsContent(HtmlNode)
Renders fetched news content into the news pane.
public void SetNewsContent(HtmlNode content)
Parameters
contentHtmlNodeRoot of the extracted news fragment.
Remarks
Takes the parsed node rather than a pre-formatted string because UI Toolkit's rich text has no equivalent of a link tag: a news link cannot be markup inside a label, it has to become a real element that can receive a click. Handing the view a formatted string would make that impossible, so the view walks the tree itself.
content is untrusted remote content. Implementations must bound
their traversal depth and must route any link activation through
LauncherLinkPolicy.
SetNewsMessage(string)
Displays plain text in the news pane, used for the loading placeholder and for fetch errors. Distinct from SetNewsContent(HtmlNode) because these messages are launcher-authored strings, not remote content.
public void SetNewsMessage(string message)
Parameters
messagestring
SetNewsVisible(bool)
Shows or hides the news pane.
public void SetNewsVisible(bool visible)
Parameters
visiblebool
Remarks
The launcher keeps the pane visible in every ordinary case and fills it with a built-in summary when there is no live feed — hiding it collapsed the panel into a header stacked directly on a footer, which reads as a broken window rather than as a launcher with no news today.
SetProgress(DownloadStats)
Reports the state of an in-progress download.
public void SetProgress(DownloadStats stats)
Parameters
statsDownloadStats
Remarks
Takes the whole snapshot rather than a progress fraction and a prepared string, so a view can present as much of it as it has room for. Use ToDisplayString() for the standard line unless there is a reason to differ — it already omits whatever is not yet known, which matters because a rate and a remaining time do not exist for the first second of any transfer.
SetProgressVisible(bool)
Shows or hides the progress bar. Hiding also resets progress to zero, so a later download never briefly displays the previous one's final value.
public void SetProgressVisible(bool visible)
Parameters
visiblebool
SetQuitAction(Action)
Sets the quit button's click handler. Called once during initialisation.
public void SetQuitAction(Action action)
Parameters
actionAction
SetTitle(string)
Sets the launcher window title (project name and version).
public void SetTitle(string title)
Parameters
titlestring
SetVisible(bool)
Shows or hides the entire launcher UI.
public void SetVisible(bool visible)
Parameters
visibleboolTrue to show the launcher, false to hide it.
Remarks
Called the moment the game scene is ready, before the launcher scene is unloaded. The unload is asynchronous and, in the editor, may not happen at all — the launcher scene is opened directly there rather than through Addressables, so the Addressables unload has no handle for it and silently does nothing. Hiding is synchronous and works either way, so the launcher cannot be left sitting behind the login screen.
ShowStatus(string)
Displays a human-readable status or error message to the player.
public void ShowStatus(string message)
Parameters
messagestring
Remarks
The implementation is responsible for ensuring the message is actually visible — including activating whatever container holds it. Writing to a deactivated element silently loses the message, which previously left players facing a two-word button label and no explanation.
Teardown()
Releases anything the view subscribed to. Called from the launcher's OnDestroy.
public void Teardown()
Remarks
Present because a view is not required to be a component with its own Unity lifecycle. A plain class owned by the launcher has no OnDestroy of its own, so something has to tell it when to let go. An implementation backed by a MonoBehaviour — UITKClientLauncher is one — may leave this empty and clean up in OnDestroy instead.