孟宇 3 mesi fa
parent
commit
cfb64cefd9

+ 5 - 0
Ability/Plugins/EzAbility/EzAbility.uplugin

@@ -24,6 +24,11 @@
 			"Name": "EzAbilityEditor",
 			"Type": "Editor",
 			"LoadingPhase": "Default"
+		},
+		{
+			"Name": "EzAbilityTest",
+			"Type": "UncookedOnly",
+			"LoadingPhase": "PreDefault"
 		}
 	],
 	"Plugins": [

+ 4 - 0
Ability/Plugins/EzAbility/Source/EzAbility/Private/EzAbilityPropertyBindings.cpp

@@ -0,0 +1,4 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+
+#include "EzAbilityPropertyBindings.h"

+ 2 - 2
Ability/Plugins/EzAbility/Source/EzAbility/Public/EzAbility.h

@@ -14,7 +14,7 @@ struct FEzAbilityInstance;
 struct FEzAbilityParameter;
 
 UCLASS(Blueprintable, hidecategories=(Internal, Thumbnail), meta = (ShowWorldContextPin, DisplayThumbnail = "true"))
-class UEzAbility : public UDataAsset
+class EZABILITY_API UEzAbility : public UDataAsset
 {
 	GENERATED_BODY()
 public:
@@ -34,7 +34,7 @@ protected:
 	
 public:
 
-	//Slices
+	//States
 	UPROPERTY()
 	TArray<FCompactEzAbilityState>		States;
 	

+ 16 - 0
Ability/Plugins/EzAbility/Source/EzAbility/Public/EzAbilityPropertyBindings.h

@@ -0,0 +1,16 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "UObject/Object.h"
+#include "EzAbilityPropertyBindings.generated.h"
+
+/**
+ * 
+ */
+UCLASS()
+class EZABILITY_API UEzAbilityPropertyBindings : public UObject
+{
+	GENERATED_BODY()
+};

+ 4 - 0
Ability/Plugins/EzAbility/Source/EzAbilityEditor/Private/EzAbilityEditorData.cpp

@@ -0,0 +1,4 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+
+#include "EzAbilityEditorData.h"

+ 4 - 0
Ability/Plugins/EzAbility/Source/EzAbilityEditor/Private/EzAbilityEditorPropertyBindings.cpp

@@ -0,0 +1,4 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+
+#include "EzAbilityEditorPropertyBindings.h"

+ 16 - 0
Ability/Plugins/EzAbility/Source/EzAbilityEditor/Public/EzAbilityEditorData.h

@@ -0,0 +1,16 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "UObject/Object.h"
+#include "EzAbilityEditorData.generated.h"
+
+/**
+ * 
+ */
+UCLASS(BlueprintType, EditInlineNew, CollapseCategories)
+class EZABILITYEDITOR_API UEzAbilityEditorData : public UObject
+{
+	GENERATED_BODY()
+};

+ 129 - 0
Ability/Plugins/EzAbility/Source/EzAbilityEditor/Public/EzAbilityEditorPropertyBindings.h

@@ -0,0 +1,129 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "UObject/Object.h"
+//#include "EzAbilityEditorPropertyBindings.generated.h"
+
+// /**
+//  * Editor representation of a all property bindings in a StateTree
+//  */
+// USTRUCT()
+// struct EZABILITYEDITOR_API FEzAbilityEditorPropertyBindings
+// {
+// 	GENERATED_BODY()
+//
+// 	/**
+// 	 * Adds binding between source and destination paths. Removes any bindings to TargetPath before adding the new one.
+// 	 * @param SourcePath Binding source property path.
+// 	 * @param TargetPath Binding target property path.
+// 	 */
+// 	void AddPropertyBinding(const FEzAbilityPropertyPath& SourcePath, const FEzAbilityPropertyPath& TargetPath);
+// 	
+// 	/**
+// 	 * Removes all bindings to target path.
+// 	 * @param TargetPath Target property path.
+// 	 */ 
+// 	void RemovePropertyBindings(const FEzAbilityPropertyPath& TargetPath);
+// 	
+// 	/**
+// 	 * @param TargetPath Target property path.
+// 	 * @return True of the target path has any bindings.
+// 	 */
+// 	bool HasPropertyBinding(const FEzAbilityPropertyPath& TargetPath) const;
+//
+// 	/**
+// 	 * Copies property bindings from an existing struct to another.
+// 	 * Overrides a binding to a specific property if it already exists in ToStructID.
+// 	 * @param FromStructID ID of the struct to copy from.
+// 	 * @param ToStructID ID of the struct to copy to.
+// 	 */
+// 	void CopyBindings(const FGuid FromStructID, const FGuid ToStructID);
+// 	
+// 	/**
+// 	 * @return Source path for given target path, or null if binding does not exists.
+// 	 */
+// 	const FEzAbilityPropertyPath* GetPropertyBindingSource(const FEzAbilityPropertyPath& TargetPath) const;
+// 	
+// 	/**
+// 	 * Returns all bindings for a specified structs based in struct ID.
+// 	 * @param StructID ID of the struct to find bindings for.
+// 	 * @param OutBindings Bindings for specified struct.
+// 	 */
+// 	void GetPropertyBindingsFor(const FGuid StructID, TArray<FEzAbilityPropertyPathBinding>& OutBindings) const;
+// 	
+// 	/**
+// 	 * Removes bindings which do not point to valid structs IDs.
+// 	 * @param ValidStructs Set of struct IDs that are currently valid.
+// 	 */
+// 	void RemoveUnusedBindings(const TMap<FGuid, const FStateTreeDataView>& ValidStructs);
+//
+// 	/** @return true if any of the bindings references any of the Structs. */
+// 	bool ContainsAnyStruct(const TSet<const UStruct*>& Structs);
+//
+// 	/** @return array view to all bindings. */
+// 	TConstArrayView<FEzAbilityPropertyPathBinding> GetBindings() const { return PropertyBindings; }
+//
+// 	TArrayView<FEzAbilityPropertyPathBinding> GetMutableBindings() { return PropertyBindings; }
+//
+// private:
+//
+// 	UPROPERTY()
+// 	TArray<FEzAbilityPropertyPathBinding> PropertyBindings;
+// };
+//
+//
+// UINTERFACE(MinimalAPI, meta = (CannotImplementInterfaceInBlueprint))
+// class UEzAbilityEditorPropertyBindingsOwner : public UInterface
+// {
+// 	GENERATED_UINTERFACE_BODY()
+// };
+//
+// class EZABILITYEDITOR_API IEzAbilityEditorPropertyBindingsOwner
+// {
+// 	GENERATED_IINTERFACE_BODY()
+//
+// 	/**
+// 	 * Returns structs within the owner that are visible for target struct.
+// 	 * @param TargetStructID Target struct ID
+// 	 * @param OutStructDescs Result descriptors of the visible structs.
+// 	 */
+// 	virtual void GetAccessibleStructs(const FGuid TargetStructID, TArray<FEzAbilityBindableStructDesc>& OutStructDescs) const PURE_VIRTUAL(IEzAbilityEditorPropertyBindingsOwner::GetAccessibleStructs, return; );
+//
+// 	/**
+// 	 * Returns struct descriptor based on struct ID.
+// 	 * @param StructID Target struct ID
+// 	 * @param OutStructDesc Result descriptor.
+// 	 * @return True if struct found.
+// 	 */
+// 	virtual bool GetStructByID(const FGuid StructID, FEzAbilityBindableStructDesc& OutStructDesc) const PURE_VIRTUAL(IEzAbilityEditorPropertyBindingsOwner::GetStructByID, return false; );
+//
+// 	/**
+// 	 * Returns data view based on struct ID.
+// 	 * @param StructID Target struct ID
+// 	 * @param OutDataView Result data view.
+// 	 * @return True if struct found.
+// 	 */
+// 	virtual bool GetDataViewByID(const FGuid StructID, FEzAbilityDataView& OutDataView) const PURE_VIRTUAL(IEzAbilityEditorPropertyBindingsOwner::GetDataViewByID, return false; );
+//
+// 	/** @return Pointer to editor property bindings. */
+// 	virtual FEzAbilityEditorPropertyBindings* GetPropertyEditorBindings() PURE_VIRTUAL(IEzAbilityEditorPropertyBindingsOwner::GetPropertyEditorBindings, return nullptr; );
+// };
+//
+// // TODO: We should merge this with IEzAbilityEditorPropertyBindingsOwner and FEzAbilityEditorPropertyBindings.
+// // Currently FStateTreeEditorPropertyBindings is meant to be used as a member for just to store things,
+// // IStateTreeEditorPropertyBindingsOwner is meant return model specific stuff,
+// // and IStateTreeBindingLookup is used in non-editor code and it cannot be in FStateTreeEditorPropertyBindings because bindings don't know about the owner.
+// struct EZABILITYEDITOR_API FEzAbilityBindingLookup : public IEzAbilityBindingLookup
+// {
+// 	FEzAbilityBindingLookup(IEzAbilityEditorPropertyBindingsOwner* InBindingOwner);
+//
+// 	IEzAbilityEditorPropertyBindingsOwner* BindingOwner = nullptr;
+//
+// protected:
+// 	virtual const FEzAbilityPropertyPath* GetPropertyBindingSource(const FEzAbilityPropertyPath& InTargetPath) const override;
+// 	virtual FText GetPropertyPathDisplayName(const FEzAbilityPropertyPath& InTargetPath) const override;
+// 	virtual const FProperty* GetPropertyPathLeafProperty(const FEzAbilityPropertyPath& InPath) const override;
+//
+// };

+ 67 - 0
Ability/Plugins/EzAbility/Source/EzAbilityTest/EzAbilityTest.Build.cs

@@ -0,0 +1,67 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+using UnrealBuildTool;
+
+public class EzAbilityTest : ModuleRules
+{
+	public EzAbilityTest(ReadOnlyTargetRules Target) : base(Target)
+	{
+		PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
+		
+		PublicIncludePaths.AddRange(
+			new string[] {
+				// ... add public include paths required here ...
+			}
+			);
+				
+		
+		PrivateIncludePaths.AddRange(
+			new string[] {
+				// ... add other private include paths required here ...
+			}
+			);
+			
+		
+		PublicDependencyModuleNames.AddRange(
+			new string[]
+			{
+				"Core",
+				// ... add other public dependencies that you statically link with here ...
+				"CoreUObject",
+				"Engine",
+				"AIModule",
+				"AITestSuite",
+				"StructUtils",
+				"GameplayTags",
+				"EzAbility",
+				"EzAbilityEditor"
+			}
+			);
+			
+		
+		PrivateDependencyModuleNames.AddRange(
+			new string[]
+			{
+				"CoreUObject",
+				"Engine",
+				"Slate",
+				"SlateCore",
+				// ... add private dependencies that you statically link with here ...	
+			}
+			);
+		
+		
+		DynamicallyLoadedModuleNames.AddRange(
+			new string[]
+			{
+				// ... add any modules that your module loads dynamically here ...
+			}
+			);
+		
+		if (Target.bBuildEditor == true)
+		{
+			PrivateDependencyModuleNames.Add("EditorFramework");
+			PrivateDependencyModuleNames.Add("UnrealEd");
+		}
+	}
+}

+ 45 - 0
Ability/Plugins/EzAbility/Source/EzAbilityTest/Private/EzAbilityTest.cpp

@@ -0,0 +1,45 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+
+#include "EzAbilityTest.h"
+
+#include "AITestsCommon.h"
+#include "EzAbility.h"
+
+namespace UE::EzAbility::Tests
+{
+	UEzAbility& NewAbility(UObject* Outer = GetTransientPackage())
+	{
+		UEzAbility* Ability = NewObject<UEzAbility>(Outer);
+		check(Ability);
+		// UStateTreeEditorData* EditorData = NewObject<UStateTreeEditorData>(Ability);
+		// check(EditorData);
+		// StateTree->EditorData = EditorData;
+		// EditorData->Schema = NewObject<UStateTreeTestSchema>();
+		return *Ability;
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+///
+struct FEzAbilityTest_MakeAndBakeEzAbility : FAITestBase
+{
+	virtual bool InstantTest() override
+	{
+		return true;
+	}
+};
+
+IMPLEMENT_AI_INSTANT_TEST(FEzAbilityTest_MakeAndBakeEzAbility, "System.EzAbility.MakeAndBakeAbility");
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+///
+struct FEzAbilityTest_EmptyStateTree : FAITestBase
+{
+	virtual bool InstantTest() override
+	{
+		return true;
+	}
+};
+
+IMPLEMENT_AI_INSTANT_TEST(FEzAbilityTest_EmptyStateTree, "System.EzAbility.EmptyAbility");

+ 16 - 0
Ability/Plugins/EzAbility/Source/EzAbilityTest/Private/EzAbilityTest.h

@@ -0,0 +1,16 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "UObject/Object.h"
+#include "EzAbilityTest.generated.h"
+
+/**
+ * 
+ */
+UCLASS()
+class EZABILITYTEST_API UEzAbilityTest : public UObject
+{
+	GENERATED_BODY()
+};

+ 20 - 0
Ability/Plugins/EzAbility/Source/EzAbilityTest/Private/EzAbilityTestModule.cpp

@@ -0,0 +1,20 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#include "EzAbilityTestModule.h"
+
+#define LOCTEXT_NAMESPACE "FEzAbilityTestModule"
+
+void FEzAbilityTestModule::StartupModule()
+{
+	// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
+}
+
+void FEzAbilityTestModule::ShutdownModule()
+{
+	// This function may be called during shutdown to clean up your module.  For modules that support dynamic reloading,
+	// we call this function before unloading the module.
+}
+
+#undef LOCTEXT_NAMESPACE
+	
+IMPLEMENT_MODULE(FEzAbilityTestModule, EzAbilityTest)

+ 15 - 0
Ability/Plugins/EzAbility/Source/EzAbilityTest/Public/EzAbilityTestModule.h

@@ -0,0 +1,15 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Modules/ModuleManager.h"
+
+class FEzAbilityTestModule : public IModuleInterface
+{
+public:
+
+	/** IModuleInterface implementation */
+	virtual void StartupModule() override;
+	virtual void ShutdownModule() override;
+};