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
| Name | Parameters | Return Type | Description |
|---|---|---|---|
| Initialize | N/A | DialogueUiRuntimeContext | Instantiates the UI prefabs and configures Canvas and views. Returns the existing context if already valid. |
| GetContext | N/A | DialogueUiRuntimeContext | Returns the current runtime UI context, initializing it first if necessary. |
| GetModuleDefaultTheme | N/A | DialogueUiTheme | Returns the default theme configured in module settings. |
| GetActiveTheme | N/A | IDialogueUiTheme | Returns the theme currently applied, falling back to the module default. |
| ApplyTheme | DialogueUiTheme theme = null | void | Applies a theme to the prompt and panel views. Passing null re-applies the module default. |
| RefreshTheme | N/A | void | Re-applies the current theme (useful after settings changes). |
| Clear | N/A | void | Destroys 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.
| Name | Type | Description |
|---|---|---|
| PromptCanvas | Canvas | The Canvas holding the interact prompt. |
| PromptView | DialoguePromptView | The interact prompt shown when targeting an NPC. |
| ChatCanvas | Canvas | The Canvas holding the conversation panel. |
| ChatSystemService | ChatSystemService | The chat runtime instantiated with the UI. |
| PanelView | DialoguePanelView | The main dialogue panel containing speech and options. |
The active theme is not held on the context -- read it with GetActiveTheme().