MySys22.DialogueSystem
Document
1.0
Engine
0.5 BETA
Editor
0.5 BETA
Updated
2026-09-28

3. Presentation (IDialogueView)

3.1 Interface contract

Implementing the IDialogueView interface allows the default presentation to be replaced; once registration has occurred the engine no longer uses its own view. The interface exposes the following members, as implemented in the example of section 3.2: IsPanelVisible, SetPanelVisible(bool visible), ShowText(string speaker, string text), ShowText(string text), SetSpeaker(string speaker), SetText(string text), HideText(), HideChoices().

3.2 Implementation of a custom view

Example

using MySys22.Engine.API;

public class MyDialogueView : MonoBehaviour, IDialogueView
{
    [SerializeField] private GameObject panel;
    [SerializeField] private TMP_Text speakerLabel;
    [SerializeField] private TMP_Text textLabel;

    public bool IsPanelVisible => panel.activeSelf;

    public void SetPanelVisible(bool visible) => panel.SetActive(visible);
    public void ShowText(string speaker, string text) { speakerLabel.text = speaker; textLabel.text = text; }
    public void ShowText(string text) => ShowText(null, text);
    public void SetSpeaker(string speaker) => speakerLabel.text = speaker;
    public void SetText(string text) => textLabel.text = text;
    public void HideText() => textLabel.text = string.Empty;
    public void HideChoices() { /* destroy or hide the buttons */ }

    void Awake() => Dialogue.SetView(this);
}

3.3 View resolution rules

The engine imposes no obligations on the view. In the absence of a registered view, the engine uses DialogueUICanvas if present in the scene, otherwise DialogueOverlayUI.

3.4 EventSystem requirement

DialogueUICanvas and DialogueOverlayUI create an EventSystem if one is not present, since the choice buttons do not receive pointer events in its absence. A custom view based on uGUI buttons requires the presence of an EventSystem.