ULimenDialogueSubsystem
Overview
ULimenDialogueSubsystem is a subsystem that handles the registration of speakers, playing dialogues, managing subtitles, and unregistering speakers. It integrates with various components such as UDialoguePlayerBase, ULimenSubtitleDisplay, and ULimenSubtitle. This subsystem ensures that dialogues are played correctly and efficiently, handling both synchronous and asynchronous operations.
Properties
Type | Name | Access | Description |
|---|---|---|---|
UDataTable* | DialogueData | BlueprintAssignable | Event triggered when a dialogue ends. |
TSoftClassPtr< ULimenSubtitleDisplay > | SubtitleDisplayWidgetClass | Private | The class for the subtitle display widget. |
TSubclassOf< ULimenSubtitle > | SubtitleWidgetClass | Private | The class for the subtitle widget. |
TSubclassOf< UDialoguePlayerBase > | DialoguePlayerClass | Private | The class for the dialogue player. |
TArray<TStrongObjectPtr< UDialoguePlayerBase >> | DialoguePlayers | Private | Array of active dialogue players. |
TArray | CompleteDialogueData | Private | Data about completed dialogues. |
float | SubtitlesDelay | Private | Delay before subtitles are displayed. |
float | DialogueDelay | Private | Delay before dialogue is played. |
TObjectPtr< ULimenSubtitleDisplay > | SubtitleDisplayWidget | Private | The current subtitle display widget instance. |
TMap<FName, TWeakObjectPtr > | SpeakersMap | Private | Map of registered speakers. |
DialogueEndCallbacks | Private | Callbacks for dialogue end events. |
Functions
Return Type | Signature | Description |
|---|---|---|
void | Initialize(FSubsystemCollectionBase& Collection) | Initializes the subsystem with default settings from |
void | Deinitialize() | Cleans up resources and resets state. |
bool | RegisterSpeaker(const FName SpeakerId, UActorComponent* SpeakerComponent) | Registers a speaker component under a given ID. |
UActorComponent* | GetSpeakerComponent(const FName SpeakerId) const | Retrieves the registered speaker component for a given ID. |
void | StopDialogue(const FGuid& DialogueId) | Stops the dialogue associated with the given ID. |
FGuid | BP_PlayDialogue(const UDataTable* InDialogueData, const FDialogueEndEvent OnFinished) | Blueprint callable version of |
FGuid | PlayDialogue(const UDataTable* InDialogueData, const TFunction<void()>& OnFinished) | Plays a dialogue from a given data table and optionally registers a callback for when it ends. |
FGuid | PlayDialogue(const UDataTable* InDialogueData) | Plays a dialogue from a given data table without registering any callbacks. |
void | UnregisterSpeaker(const FName SpeakerId) | Unregisters the speaker component associated with the given ID. |
void | UnregisterAllSpeakers() | Unregisters all registered speakers. |
void | OnWorldBeginPlay(UWorld& InWorld) | Called when the world begins play, initializes the subtitle display widget if configured. |
void | DialogueFinished(UDialoguePlayerBase* DialoguePlayer) | Handles the completion of a dialogue by removing it from active players and firing end callbacks. |
void | DisplaySubtitles(ULimenSubtitle* Subtitle) | Displays a subtitle on the subtitle display widget. |
void | DisplayDialogue(UDialoguePlayerBase* DialoguePlayer, const UDataTable* InDialogueData) | Plays a dialogue using the provided player and data table. |
Usage & Implementation Notes
Threading Constraints: This subsystem does not perform any operations that require thread safety.
Replication Requirements: None.
Memory Lifetime Management: Dynamically allocates
UDialoguePlayerBaseinstances which must be managed to avoid memory leaks.Initialization Dependencies: Depends on
ULimenSubtitlesDeveloperSettingsfor configuration andULimenThreadPoolSubsystemfor asynchronous operations.