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
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
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
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
Methods
HandleEntry(BaseEntry, ITypewriterContext)
Handles an incoming typewriter BaseEntry.
public void HandleEntry(BaseEntry entry, ITypewriterContext context)
Parameters
| Name | Type | Description |
|---|---|---|
entry | BaseEntry | The typewriter entry that this responder will process. |
context | ITypewriterContext | The 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
| Name | Type | Description |
|---|---|---|
entry | DialogueEntry | The dialogue entry to be displayed. |
context | ITypewriterContext | The current typewriter context providing shared data. |