Skip to main content

Dialogue UI Service

Description

A static service that builds the dialogue UI at runtime. It instantiates the prompt and chat system prefabs from Resources/DIALOGUE-SYSTEM/UI/, resolves the Canvas and View components inside them, applies the CanvasScaler settings from module settings, binds the panel to ChatSystemService, and applies the module's default theme.

The prefab paths are fixed; what module settings contribute is the reference resolution, the match-width-or-height value, and the default theme. See UI and Theming.

Interface

Type
DialogueUiService

A static class. Everything below is a static member.

Static Methods

NameParametersReturn TypeDescription
InitializeN/ADialogueUiRuntimeContextInstantiates the UI prefabs and configures Canvas and views. Returns the existing context if already valid.
GetContextN/ADialogueUiRuntimeContextReturns the current runtime UI context, initializing it first if necessary.
GetModuleDefaultThemeN/ADialogueUiThemeReturns the default theme configured in module settings.
GetActiveThemeN/AIDialogueUiThemeReturns the theme currently applied, falling back to the module default.
ApplyThemeDialogueUiTheme theme = nullvoidApplies a theme to the prompt and panel views. Passing null re-applies the module default.
RefreshThemeN/AvoidRe-applies the current theme (useful after settings changes).
ClearN/AvoidDestroys instantiated UI and clears the runtime context.

Initialize returns null and logs a warning if module settings are unavailable, if the prefabs cannot be found, or if the expected components are missing from them.

DialogueUiRuntimeContext

The runtime context returned by GetContext(). All members are read-only properties.

NameTypeDescription
PromptCanvasCanvasThe Canvas holding the interact prompt.
PromptViewDialoguePromptViewThe interact prompt shown when targeting an NPC.
ChatCanvasCanvasThe Canvas holding the conversation panel.
ChatSystemServiceChatSystemServiceThe chat runtime instantiated with the UI.
PanelViewDialoguePanelViewThe main dialogue panel containing speech and options.

The active theme is not held on the context -- read it with GetActiveTheme().