4#include "Kismet/GameplayStatics.h"
5#include "EngineUtils.h"
11#include "Sound/SoundWave.h"
18 if (Ar.UE4Ver() >= VER_UE4_COOKED_ASSETS_IN_EDITOR_SUPPORT)
22 const FStripDataFlags StripFlags(Ar);
26 if (!StripFlags.IsEditorDataStripped())
43 UDlgNode* This = CastChecked<UDlgNode>(InThis);
47 Collector.AddReferencedObject(This->GraphNode, This);
50 Super::AddReferencedObjects(InThis, Collector);
67 Super::PostInitProperties();
70 if (HasAnyFlags(RF_ClassDefaultObject | RF_NeedLoad))
80 Super::PostDuplicate(bDuplicateForPIE);
92 Super::PostEditImport();
103void UDlgNode::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
105 Super::PostEditChangeProperty(PropertyChangedEvent);
109 BroadcastPropertyEdgeIndexChanged = INDEX_NONE;
112void UDlgNode::PostEditChangeChainProperty(
struct FPropertyChangedChainEvent& PropertyChangedEvent)
118 BroadcastPropertyEdgeIndexChanged = PropertyChangedEvent.GetArrayIndex(GET_MEMBER_NAME_STRING_CHECKED(
UDlgNode,
Children));
119 Super::PostEditChangeChainProperty(PropertyChangedEvent);
136 Edge.RebuildConstructedText(Context,
OwnerName);
161 AvailableOptions.Empty();
166 const bool bSatisfied = Edge.Evaluate(Context, {
this });
168 if (bSatisfied || Edge.bIncludeInAllOptionListIfUnsatisfied)
174 AvailableOptions.Add(Edge);
179 if (AvailableOptions.Num() == 0)
182 TEXT(
"ReevaluateChildren (ReevaluateOptions) - no valid child option for a NODE.\nContext:\n\t%s"),
193 if (AlreadyVisitedNodes.Contains(
this))
198 AlreadyVisitedNodes.Add(
this);
217 if (Edge.Evaluate(Context, AlreadyVisitedNodes))
229 if (AvailableOptions.IsValidIndex(OptionIndex))
231 check(AvailableOptions[OptionIndex].IsValid());
232 return Context.
EnterNode(AvailableOptions[OptionIndex].TargetIndex, {});
236 TEXT(
"OptionSelected - Failed to choose OptionIndex = %d - it only has %d valid options.\nContext:\n\t%s"),
244 TArray<int32> OutArray;
245 const int32 EdgesNum =
Children.Num();
246 for (int32 EdgeIndex = 0; EdgeIndex < EdgesNum; EdgeIndex++)
250 OutArray.Add(EdgeIndex);
261 if (Edge.TargetIndex == TargetIndex)
284 Edge.UpdateTextValueFromDefaultAndRemapping(*
Dialogue, *
this, Settings,
false);
287 if (bSkipAfterFirstChild)
301 if (bUpdateGraphNode)
314 Edge.UpdateTextsNamespacesAndKeys(Outer, Settings);
318 if (bUpdateGraphNode)
330 Edge.RebuildTextArguments();
334 if (bUpdateGraphNode)
343 UDlgDialogue::GetDialogueEditorAccess()->UpdateGraphNodeEdges(GraphNode);
357 return CastChecked<UDlgDialogue>(GetOuter());
static void UpdateTextFromRemapping(const UDlgSystemSettings &Settings, FText &OutText)
static FDlgLogger & Get()
void Errorf(const FmtType &Fmt, Types... Args)
const TArray< FDlgEdge > & GetOptionsArray() const
UFUNCTION(BlueprintPure, Category = "Dialogue|Options|Satisfied")
bool EnterNode(int32 NodeIndex, TSet< const UDlgNode * > NodesEnteredWithThisStep)
TArray< FDlgEdge > & GetMutableOptionsArray()
FString GetContextString() const
UFUNCTION(BlueprintPure, Category = "Dialogue|Context")
UObject * GetMutableParticipant(FName ParticipantName) const
UFUNCTION(BlueprintPure, Category = "Dialogue|Data", DisplayName = "Get Participant")
TArray< FDlgEdgeData > & GetAllMutableOptionsArray()
UCLASS(BlueprintType, Meta = (DisplayThumbnail = "true"))
UCLASS(BlueprintType, Abstract, EditInlineNew, ClassGroup = "Dialogue")
virtual bool HandleNodeEnter(UDlgContext &Context, TSet< const UDlgNode * > NodesEnteredWithThisStep)
virtual void GetAssociatedParticipants(TArray< FName > &OutArray) const
USoundWave * GetNodeVoiceSoundWave() const
UFUNCTION(BlueprintPure, Category = "Dialogue|Node")
virtual FDlgEdge * GetMutableNodeChildForTargetIndex(int32 TargetIndex)
virtual USoundBase * GetNodeVoiceSoundBase() const
UFUNCTION(BlueprintPure, Category = "Dialogue|Node")
FName OwnerName
UPROPERTY(EditAnywhere, Category = "Dialogue|Node", Meta = (DisplayName = "Participant Name"))
const TArray< int32 > GetNodeOpenChildren_DEPRECATED() const
FDialogueNodePropertyChanged OnDialogueNodePropertyChanged
UDlgDialogue * GetDialogue() const
virtual void RebuildTextArguments(bool bEdges, bool bUpdateGraphNode=true)
virtual bool CheckNodeEnterConditions(const UDlgContext &Context, TSet< const UDlgNode * > AlreadyVisitedNodes) const
virtual bool OptionSelected(int32 OptionIndex, UDlgContext &Context)
bool bCheckChildrenOnEvaluation
UPROPERTY(EditAnywhere, Category = "Dialogue|Node")
TArray< FDlgCondition > EnterConditions
UPROPERTY(EditAnywhere, Category = "Dialogue|Node")
void PostEditImport() override
static void AddReferencedObjects(UObject *InThis, FReferenceCollector &Collector)
virtual void UpdateTextsNamespacesAndKeys(const UDlgSystemSettings &Settings, bool bEdges, bool bUpdateGraphNode=true)
void PostDuplicate(bool bDuplicateForPIE) override
bool HasGUID() const
UFUNCTION(BlueprintPure, Category = "Dialogue|Node")
void Serialize(FArchive &Ar) override
void PostInitProperties() override
TArray< FDlgEvent > EnterEvents
UPROPERTY(EditAnywhere, Category = "Dialogue|Node")
TArray< FDlgEdge > Children
UPROPERTY(VisibleAnywhere, EditFixedSize, AdvancedDisplay, Category = "Dialogue|Node")
virtual void UpdateTextsValuesFromDefaultsAndRemappings(const UDlgSystemSettings &Settings, bool bEdges, bool bUpdateGraphNode=true)
void FireNodeEnterEvents(UDlgContext &Context)
bool HasAnySatisfiedChild(const UDlgContext &Context, TSet< const UDlgNode * > AlreadyVisitedNodes) const
virtual bool ReevaluateChildren(UDlgContext &Context, TSet< const UDlgNode * > AlreadyEvaluated)
UCLASS(Config = Engine, DefaultConfig, meta = (DisplayName = "Dialogue System Settings"))
bool bSetDefaultEdgeTextOnFirstChildOnly
UPROPERTY(Category = "Default Texts", Config, EditAnywhere, DisplayName = "Set Default Edge Texts on ...
bool bSetDefaultEdgeTexts
UPROPERTY(Category = "Default Texts", Config, EditAnywhere, DisplayName = "Set Default Edge Texts")
static bool EvaluateArray(const UDlgContext &Context, const TArray< FDlgCondition > &ConditionsArray, FName DefaultParticipantName=NAME_None)