A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DlgManager.cpp
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
2#include "DlgManager.h"
3
4#include "UObject/UObjectIterator.h"
5#include "Engine/ObjectLibrary.h"
6#include "Interfaces/IPluginManager.h"
7#include "Engine/Blueprint.h"
8#include "EngineUtils.h"
9#include "Engine/Engine.h"
10
11#include "IDlgSystemModule.h"
12#include "DlgConstants.h"
14#include "DlgDialogue.h"
15#include "DlgMemory.h"
16#include "DlgContext.h"
17#include "Logging/DlgLogger.h"
18#include "DlgHelper.h"
19#include "NYReflectionHelper.h"
20
21TWeakObjectPtr<const UObject> UDlgManager::UserWorldContextObjectPtr = nullptr;
22
24
26{
27 if (!IsValid(Dialogue))
28 {
29 FDlgLogger::Get().Error(TEXT("StartDialogueWithDefaultParticipants - FAILED to start dialogue because the Dialogue is INVALID (is nullptr)!"));
30 return nullptr;
31 }
32
33 // Create empty map of participants we need
34 TSet<FName> ParticipantSet;
35 Dialogue->GetAllParticipantNames(ParticipantSet);
36 TArray<UObject*> Participants;
37
38 // Maps from Participant Name => Objects that have that participant name
39 TMap<FName, TArray<UObject*>> ObjectMap;
40 for (const FName& Name : ParticipantSet)
41 {
42 ObjectMap.Add(Name, {});
43 }
44
45 // Gather all objects that have our participant name
47 {
48 const FName ParticipantName = IDlgDialogueParticipant::Execute_GetParticipantName(Participant);
49 if (ObjectMap.Contains(ParticipantName))
50 {
51 ObjectMap[ParticipantName].AddUnique(Participant);
52 Participants.AddUnique(Participant);
53 }
54 }
55
56 // Find the missing names and the duplicate names
57 TArray<FString> MissingNames;
58 TArray<FString> DuplicatedNames;
59 for (const auto& Pair : ObjectMap)
60 {
61 const FName ParticipantName = Pair.Key;
62 const TArray<UObject*>& Objects = Pair.Value;
63
64 if (Objects.Num() == 0)
65 {
66 MissingNames.Add(ParticipantName.ToString());
67 }
68 else if (Objects.Num() > 1)
69 {
70 for (UObject* Obj : Objects)
71 {
72 DuplicatedNames.Add(Obj->GetName() + "(" + ParticipantName.ToString() + ")");
73 }
74 }
75 }
76
77 if (MissingNames.Num() > 0)
78 {
79 const FString NameList = FString::Join(MissingNames, TEXT(", "));
81 TEXT("StartDialogueWithDefaultParticipants - FAILED Dialogue = `%s`, the system FAILED to find the following Participant(s): %s"),
82 *Dialogue->GetName(), *NameList
83 );
84 }
85
86 if (DuplicatedNames.Num() > 0)
87 {
88 const FString NameList = FString::Join(DuplicatedNames, TEXT(", "));
90 TEXT("StartDialogueWithDefaultParticipants - FAILED for Dialogue = `%s`, the system found multiple participants using the same name: %s"),
91 *Dialogue->GetName(), *NameList
92 );
93 }
94
95 if (MissingNames.Num() > 0 || DuplicatedNames.Num() > 0)
96 {
97 return nullptr;
98 }
99
100 return StartDialogueWithContext(TEXT("StartDialogueWithDefaultParticipants"), Dialogue, Participants);
101}
102
103UDlgContext* UDlgManager::StartDialogueWithContext(const FString& ContextString, UDlgDialogue* Dialogue, const TArray<UObject*>& Participants)
104{
105 const FString ContextMessage = ContextString.IsEmpty()
106 ? FString::Printf(TEXT("StartDialogue"))
107 : FString::Printf(TEXT("%s - StartDialogue"), *ContextString);
108
109 TMap<FName, UObject*> ParticipantBinding;
110 if (!UDlgContext::ConvertArrayOfParticipantsToMap(ContextMessage, Dialogue, Participants, ParticipantBinding))
111 {
112 return nullptr;
113 }
114
115 auto* Context = NewObject<UDlgContext>(Participants[0], UDlgContext::StaticClass());
116 if (Context->StartWithContext(ContextMessage, Dialogue, ParticipantBinding))
117 {
118 return Context;
119 }
120
121 return nullptr;
122}
123
124bool UDlgManager::CanStartDialogue(UDlgDialogue* Dialogue, UPARAM(ref)const TArray<UObject*>& Participants)
125{
126 TMap<FName, UObject*> ParticipantBinding;
127 if (!UDlgContext::ConvertArrayOfParticipantsToMap(TEXT("CanStartDialogue"), Dialogue, Participants, ParticipantBinding, false))
128 {
129 return false;
130 }
131
132 return UDlgContext::CanBeStarted(Dialogue, ParticipantBinding);
133}
134
137 UPARAM(ref)const TArray<UObject*>& Participants,
138 int32 StartNodeIndex,
139 const TSet<int32>& AlreadyVisitedNodes,
140 bool bFireEnterEvents
141)
142{
143 const FString ContextMessage = TEXT("ResumeDialogueFromNodeIndex");
144 TMap<FName, UObject*> ParticipantBinding;
145 if (!UDlgContext::ConvertArrayOfParticipantsToMap(ContextMessage, Dialogue, Participants, ParticipantBinding))
146 {
147 return nullptr;
148 }
149
150 auto* Context = NewObject<UDlgContext>(Participants[0], UDlgContext::StaticClass());
151 FDlgHistory History;
152 History.VisitedNodeIndices = AlreadyVisitedNodes;
153 if (Context->StartWithContextFromNodeIndex(ContextMessage, Dialogue, ParticipantBinding, StartNodeIndex, History, bFireEnterEvents))
154 {
155 return Context;
156 }
157
158 return nullptr;
159}
160
163 UPARAM(ref)const TArray<UObject*>& Participants,
164 const FGuid& StartNodeGUID,
165 const TSet<FGuid>& AlreadyVisitedNodes,
166 bool bFireEnterEvents
167)
168{
169 const FString ContextMessage = TEXT("ResumeDialogueFromNodeGUID");
170 TMap<FName, UObject*> ParticipantBinding;
171 if (!UDlgContext::ConvertArrayOfParticipantsToMap(ContextMessage, Dialogue, Participants, ParticipantBinding))
172 {
173 return nullptr;
174 }
175
176 auto* Context = NewObject<UDlgContext>(Participants[0], UDlgContext::StaticClass());
177 FDlgHistory History;
178 History.VisitedNodeGUIDs = AlreadyVisitedNodes;
179 if (Context->StartWithContextFromNodeGUID(ContextMessage, Dialogue, ParticipantBinding, StartNodeGUID, History, bFireEnterEvents))
180 {
181 return Context;
182 }
183
184 return nullptr;
185}
186
188{
189 TArray<UObject*> Participants;
190 Participants.Add(Participant);
191 return StartDialogueWithContext(TEXT("StartMonologue"), Dialogue, Participants);
192}
193
195{
196 TArray<UObject*> Participants;
197 Participants.Add(Participant0);
198 Participants.Add(Participant1);
199 return StartDialogueWithContext(TEXT("StartDialogue2"), Dialogue, Participants);
200}
201
203{
204 TArray<UObject*> Participants;
205 Participants.Add(Participant0);
206 Participants.Add(Participant1);
207 Participants.Add(Participant2);
208 return StartDialogueWithContext(TEXT("StartDialogue3"), Dialogue, Participants);
209}
210
211UDlgContext* UDlgManager::StartDialogue4(UDlgDialogue* Dialogue, UObject* Participant0, UObject* Participant1, UObject* Participant2, UObject* Participant3)
212{
213 TArray<UObject*> Participants;
214 Participants.Add(Participant0);
215 Participants.Add(Participant1);
216 Participants.Add(Participant2);
217 Participants.Add(Participant3);
218
219 return StartDialogueWithContext(TEXT("StartDialogue4"), Dialogue, Participants);
220}
221
223{
225
226 // NOTE: All paths must NOT have the forward slash "/" at the end.
227 // If they do, then this won't load Dialogues that are located in the Content root directory
228 UObjectLibrary* ObjectLibrary = UObjectLibrary::CreateLibrary(UDlgDialogue::StaticClass(), false, GIsEditor);
229 TArray<FString> PathsToSearch = { TEXT("/Game") };
230 ObjectLibrary->AddToRoot();
231
232 // Add the current plugin dir
233 // TODO maybe add all the non engine plugin paths? IPluginManager::Get().GetEnabledPlugins()
234 const TSharedPtr<IPlugin> ThisPlugin = IPluginManager::Get().FindPlugin(DIALOGUE_SYSTEM_PLUGIN_NAME.ToString());
235 if (ThisPlugin.IsValid())
236 {
237 FString PluginPath = ThisPlugin->GetMountedAssetPath();
238 // See NOTE above
239 PluginPath.RemoveFromEnd(TEXT("/"));
240 PathsToSearch.Add(PluginPath);
241 }
242
243 const bool bForceSynchronousScan = !bAsync;
244 const int32 Count = ObjectLibrary->LoadAssetDataFromPaths(PathsToSearch, bForceSynchronousScan);
245 ObjectLibrary->LoadAssetsFromAssetData();
246 ObjectLibrary->RemoveFromRoot();
247
248 return Count;
249}
250
252{
253#if WITH_EDITOR
254 // Hmm, something is wrong
256 {
258 }
259// check(bCalledLoadAllDialoguesIntoMemory);
260#endif
261
262 TArray<UDlgDialogue*> Array;
263 for (TObjectIterator<UDlgDialogue> Itr; Itr; ++Itr)
264 {
265 UDlgDialogue* Dialogue = *Itr;
266 if (IsValid(Dialogue))
267 {
268 Array.Add(Dialogue);
269 }
270 }
271 return Array;
272}
273
274TArray<TWeakObjectPtr<AActor>> UDlgManager::GetAllWeakActorsWithDialogueParticipantInterface(UWorld* World)
275{
276 TArray<TWeakObjectPtr<AActor>> Array;
277 for (TActorIterator<AActor> Itr(World); Itr; ++Itr)
278 {
279 AActor* Actor = *Itr;
280 if (IsValid(Actor) && !Actor->IsPendingKill() && Actor->GetClass()->ImplementsInterface(UDlgDialogueParticipant::StaticClass()))
281 {
282 Array.Add(Actor);
283 }
284 }
285 return Array;
286}
287
289{
290 TArray<UObject*> Array;
291 if (!WorldContextObject)
292 return Array;
293
294 if (UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull))
295 {
296 // TObjectIterator has some weird ghost objects in editor, I failed to find a way to validate them
297 // Instead of this ActorIterate is used and the properties inside the actors are examined in a recursive way
298 // Containers are not supported yet
299 TSet<UObject*> VisitedSet;
300 for (TActorIterator<AActor> Itr(World); Itr; ++Itr)
301 {
302 GatherParticipantsRecursive(*Itr, Array, VisitedSet);
303 }
304 }
305
306 // TArray<UObject*> Array2;
307 // for (TObjectIterator<UObject> Itr; Itr; ++Itr)
308 // {
309 // UObject* Object = *Itr;
310 // if (IsValid(Object)
311 // && !Object->IsPendingKill()
312 // && Object->GetClass()->ImplementsInterface(UDlgDialogueParticipant::StaticClass()))
313 // //&& IDlgDialogueParticipant::Execute_GetParticipantName(Object) != NAME_None)
314 // {
315 // if (Object->HasAllFlags(RF_Transient | RF_Transactional) || !Object->HasAnyFlags(RF_Transient) )
316 // {
317 // Array2.AddUnique(Object);
318 // }
319 // }
320 // }
321
322 return Array;
323}
324
325TMap<FName, FDlgObjectsArray> UDlgManager::GetAllObjectsMapWithDialogueParticipantInterface(UObject* WorldContextObject)
326{
327 // Maps from Participant Name => Objects that have that participant name
328 TMap<FName, FDlgObjectsArray> ObjectsMap;
330 {
331 const FName ParticipantName = IDlgDialogueParticipant::Execute_GetParticipantName(Participant);
332 if (ObjectsMap.Contains(ParticipantName))
333 {
334 // Update
335 ObjectsMap[ParticipantName].Array.Add(Participant);
336 }
337 else
338 {
339 // Create
340 FDlgObjectsArray ArrayStruct;
341 ArrayStruct.Array.Add(Participant);
342 ObjectsMap.Add(ParticipantName, ArrayStruct);
343 }
344 }
345
346 return ObjectsMap;
347}
348
350{
351 TArray<UDlgDialogue*> Dialogues = GetAllDialoguesFromMemory();
352 TArray<UDlgDialogue*> DuplicateDialogues;
353
354 TSet<FGuid> DialogueGUIDs;
355 for (UDlgDialogue* Dialogue : Dialogues)
356 {
357 const FGuid ID = Dialogue->GetGUID();
358 if (DialogueGUIDs.Find(ID) == nullptr)
359 {
360 // does not exist, good
361 DialogueGUIDs.Add(ID);
362 }
363 else
364 {
365 // how?
366 DuplicateDialogues.Add(Dialogue);
367 }
368 }
369
370 return DuplicateDialogues;
371}
372
373TMap<FGuid, UDlgDialogue*> UDlgManager::GetAllDialoguesGUIDsMap()
374{
375 TArray<UDlgDialogue*> Dialogues = GetAllDialoguesFromMemory();
376 TMap<FGuid, UDlgDialogue*> DialoguesMap;
377
378 for (UDlgDialogue* Dialogue : Dialogues)
379 {
380 const FGuid ID = Dialogue->GetGUID();
381 if (DialoguesMap.Contains(ID))
382 {
384 TEXT("GetAllDialoguesGUIDsMap - ID = `%s` for Dialogue = `%s` already exists"),
385 *ID.ToString(), *Dialogue->GetPathName()
386 );
387 }
388
389 DialoguesMap.Add(ID, Dialogue);
390 }
391
392 return DialoguesMap;
393}
394
395const TMap<FGuid, FDlgHistory>& UDlgManager::GetDialogueHistory()
396{
398}
399
400void UDlgManager::SetDialogueHistory(const TMap<FGuid, FDlgHistory>& DlgHistory)
401{
402 FDlgMemory::Get().SetHistoryMap(DlgHistory);
403}
404
409
414
416{
417 return FDlgHelper::IsObjectAChildOf(Object, UDlgEventCustom::StaticClass());
418}
419
421{
422 return FDlgHelper::IsObjectAChildOf(Object, UDlgConditionCustom::StaticClass());
423}
424
426{
427 return FDlgHelper::IsObjectAChildOf(Object, UDlgTextArgumentCustom::StaticClass());
428}
429
431{
432 return FDlgHelper::IsObjectAChildOf(Object, UDlgNodeData::StaticClass());
433}
434
435TArray<UDlgDialogue*> UDlgManager::GetAllDialoguesForParticipantName(FName ParticipantName)
436{
437 TArray<UDlgDialogue*> DialoguesArray;
439 {
440 if (Dialogue->HasParticipant(ParticipantName))
441 {
442 DialoguesArray.Add(Dialogue);
443 }
444 }
445
446 return DialoguesArray;
447}
448
450{
451 TSet<FName> UniqueNames;
453 {
454 Dialogue->GetAllParticipantNames(UniqueNames);
455 }
456
457 FDlgHelper::AppendSortedSetToArray(UniqueNames, OutArray);
458}
459
460void UDlgManager::GetAllDialoguesSpeakerStates(TArray<FName>& OutArray)
461{
462 TSet<FName> UniqueNames;
464 {
465 Dialogue->GetAllSpeakerStates(UniqueNames);
466 }
467
468 FDlgHelper::AppendSortedSetToArray(UniqueNames, OutArray);
469}
470
471void UDlgManager::GetAllDialoguesIntNames(FName ParticipantName, TArray<FName>& OutArray)
472{
473 TSet<FName> UniqueNames;
475 {
476 Dialogue->GetIntNames(ParticipantName, UniqueNames);
477 }
478
479 FDlgHelper::AppendSortedSetToArray(UniqueNames, OutArray);
480}
481
482void UDlgManager::GetAllDialoguesFloatNames(FName ParticipantName, TArray<FName>& OutArray)
483{
484 TSet<FName> UniqueNames;
486 {
487 Dialogue->GetFloatNames(ParticipantName, UniqueNames);
488 }
489
490 FDlgHelper::AppendSortedSetToArray(UniqueNames, OutArray);
491}
492
493void UDlgManager::GetAllDialoguesBoolNames(FName ParticipantName, TArray<FName>& OutArray)
494{
495 TSet<FName> UniqueNames;
497 {
498 Dialogue->GetBoolNames(ParticipantName, UniqueNames);
499 }
500
501 FDlgHelper::AppendSortedSetToArray(UniqueNames, OutArray);
502}
503
504void UDlgManager::GetAllDialoguesNameNames(FName ParticipantName, TArray<FName>& OutArray)
505{
506 TSet<FName> UniqueNames;
508 {
509 Dialogue->GetNameNames(ParticipantName, UniqueNames);
510 }
511
512 FDlgHelper::AppendSortedSetToArray(UniqueNames, OutArray);
513}
514
515void UDlgManager::GetAllDialoguesConditionNames(FName ParticipantName, TArray<FName>& OutArray)
516{
517 TSet<FName> UniqueNames;
519 {
520 Dialogue->GetConditions(ParticipantName, UniqueNames);
521 }
522
523 FDlgHelper::AppendSortedSetToArray(UniqueNames, OutArray);
524}
525
526void UDlgManager::GetAllDialoguesEventNames(FName ParticipantName, TArray<FName>& OutArray)
527{
528 TSet<FName> UniqueNames;
530 {
531 Dialogue->GetEvents(ParticipantName, UniqueNames);
532 }
533
534 FDlgHelper::AppendSortedSetToArray(UniqueNames, OutArray);
535}
536
538{
540 {
541 FDlgLogger::Get().Error(TEXT("RegisterDialogueConsoleCommands - The Dialogue System Module is NOT Loaded"));
542 return false;
543 }
544
546 return true;
547}
548
550{
552 {
553 FDlgLogger::Get().Error(TEXT("UnregisterDialogueConsoleCommands - The Dialogue System Module is NOT Loaded"));
554 return false;
555 }
556
558 return true;
559}
560
561void UDlgManager::GatherParticipantsRecursive(UObject* Object, TArray<UObject*>& Array, TSet<UObject*>& AlreadyVisited)
562{
563 if (!IsValid(Object) || Object->IsPendingKill() || AlreadyVisited.Contains(Object))
564 {
565 return;
566 }
567
568 AlreadyVisited.Add(Object);
569 if (Object->GetClass()->ImplementsInterface(UDlgDialogueParticipant::StaticClass()))
570 {
571 Array.Add(Object);
572 }
573
574 // Gather recursive from children
575 for (auto* Property = Object->GetClass()->PropertyLink; Property != nullptr; Property = Property->PropertyLinkNext)
576 {
577 if (auto* ObjectProperty = FNYReflectionHelper::CastProperty<FNYObjectProperty>(Property))
578 {
579 GatherParticipantsRecursive(ObjectProperty->GetPropertyValue_InContainer(Object), Array, AlreadyVisited);
580 }
581
582 // TODO: handle containers and structs
583 }
584}
585
587{
588 // Try to use the user set one
589 if (UserWorldContextObjectPtr.IsValid())
590 {
591 if (auto* WorldContextObject = UserWorldContextObjectPtr.Get())
592 {
593 if (auto* World = WorldContextObject->GetWorld())
594 {
595 return World;
596 }
597 }
598 }
599
600 // Fallback to default autodetection
601 if (GEngine)
602 {
603 // Get first PIE world
604 // Copied from TakeUtils::GetFirstPIEWorld()
605 for (const FWorldContext& Context : GEngine->GetWorldContexts())
606 {
607 UWorld* World = Context.World();
608 if (!World || !World->IsPlayInEditor())
609 continue;
610
611 if (World->GetNetMode() == ENetMode::NM_Standalone ||
612 (World->GetNetMode() == ENetMode::NM_Client && Context.PIEInstance == 2))
613 {
614 return World;
615 }
616 }
617
618 // Otherwise get the first Game World
619 for (const FWorldContext& Context : GEngine->GetWorldContexts())
620 {
621 UWorld* World = Context.World();
622 if (!World || !World->IsGameWorld())
623 continue;
624
625 return World;
626 }
627 }
628
629 FDlgLogger::Get().Error(TEXT("GetDialogueWorld - Could NOT find any valid world. Call SetDialoguePersistentWorldContextObject in the Being Play of your GameMode"));
630 return nullptr;
631}
const FName DIALOGUE_SYSTEM_PLUGIN_NAME(TEXT("DlgSystem"))
static bool IsObjectAChildOf(const UObject *Object, const UClass *ParentClass)
static void AppendSortedSetToArray(const TSet< FName > &InSet, TArray< FName > &OutArray)
Definition DlgHelper.h:468
static bool IsObjectImplementingInterface(const UObject *Object, const UClass *InterfaceClass)
static FDlgLogger & Get()
Definition DlgLogger.h:24
virtual void RegisterConsoleCommands(const TWeakObjectPtr< const UObject > &WorldContextObjectPtr)=0
virtual void UnregisterConsoleCommands()=0
static IDlgSystemModule & Get()
static bool IsAvailable()
FORCEINLINE void Error(const FString &Message)
Definition INYLogger.h:325
void Errorf(const FmtType &Fmt, Types... Args)
Definition INYLogger.h:305
UCLASS(BlueprintType)
Definition DlgContext.h:96
static bool CanBeStarted(UDlgDialogue *InDialogue, const TMap< FName, UObject * > &InParticipants)
static bool ConvertArrayOfParticipantsToMap(const FString &ContextString, const UDlgDialogue *Dialogue, const TArray< UObject * > &ParticipantsArray, TMap< FName, UObject * > &OutParticipantsMap, bool bLog=true)
UCLASS(BlueprintType, Meta = (DisplayThumbnail = "true"))
Definition DlgDialogue.h:85
static void GetAllDialoguesNameNames(FName ParticipantName, TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static void SetDialogueHistory(const TMap< FGuid, FDlgHistory > &DlgHistory)
UFUNCTION(BlueprintCallable, Category = "Dialogue|Memory")
static void GetAllDialoguesBoolNames(FName ParticipantName, TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static UDlgContext * StartMonologue(UDlgDialogue *Dialogue, UObject *Participant)
UFUNCTION(BlueprintCallable, Category = "Dialogue|Launch")
static TWeakObjectPtr< const UObject > UserWorldContextObjectPtr
Definition DlgManager.h:397
static const TMap< FGuid, FDlgHistory > & GetDialogueHistory()
UFUNCTION(BlueprintPure, Category = "Dialogue|Memory")
static void GetAllDialoguesEventNames(FName ParticipantName, TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static void GetAllDialoguesIntNames(FName ParticipantName, TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static bool IsObjectANodeData(const UObject *Object)
UFUNCTION(BlueprintPure, Category = "Dialogue|Helper", DisplayName = "Is Object A Node Data")
static UDlgContext * StartDialogueWithContext(const FString &ContextString, UDlgDialogue *Dialogue, const TArray< UObject * > &Participants)
static UDlgContext * StartDialogue3(UDlgDialogue *Dialogue, UObject *Participant0, UObject *Participant1, UObject *Participant2)
UFUNCTION(BlueprintCallable, Category = "Dialogue|Launch")
static UDlgContext * StartDialogue2(UDlgDialogue *Dialogue, UObject *Participant0, UObject *Participant1)
UFUNCTION(BlueprintCallable, Category = "Dialogue|Launch")
static TMap< FName, FDlgObjectsArray > GetAllObjectsMapWithDialogueParticipantInterface(UObject *WorldContextObject)
UFUNCTION(BlueprintPure, Category = "Dialogue|Helper", meta = (WorldContext = "WorldContextObject"))
static void GetAllDialoguesConditionNames(FName ParticipantName, TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static void GetAllDialoguesFloatNames(FName ParticipantName, TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static TArray< TWeakObjectPtr< AActor > > GetAllWeakActorsWithDialogueParticipantInterface(UWorld *World)
static UDlgContext * StartDialogue4(UDlgDialogue *Dialogue, UObject *Participant0, UObject *Participant1, UObject *Participant2, UObject *Participant3)
UFUNCTION(BlueprintCallable, Category = "Dialogue|Launch")
static bool bCalledLoadAllDialoguesIntoMemory
Definition DlgManager.h:399
static TMap< FGuid, UDlgDialogue * > GetAllDialoguesGUIDsMap()
static UDlgContext * ResumeDialogueFromNodeIndex(UDlgDialogue *Dialogue, UPARAM(ref) const TArray< UObject * > &Participants, UPARAM(DisplayName="Start Node Index") int32 StartIndex, const TSet< int32 > &AlreadyVisitedNodes, bool bFireEnterEvents)
UFUNCTION(BlueprintCallable, Category = "Dialogue|Launch")
static bool RegisterDialogueConsoleCommands()
UFUNCTION(BlueprintCallable, Category = "Dialogue|Console")
static void ClearDialogueHistory()
UFUNCTION(BlueprintCallable, Category = "Dialogue|Memory")
static bool IsObjectACustomCondition(const UObject *Object)
UFUNCTION(BlueprintPure, Category = "Dialogue|Helper", DisplayName = "Is Object A Custom Condition")
static void GatherParticipantsRecursive(UObject *Object, TArray< UObject * > &Array, TSet< UObject * > &AlreadyVisited)
static bool DoesObjectImplementDialogueParticipantInterface(const UObject *Object)
UFUNCTION(BlueprintPure, Category = "Dialogue|Helper")
static TArray< UDlgDialogue * > GetAllDialoguesForParticipantName(FName ParticipantName)
static UDlgContext * StartDialogueWithDefaultParticipants(UObject *WorldContextObject, UDlgDialogue *Dialogue)
UFUNCTION(BlueprintCallable, Category = "Dialogue|Launch", meta = (WorldContext = "WorldContextObject...
static bool IsObjectACustomTextArgument(const UObject *Object)
UFUNCTION(BlueprintPure, Category = "Dialogue|Helper", DisplayName = "Is Object A Custom Text Argumen...
static bool UnregisterDialogueConsoleCommands()
UFUNCTION(BlueprintCallable, Category = "Dialogue|Console")
static bool CanStartDialogue(UDlgDialogue *Dialogue, UPARAM(ref) const TArray< UObject * > &Participants)
UFUNCTION(BlueprintCallable, Category = "Dialogue|Launch")
static UDlgContext * ResumeDialogueFromNodeGUID(UDlgDialogue *Dialogue, UPARAM(ref) const TArray< UObject * > &Participants, const FGuid &StartNodeGUID, const TSet< FGuid > &AlreadyVisitedNodes, bool bFireEnterEvents)
UFUNCTION(BlueprintCallable, Category = "Dialogue|Launch")
static int32 LoadAllDialoguesIntoMemory(bool bAsync=false)
static TArray< UDlgDialogue * > GetDialoguesWithDuplicateGUIDs()
static void GetAllDialoguesSpeakerStates(TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static bool IsObjectACustomEvent(const UObject *Object)
UFUNCTION(BlueprintPure, Category = "Dialogue|Helper", DisplayName = "Is Object A Custom Event")
static TArray< UDlgDialogue * > GetAllDialoguesFromMemory()
static UWorld * GetDialogueWorld()
UFUNCTION(BlueprintCallable, Category = "Dialogue|Persistence")
static void GetAllDialoguesParticipantNames(TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static TArray< UObject * > GetAllObjectsWithDialogueParticipantInterface(UObject *WorldContextObject)
UFUNCTION(BlueprintPure, Category = "Dialogue|Helper", meta = (WorldContext = "WorldContextObject"))
USTRUCT(BlueprintType)
Definition DlgMemory.h:13
TSet< FGuid > VisitedNodeGUIDs
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dialogue|History")
Definition DlgMemory.h:99
TSet< int32 > VisitedNodeIndices
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dialogue|History")
Definition DlgMemory.h:90
const TMap< FGuid, FDlgHistory > & GetHistoryMaps() const
Definition DlgMemory.h:193
void Empty()
Definition DlgMemory.h:125
void SetHistoryMap(const TMap< FGuid, FDlgHistory > &Map)
Definition DlgMemory.h:194
static FDlgMemory & Get()
Definition DlgMemory.h:117
USTRUCT(BlueprintType)
Definition DlgManager.h:21
TArray< UObject * > Array
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Data")
Definition DlgManager.h:30