From d736224daa51c0c7ccead606c42386d4a2ee687b Mon Sep 17 00:00:00 2001
From: PHILIP WHITE <PW259246@falmouth.ac.uk>
Date: Mon, 20 Nov 2023 21:26:49 +0000
Subject: [PATCH] Add DialogueSystemEditor Module for Tree Factory

---
 .../DialogueSystemEditor.Build.cs             | 36 +++++++++++++++++++
 .../Private/DialogueSystemEditor.cpp          | 17 +++++++++
 .../Private/DialogueTreeFactory.cpp           | 28 +++++++++++++++
 .../Private/DialogueTreeFactory.h             | 18 ++++++++++
 .../Public/DialogueSystemEditor.h             | 11 ++++++
 5 files changed, 110 insertions(+)
 create mode 100644 EndlessVendetta/Source/DialogueSystemEditor/DialogueSystemEditor.Build.cs
 create mode 100644 EndlessVendetta/Source/DialogueSystemEditor/Private/DialogueSystemEditor.cpp
 create mode 100644 EndlessVendetta/Source/DialogueSystemEditor/Private/DialogueTreeFactory.cpp
 create mode 100644 EndlessVendetta/Source/DialogueSystemEditor/Private/DialogueTreeFactory.h
 create mode 100644 EndlessVendetta/Source/DialogueSystemEditor/Public/DialogueSystemEditor.h

diff --git a/EndlessVendetta/Source/DialogueSystemEditor/DialogueSystemEditor.Build.cs b/EndlessVendetta/Source/DialogueSystemEditor/DialogueSystemEditor.Build.cs
new file mode 100644
index 00000000..63486a00
--- /dev/null
+++ b/EndlessVendetta/Source/DialogueSystemEditor/DialogueSystemEditor.Build.cs
@@ -0,0 +1,36 @@
+using UnrealBuildTool;
+
+public class DialogueSystemEditor : ModuleRules
+{
+    public DialogueSystemEditor(ReadOnlyTargetRules Target) : base(Target)
+    {
+        PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
+        
+        PublicIncludePaths.AddRange(
+            new string[]
+            {
+                "EndlessVendetta/DialogueSystem"
+            }
+        );
+
+        PublicDependencyModuleNames.AddRange(
+            new string[]
+            {
+                "Core",
+            }
+        );
+
+        PrivateDependencyModuleNames.AddRange(
+            new string[]
+            {
+                "CoreUObject",
+                "Engine",
+                "Slate",
+                "SlateCore",
+                "UnrealEd", 
+                "GenericGraphRuntime", 
+                "EndlessVendetta"
+            }
+        );
+    }
+}
\ No newline at end of file
diff --git a/EndlessVendetta/Source/DialogueSystemEditor/Private/DialogueSystemEditor.cpp b/EndlessVendetta/Source/DialogueSystemEditor/Private/DialogueSystemEditor.cpp
new file mode 100644
index 00000000..7a4fad39
--- /dev/null
+++ b/EndlessVendetta/Source/DialogueSystemEditor/Private/DialogueSystemEditor.cpp
@@ -0,0 +1,17 @@
+#include "DialogueSystemEditor.h"
+
+#define LOCTEXT_NAMESPACE "FDialogueSystemEditorModule"
+
+void FDialogueSystemEditorModule::StartupModule()
+{
+    
+}
+
+void FDialogueSystemEditorModule::ShutdownModule()
+{
+    
+}
+
+#undef LOCTEXT_NAMESPACE
+    
+IMPLEMENT_MODULE(FDialogueSystemEditorModule, DialogueSystemEditor)
\ No newline at end of file
diff --git a/EndlessVendetta/Source/DialogueSystemEditor/Private/DialogueTreeFactory.cpp b/EndlessVendetta/Source/DialogueSystemEditor/Private/DialogueTreeFactory.cpp
new file mode 100644
index 00000000..a1f39692
--- /dev/null
+++ b/EndlessVendetta/Source/DialogueSystemEditor/Private/DialogueTreeFactory.cpp
@@ -0,0 +1,28 @@
+#include "DialogueTreeFactory.h"
+#include "DialogueTree.h"
+
+#define LOCTEXT_NAMESPACE "DialogueSessionFactory"
+
+UDialogueTreeFactory::UDialogueTreeFactory()
+{
+	bCreateNew = true;
+	bEditAfterNew = true;
+	SupportedClass = UDialogueTree::StaticClass();
+}
+
+UObject* UDialogueTreeFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn)
+{
+	return NewObject<UObject>(InParent, Class, Name, Flags | RF_Transactional);
+}
+
+FText UDialogueTreeFactory::GetDisplayName() const
+{
+	return LOCTEXT("FactoryName", "Dialogue Tree");
+}
+
+FString UDialogueTreeFactory::GetDefaultNewAssetName() const
+{
+	return "DialogueTree";
+}
+
+#undef LOCTEXT_NAMESPACE
\ No newline at end of file
diff --git a/EndlessVendetta/Source/DialogueSystemEditor/Private/DialogueTreeFactory.h b/EndlessVendetta/Source/DialogueSystemEditor/Private/DialogueTreeFactory.h
new file mode 100644
index 00000000..80d6f49d
--- /dev/null
+++ b/EndlessVendetta/Source/DialogueSystemEditor/Private/DialogueTreeFactory.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Factories/Factory.h"
+#include "DialogueTreeFactory.generated.h"
+
+UCLASS()
+class UDialogueTreeFactory : public UFactory
+{
+	GENERATED_BODY()
+
+public:
+	UDialogueTreeFactory();
+
+	virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
+	virtual FText GetDisplayName() const override;
+	virtual FString GetDefaultNewAssetName() const override;
+};
\ No newline at end of file
diff --git a/EndlessVendetta/Source/DialogueSystemEditor/Public/DialogueSystemEditor.h b/EndlessVendetta/Source/DialogueSystemEditor/Public/DialogueSystemEditor.h
new file mode 100644
index 00000000..3333f03a
--- /dev/null
+++ b/EndlessVendetta/Source/DialogueSystemEditor/Public/DialogueSystemEditor.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Modules/ModuleManager.h"
+
+class FDialogueSystemEditorModule : public IModuleInterface
+{
+public:
+    virtual void StartupModule() override;
+    virtual void ShutdownModule() override;
+};