Skip to main content

Class InstructionMsgResponse

Responds to incoming InstructionEntry messages by displaying them as message UI elements in the specified message panel. Creates and manages an object pool of message presenters to efficiently handle repeated display of instruction entries.

[RequireComponent(typeof(TypewriterActor))]
public class InstructionMsgResponse : MonoBehaviour, IEntryResponser<InstructionEntry>, IEntryResponser

Inheritance​

Implements​

Fields​

DEFAULT_SIZE​

The default initial size of the object pool for message presenters.

public const int DEFAULT_SIZE = 2

Field Value​

int

MsgPrefab​

The prefab to use when creating new message presenters for displaying instruction entries.

[Header("Message Prefab")]
[Tooltip("Prefab representing an instruction message displayed in the chat-like UI.")]
public MsgPresenter MsgPrefab

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(InstructionEntry, ITypewriterContext)​

Handles an incoming InstructionEntry by retrieving a presenter from the object pool, initializing it with the entry data, and setting it up for automatic return to the pool when dismissed.

public void HandleEntry(InstructionEntry entry, ITypewriterContext context)

Parameters​

NameTypeDescription
entryInstructionEntryThe instruction entry to be displayed.
contextITypewriterContextThe current typewriter context providing shared blackboards and runtime data.
  • Fields
    • DEFAULT_SIZE
    • MsgPrefab
  • Methods
    • HandleEntry(BaseEntry, ITypewriterContext)
    • HandleEntry(InstructionEntry, ITypewriterContext)