Add Custom Dialogue Graph for Dialogue Trees
This commit is contained in:
parent
d736224daa
commit
74ea72c76c
@ -14,6 +14,11 @@
|
|||||||
"CoreUObject",
|
"CoreUObject",
|
||||||
"UMG"
|
"UMG"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "DialogueSystemEditor",
|
||||||
|
"Type": "Editor",
|
||||||
|
"LoadingPhase": "PostEngineInit"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Plugins": [
|
"Plugins": [
|
||||||
|
@ -11,5 +11,11 @@ public class EndlessVendettaTarget : TargetRules
|
|||||||
DefaultBuildSettings = BuildSettingsVersion.V2;
|
DefaultBuildSettings = BuildSettingsVersion.V2;
|
||||||
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;
|
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;
|
||||||
ExtraModuleNames.Add("EndlessVendetta");
|
ExtraModuleNames.Add("EndlessVendetta");
|
||||||
|
RegisterModulesCreatedByRider();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RegisterModulesCreatedByRider()
|
||||||
|
{
|
||||||
|
ExtraModuleNames.AddRange(new string[] { "DialogueSystemEditor" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
#include "DialogueAddItemNode.h"
|
||||||
|
#include "DialogueTree.h"
|
||||||
|
|
||||||
|
#define LOCTEXT_NAMESPACE "UDialogueTextNode"
|
||||||
|
|
||||||
|
UDialogueAddItemNode::UDialogueAddItemNode()
|
||||||
|
{
|
||||||
|
#if WITH_EDITORONLY_DATA
|
||||||
|
CompatibleGraphType = UDialogueTree::StaticClass();
|
||||||
|
|
||||||
|
ContextMenuName = LOCTEXT("ConextMenuName", "Add Item Node");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
|
||||||
|
FText UDialogueAddItemNode::GetNodeTitle() const
|
||||||
|
{
|
||||||
|
return Bruh;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDialogueAddItemNode::SetNodeTitle(const FText& NewTitle)
|
||||||
|
{
|
||||||
|
Bruh = NewTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
FLinearColor UDialogueAddItemNode::GetBackgroundColor() const
|
||||||
|
{
|
||||||
|
const UDialogueTree* DialogueTree = Cast<UDialogueTree>(GetGraph());
|
||||||
|
|
||||||
|
if (DialogueTree == nullptr)
|
||||||
|
return Super::GetBackgroundColor();
|
||||||
|
|
||||||
|
return FLinearColor::Black;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef LOCTEXT_NAMESPACE
|
@ -0,0 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GenericGraphNode.h"
|
||||||
|
#include "DialogueAddItemNode.generated.h"
|
||||||
|
|
||||||
|
UCLASS(Blueprintable)
|
||||||
|
class UDialogueAddItemNode : public UGenericGraphNode
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
public:
|
||||||
|
UDialogueAddItemNode();
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
|
||||||
|
FText Bruh;
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
virtual FText GetNodeTitle() const override;
|
||||||
|
|
||||||
|
virtual void SetNodeTitle(const FText& NewTitle) override;
|
||||||
|
|
||||||
|
virtual FLinearColor GetBackgroundColor() const override;
|
||||||
|
#endif
|
||||||
|
};
|
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GenericGraphEdge.h"
|
||||||
|
#include "DialogueEdge.generated.h"
|
||||||
|
|
||||||
|
|
||||||
|
UCLASS(Blueprintable)
|
||||||
|
class UDialogueEdge: public UGenericGraphEdge
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
|
||||||
|
FText Selection;
|
||||||
|
};
|
@ -0,0 +1,47 @@
|
|||||||
|
#include "DialogueTextNode.h"
|
||||||
|
#include "DialogueTree.h"
|
||||||
|
|
||||||
|
#define LOCTEXT_NAMESPACE "UDialogueTextNode"
|
||||||
|
|
||||||
|
UDialogueTextNode::UDialogueTextNode()
|
||||||
|
{
|
||||||
|
#if WITH_EDITORONLY_DATA
|
||||||
|
CompatibleGraphType = UDialogueTree::StaticClass();
|
||||||
|
|
||||||
|
ContextMenuName = LOCTEXT("ConextMenuName", "Dialogue Node");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
|
||||||
|
FText UDialogueTextNode::GetNodeTitle() const
|
||||||
|
{
|
||||||
|
return Text.IsEmpty() ? LOCTEXT("EmptyParagraph", "(Empty paragraph)") : Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDialogueTextNode::SetNodeTitle(const FText& NewTitle)
|
||||||
|
{
|
||||||
|
Text = NewTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
FLinearColor UDialogueTextNode::GetBackgroundColor() const
|
||||||
|
{
|
||||||
|
const UDialogueTree* DialogueTree = Cast<UDialogueTree>(GetGraph());
|
||||||
|
|
||||||
|
if (DialogueTree == nullptr)
|
||||||
|
return Super::GetBackgroundColor();
|
||||||
|
|
||||||
|
switch (DialoguePosition)
|
||||||
|
{
|
||||||
|
case EDialoguePosition::Left:
|
||||||
|
return DialogueTree->LeftDialogueBgColor;
|
||||||
|
case EDialoguePosition::Right:
|
||||||
|
return DialogueTree->RightDialogueBgColor;
|
||||||
|
default:
|
||||||
|
return FLinearColor::Black;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef LOCTEXT_NAMESPACE
|
@ -0,0 +1,34 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GenericGraphNode.h"
|
||||||
|
#include "DialogueTextNode.generated.h"
|
||||||
|
|
||||||
|
UENUM(BlueprintType)
|
||||||
|
enum class EDialoguePosition : uint8
|
||||||
|
{
|
||||||
|
Left,
|
||||||
|
Right
|
||||||
|
};
|
||||||
|
|
||||||
|
UCLASS(Blueprintable)
|
||||||
|
class UDialogueTextNode : public UGenericGraphNode
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
public:
|
||||||
|
UDialogueTextNode();
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
|
||||||
|
FText Text;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
|
||||||
|
EDialoguePosition DialoguePosition;
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
virtual FText GetNodeTitle() const override;
|
||||||
|
|
||||||
|
virtual void SetNodeTitle(const FText& NewTitle) override;
|
||||||
|
|
||||||
|
virtual FLinearColor GetBackgroundColor() const override;
|
||||||
|
#endif
|
||||||
|
};
|
@ -0,0 +1,18 @@
|
|||||||
|
#include "DialogueTree.h"
|
||||||
|
#include "DialogueTextNode.h"
|
||||||
|
#include "DialogueEdge.h"
|
||||||
|
|
||||||
|
#define LOCTEXT_NAMESPACE "DialogueSession"
|
||||||
|
|
||||||
|
UDialogueTree::UDialogueTree()
|
||||||
|
{
|
||||||
|
NodeType = UGenericGraphNode::StaticClass();
|
||||||
|
EdgeType = UDialogueEdge::StaticClass();
|
||||||
|
|
||||||
|
LeftDialogueBgColor = FLinearColor::Black;
|
||||||
|
RightDialogueBgColor = FLinearColor(0.93f, 0.93f, 0.93f, 1.f);
|
||||||
|
|
||||||
|
Name = "Dialogue Tree";
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef LOCTEXT_NAMESPACE
|
@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GenericGraph.h"
|
||||||
|
#include "DialogueTree.generated.h"
|
||||||
|
|
||||||
|
UCLASS(Blueprintable)
|
||||||
|
class ENDLESSVENDETTA_API UDialogueTree: public UGenericGraph
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UDialogueTree();
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, Category = "Dialogue")
|
||||||
|
FLinearColor LeftDialogueBgColor;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, Category = "Dialogue")
|
||||||
|
FLinearColor RightDialogueBgColor;
|
||||||
|
};
|
@ -13,5 +13,7 @@ public class EndlessVendetta : ModuleRules
|
|||||||
"Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "EnhancedInput", "AIModule",
|
"Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "EnhancedInput", "AIModule",
|
||||||
"GameplayTasks", "NavigationSystem", "UMG", "Slate", "SlateCore", "Niagara", "NiagaraCore", "NiagaraShader"
|
"GameplayTasks", "NavigationSystem", "UMG", "Slate", "SlateCore", "Niagara", "NiagaraCore", "NiagaraShader"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
PrivateDependencyModuleNames.AddRange(new string[] { "GenericGraphRuntime" });
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,5 +11,11 @@ public class EndlessVendettaEditorTarget : TargetRules
|
|||||||
DefaultBuildSettings = BuildSettingsVersion.V2;
|
DefaultBuildSettings = BuildSettingsVersion.V2;
|
||||||
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;
|
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;
|
||||||
ExtraModuleNames.Add("EndlessVendetta");
|
ExtraModuleNames.Add("EndlessVendetta");
|
||||||
|
RegisterModulesCreatedByRider();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RegisterModulesCreatedByRider()
|
||||||
|
{
|
||||||
|
ExtraModuleNames.AddRange(new string[] { "DialogueSystemEditor" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user