Skip to main content

Class DialogueMsgResponse

Responds to incoming DialogueEntry messages by displaying them in a chat-like message panel UI. Supports displaying owned (speaker) and received messages, as well as thought messages with separate prefabs. Utilizes object pooling for message presenters to optimize performance.

[RequireComponent(typeof(TypewriterActor))]
public class DialogueMsgResponse : MonoBehaviour, IEntryResponser<DialogueEntry>, IEntryResponser

Inheritance​

Implements​

Fields​

ownedDialoguePrefab​

Prefab used for owned (speaker) dialogue messages.

[Header("Dialogue Message Prefabs")]
[Tooltip("Prefab for dialogue messages from the actor (owner).")]
[FormerlySerializedAs("Dialogue_Msg_OwnedPrefab")]
public MsgPresenter ownedDialoguePrefab

Field Value​

MsgPresenter

ownedThoughtPrefab​

Prefab used for owned (speaker) thought messages.

[Header("Thought Message Prefabs")]
[Tooltip("Prefab for thought messages from the actor (owner).")]
[FormerlySerializedAs("Thought_Msg_OwnedPrefab")]
public MsgPresenter ownedThoughtPrefab

Field Value​

MsgPresenter

receivedDialoguePrefab​

Prefab used for dialogue messages received from other actors.

[Tooltip("Prefab for dialogue messages received from other actors.")]
[FormerlySerializedAs("Dialogue_Msg_ReceivedPrefab")]
public MsgPresenter receivedDialoguePrefab

Field Value​

MsgPresenter

receivedThoughtPrefab​

Prefab used for thought messages received from other actors.

[Tooltip("Prefab for thought messages received from other actors.")]
[FormerlySerializedAs("Thought_Msg_ReceivedPrefab")]
public MsgPresenter receivedThoughtPrefab

Field Value​

MsgPresenter

Methods​

HandleEntry(BaseEntry, ITypewriterContext)​

Handles an incoming typewriter BaseEntry.

public void HandleEntry(BaseEntry entry, ITypewriterContext context)

Parameters​

NameTypeDescription
entryBaseEntryThe typewriter entry that this responder will process.
contextITypewriterContextThe context instance providing access to blackboards and runtime data shared with other entries in the same scope.

HandleEntry(DialogueEntry, ITypewriterContext)​

Handles an incoming DialogueEntry by selecting the appropriate prefab based on whether the message is a thought or dialogue, and whether it was spoken by the owner or another actor. Retrieves a message presenter from the pool, initializes it with the entry and context, and releases it back to the pool upon completion.

public void HandleEntry(DialogueEntry entry, ITypewriterContext context)

Parameters​

NameTypeDescription
entryDialogueEntryThe dialogue entry to be displayed.
contextITypewriterContextThe current typewriter context providing shared data.
  • Fields
    • ownedDialoguePrefab
    • ownedThoughtPrefab
    • receivedDialoguePrefab
    • receivedThoughtPrefab
  • Methods
    • HandleEntry(BaseEntry, ITypewriterContext)
    • HandleEntry(DialogueEntry, ITypewriterContext)