Compare commits

...

3 Commits

24 changed files with 1219 additions and 99 deletions

View File

@@ -30,6 +30,9 @@ NetIndexFirstBitSegment=16
+GameplayTagList=(Tag="GameEvents",DevComment="")
+GameplayTagList=(Tag="GameEvents.BazarOpen",DevComment="")
+GameplayTagList=(Tag="GameEvents.Birthday.Yuki",DevComment="")
+GameplayTagList=(Tag="GameEvents.Character",DevComment="")
+GameplayTagList=(Tag="GameEvents.Character.Trish",DevComment="")
+GameplayTagList=(Tag="GameEvents.Character.Trish.Meet",DevComment="")
+GameplayTagList=(Tag="GameEvents.World.Time",DevComment="")
+GameplayTagList=(Tag="GameEvents.World.Time.NewDay",DevComment="")
+GameplayTagList=(Tag="GameEvents.World.Weather",DevComment="")

Binary file not shown.

View File

@@ -9,6 +9,7 @@
#include "Speech.h"
#include "SpeechDataAsset.h"
#include "Kismet/GameplayStatics.h"
#include "NPC/NpcBaseCharacter.h"
#include "ProjectEleri/GameEventSystem/GameEventSubsystem.h"
#include "QuestSystem/QuestSubsystem.h"
@@ -43,42 +44,25 @@ void UDialogueComponent::OnDialogueLoaded()
}
}
void UDialogueComponent::FilterSpeechData()
{
ActiveSpeechData.Empty();
for (int i = 0; i < SpeechData.Num(); ++i)
{
//Check if speech event condition is met
ActiveSpeechData.Add(SpeechData[i]);
}
}
void UDialogueComponent::StartDialogueWithNpc()
{
UDialogueSubsystem* DialogueSubsystem = UDialogueSubsystem::Get(this);
ensure(DialogueSubsystem);
const ANpcBaseCharacter* NpcBaseCharacter = Cast<ANpcBaseCharacter>(GetOwner());
if (!NpcBaseCharacter || !NpcBaseCharacter->GetStartingSpeech().IsValid()) return;
// The NPC goes in with it, so that whoever is being talked to can be told apart from the rest of
// the town. This component lives on the actor the player talks to, which makes GetOwner the
// answer, and it is the single funnel every dialogue goes through.
if (!DialogueSubsystem->StartDialogue(GetOwner())) return;
MappedDialogueOptions.Empty();
FilterSpeechData();
USpeechDataAsset* StartingDialogue = NpcBaseCharacter->GetStartingSpeech().Get();
TArray<USpeechDataAsset*> StartingDialogues = GetStartingDialogues();
if (StartingDialogues.IsEmpty()) return;
if (!StartingDialogues.IsEmpty()) StartingDialogue = StartingDialogues[0];
TriggerDialogue(StartingDialogues[FMath::RandRange(0, StartingDialogues.Num() - 1)], CurrentDialogueReplacementMap);
TArray<USpeechDataAsset*> ActiveDialogues = GetActiveDialogues();
TArray<FText> PlayerAsks = GetPlayerAsksFromDialogueList(ActiveDialogues);
for (int32 i = 0; i < ActiveDialogues.Num() - 1; i++)
{
FPlayerSpeakToDialogue SpeakToDialogue;
SpeakToDialogue.NextSpeechDataAsset = ActiveDialogues[i];
MappedDialogueOptions.Add(i, SpeakToDialogue);
}
TriggerDialogueSelect(PlayerAsks, true);
MappedDialogueOptions.Empty();
TriggerDialogue(StartingDialogue, CurrentDialogueReplacementMap);
}
void UDialogueComponent::TriggerDialogue_Async(TSoftObjectPtr<USpeechDataAsset> DialogueAssetPath, const TMap<FString, FText>& ReplacementMap)
@@ -111,42 +95,35 @@ void UDialogueComponent::TriggerDialogue(USpeechDataAsset* DialogueAssetPath, co
CurrentDialogueReplacementMap = ReplacementMap;
DialogueWidget->DisplayDialogue(CurrentActiveDialogue, GetOwner(), CurrentDialogueReplacementMap);
if (DialogueAssetPath->RandomizeLines && !DialogueAssetPath->PlayerSpeechMap.IsEmpty())
if (!DialogueAssetPath->PlayerSpeechMap.IsEmpty())
{
MappedDialogueOptions.Empty();
TArray<FText> PlayerSpeakOptions;
for (int32 i = 0; i <= CurrentActiveDialogue->PlayerSpeechMap.Num() - 1; i++)
{
if (!CurrentActiveDialogue->PlayerSpeechMap[i].PassesRequirements(this)) continue;
MappedDialogueOptions.Add(i, CurrentActiveDialogue->PlayerSpeechMap[i]);
PlayerSpeakOptions.Add(CurrentActiveDialogue->PlayerSpeechMap[i].PlayerSpeak);
}
//TriggerDialogueSelect(PlayerSpeakOptions, false);
}
DialogueSubsystem->StartDialogue(GetOwner());
}
TArray<USpeechDataAsset*> UDialogueComponent::GetActiveSpeechData() { return ActiveSpeechData; }
TArray<USpeechDataAsset*> UDialogueComponent::GetStartingDialogues()
{
TArray<USpeechDataAsset*> TempSpeechData;
for (int i = 0; i < ActiveSpeechData.Num(); ++i)
for (int i = 0; i < SpeechData.Num(); ++i)
{
if(ActiveSpeechData[i]->TestRequirements(GetWorld()) && ActiveSpeechData[i]->PlayerAsk.IsEmpty())
TempSpeechData.AddUnique(ActiveSpeechData[i]);
}
return TempSpeechData;
}
TArray<USpeechDataAsset*> UDialogueComponent::GetActiveDialogues()
{
TArray<USpeechDataAsset*> TempSpeechData;
for (int i = 0; i < ActiveSpeechData.Num(); ++i)
{
if(ActiveSpeechData[i]->TestRequirements(GetWorld()) && !ActiveSpeechData[i]->PlayerAsk.IsEmpty())
TempSpeechData.AddUnique(ActiveSpeechData[i]);
if( !SpeechData[i]->bIsStartingDialogue ||
!SpeechData[i]->PlayerAsk.IsEmpty() ||
!SpeechData[i]->TestRequirements(GetWorld()))
{
continue;
}
TempSpeechData.AddUnique(SpeechData[i]);
}
return TempSpeechData;
@@ -200,11 +177,11 @@ void UDialogueComponent::AdvanceDialogue()
{
for (const FGameplayTag& QuestTag : CurrentActiveDialogue->StartQuests)
{
UQuestSubsystem::Get(this)->OfferQuest(QuestTag);
UQuestSubsystem::Get(this)->StartQuest(QuestTag);
}
}
if (!CurrentActiveDialogue->RandomizeLines && (CurrentLineIndex < CurrentActiveDialogue->DialogueLines.Num() - 1))
if (CurrentLineIndex < CurrentActiveDialogue->DialogueLines.Num() - 1)
{
CurrentLineIndex++;
DialogueWidget->AdvanceDialogue(CurrentActiveDialogue->DialogueLines[CurrentLineIndex].DialogueLine, CurrentActiveDialogue->DialogueLines[CurrentLineIndex].SpeakerName);
@@ -217,11 +194,16 @@ void UDialogueComponent::AdvanceDialogue()
TArray<FText> PlayerSpeakOptions;
for (int32 i = 0; i <= CurrentActiveDialogue->PlayerSpeechMap.Num() - 1; i++)
{
if (!CurrentActiveDialogue->PlayerSpeechMap[i].PassesRequirements(this)) continue;
MappedDialogueOptions.Add(i, CurrentActiveDialogue->PlayerSpeechMap[i]);
PlayerSpeakOptions.Add(CurrentActiveDialogue->PlayerSpeechMap[i].PlayerSpeak);
}
TriggerDialogueSelect(PlayerSpeakOptions, false);
return;
if (!PlayerSpeakOptions.IsEmpty())
{
TriggerDialogueSelect(PlayerSpeakOptions, false);
return;
}
}
}

View File

@@ -19,9 +19,7 @@ class PROJECTELERI_API UDialogueComponent : public UActorComponent
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue")
void FilterSpeechData();
// use when you want to chit chat with an npc instead of play a specific dialogue option
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue")
void StartDialogueWithNpc();
@@ -30,15 +28,9 @@ public:
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue", meta = (AutoCreateRefTerm = "ReplacementMap"))
void TriggerDialogue(USpeechDataAsset* DialogueAssetPath, const TMap<FString, FText>& ReplacementMap);
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue")
TArray<USpeechDataAsset*> GetActiveSpeechData();
//Goes through active speech data and returns the all speech data asset without a condition and player ask
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue")
TArray<USpeechDataAsset*> GetStartingDialogues();
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue")
TArray<USpeechDataAsset*> GetActiveDialogues();
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue")
void SetTextReplacementMap(const TMap<FString, FText>& ReplacementMap);
@@ -67,16 +59,12 @@ protected:
AActor* OwnerActor;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
AEleriPlayerController* EleriPlayerController;
TObjectPtr<UWidgetComponent> DialogueWidgetComponent;
UPROPERTY()
TObjectPtr<UDialogueWidget> DialogueWidget;
UPROPERTY()
TArray<TObjectPtr<USpeechDataAsset>> SpeechData;
UPROPERTY()
TArray<TObjectPtr<USpeechDataAsset>> ActiveSpeechData;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bDialogueSelectOpen = false;

View File

@@ -5,26 +5,71 @@
#include <ProjectEleri/GameEventSystem/GameEventSubsystem.h>
#include <Kismet/GameplayStatics.h>
#include "InventoryComponent.h"
#include "Speech.h"
#include "Misc/DataValidation.h"
#include "QuestSystem/QuestSubsystem.h"
bool USpeechDataAsset::TestRequirements(UWorld* World)
bool FEventRequirement::TestRequirement(const UObject* WorldContext) const
{
UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(World);
const UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(WorldContext);
if (!GameInstance) return false;
if (UGameEventSubsystem* GameEventSubsystem = GameInstance->GetSubsystem<UGameEventSubsystem>())
switch (RequirementType)
{
for (const FEventRequirement& EventReq : EventsMustMeetRequirement)
{
if (EventReq.Stage != GameEventSubsystem->GetEventStage(EventReq.EventAsset))
return false;
}
case EEventRequirementType::Event:
{
const UGameEventSubsystem* GameEventSubsystem = GameInstance->GetSubsystem<UGameEventSubsystem>();
if (!GameEventSubsystem) return false;
const EEventStage EventStage = GameEventSubsystem->GetEventStage(EventAsset);
return bMustAchieveEvent?
EventStage >= Stage :
EventStage < Stage;
}
case EEventRequirementType::Quest:
{
const UQuestSubsystem* QuestSubsystem = GameInstance->GetSubsystem<UQuestSubsystem>();
if (!QuestSubsystem) return false;
const EQuestStatus CurrentQuestStatus = QuestSubsystem->GetQuestStatus(QuestTag);
const bool bMeetsReq = CurrentQuestStatus >= QuestStatus;
return bMeetsReq == bEqual;
}
case EEventRequirementType::Item:
{
const UInventoryComponent* InventoryComponent = UMainBlueprintFunctionLibrary::GetPlayerInventory(WorldContext);
if (!InventoryComponent) return false;
if (InventoryComponent->GetStackForItem(Item) < Stacks)
return false;
return true;
}
case EEventRequirementType::Max:
break;
}
for (const FEventRequirement& EventReq : EventsMustNotMeetRequirement)
{
if (EventReq.Stage == GameEventSubsystem->GetEventStage(EventReq.EventAsset))
return false;
}
return true;
}
bool FPlayerSpeakToDialogue::PassesRequirements(const UObject* WorldContext) const
{
for (const FEventRequirement& Requirement : EventRequirements)
{
if (!Requirement.TestRequirement(WorldContext)) return false;
}
return true;
}
bool USpeechDataAsset::TestRequirements(const UWorld* World)
{
for (const FEventRequirement& EventReq : EventRequirements)
{
if (!EventReq.TestRequirement(World))
return false;
}
return true;
@@ -48,3 +93,15 @@ FText USpeechDataAsset::ReplaceTextInLine(const FText& Text, TMap<FString, FText
return FText::Format(Text, Args);
}
EDataValidationResult USpeechDataAsset::IsDataValid(class FDataValidationContext& Context) const
{
EDataValidationResult Result = Super::IsDataValid(Context);
if (bIsStartingDialogue && EventRequirements.IsEmpty())
{
Context.AddError(FText::FromString(TEXT("Cannot be a starting dialogue without an event requirement")));
Result = EDataValidationResult::Invalid;
}
return Result;
}

View File

@@ -5,23 +5,50 @@
#include "CoreMinimal.h"
#include "Engine/DataAsset.h"
#include "ProjectEleri/GameEventSystem/GameEventDataAsset.h"
#include "QuestSystem/QuestTypes.h"
#include "SpeechDataAsset.generated.h"
struct FLineData;
class USpeechDataAsset;
UENUM(BlueprintType)
enum class EEventRequirementType : uint8
{
Event,
Quest,
Item,
Max UMETA(Hidden)
};
USTRUCT(BlueprintType)
struct FEventRequirement
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, meta = (MetaClass = "/Script/ProjectEleri.GameEventDataAsset"))
FSoftObjectPath EventAsset;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
EEventRequirementType RequirementType;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, meta = (EditCondition = "RequirementType == EEventRequirementType::Event", EditConditionHides, MetaClass = "/Script/ProjectEleri.GameEventDataAsset"))
FSoftObjectPath EventAsset;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, meta = (EditCondition = "RequirementType == EEventRequirementType::Event", EditConditionHides))
EEventStage Stage;
// if this is false the event must not be unlocked
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, meta = (EditCondition = "RequirementType == EEventRequirementType::Event", EditConditionHides))
bool bMustAchieveEvent = true;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, meta = (EditCondition = "RequirementType == EEventRequirementType::Quest", EditConditionHides, GameplayTagFilter = "Quests"))
FGameplayTag QuestTag;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, meta = (EditCondition = "RequirementType == EEventRequirementType::Quest", EditConditionHides, GameplayTagFilter = "Quests"))
EQuestStatus QuestStatus;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, meta = (EditCondition = "RequirementType == EEventRequirementType::Quest", EditConditionHides, GameplayTagFilter = "Quests"))
bool bEqual = true;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, meta = (EditCondition = "RequirementType == EEventRequirementType::Item", EditConditionHides, Categories = "Items"))
FPrimaryAssetId Item;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, meta = (EditCondition = "RequirementType == EEventRequirementType::Item", EditConditionHides))
int32 Stacks = 1;
bool TestRequirement(const UObject* WorldContext) const;
};
USTRUCT(BlueprintType)
@@ -37,6 +64,10 @@ public:
TSoftObjectPtr<USpeechDataAsset> NextSpeechDataAsset;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ForceInlineRow, Categories = "Dialogue|Event"))
FGameplayTag GameplayTag;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Eleri|Event Requirment")
TArray<FEventRequirement> EventRequirements;
bool PassesRequirements(const UObject* WorldContext) const;
};
/**
@@ -49,10 +80,7 @@ class PROJECTELERI_API USpeechDataAsset : public UDataAsset
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Eleri|Event Requirment")
TArray<FEventRequirement> EventsMustMeetRequirement;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Eleri|Event Requirment")
TArray<FEventRequirement> EventsMustNotMeetRequirement;
TArray<FEventRequirement> EventRequirements;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Eleri|Speech")
TSoftClassPtr<AActor> Npc;
@@ -64,7 +92,7 @@ public:
FText PlayerAsk;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Eleri|Speech")
bool RandomizeLines;
bool bIsStartingDialogue;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Eleri|Speech")
TArray<FLineData> DialogueLines;
@@ -73,10 +101,14 @@ public:
TArray<FPlayerSpeakToDialogue> PlayerSpeechMap;
UFUNCTION()
bool TestRequirements(UWorld* World);
bool TestRequirements(const UWorld* World);
UFUNCTION(BlueprintCallable, Category = "Eleri|Options")
FText GetFormattedDialogueLine(const int32 Index, const TMap<FString, FText> ReplacementMap);
UFUNCTION(BlueprintPure, Category = "Eleri|Options")
static FText ReplaceTextInLine(const FText& Text, TMap<FString, FText> ReplacementMap);
#if WITH_EDITOR
virtual EDataValidationResult IsDataValid(class FDataValidationContext& Context) const override;
#endif
};

View File

@@ -9,6 +9,7 @@
#include "ProjectEleri/NPC/ExtendedPawnMovement.h"
#include "ProjectEleri/NPC/NpcStateMachineComponent.h"
#include "ProjectEleri/Public/InventoryComponent.h"
#include "ProjectEleri/DialogueSystem/SpeechDataAsset.h"
ANpcBaseCharacter::ANpcBaseCharacter()
{
@@ -78,10 +79,7 @@ void ANpcBaseCharacter::BeginPlay()
{
Super::BeginPlay();
// There is nothing to start here. The state machine waits to be told what to do by the schedule
// component, which is what keeps an NPC the player never goes near from doing any work at all, and
// an NPC with no schedule component simply stands where it was placed because nothing ever tells
// it about an assignment.
NpcCharacterData.StartingSpeech.LoadSynchronous();
}
void ANpcBaseCharacter::ToggleInteractableUI_Implementation(bool bActive)

View File

@@ -9,6 +9,7 @@
#include "Interface/InteractableActorInterface.h"
#include "NpcBaseCharacter.generated.h"
class USpeechDataAsset;
class UCapsuleComponent;
class UEleriFlipbookComponent;
class UExtendedPawnMovement;
@@ -26,6 +27,9 @@ struct FNpcCharacterData
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FText NpcName;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSoftObjectPtr<USpeechDataAsset> StartingSpeech;
};
/**
@@ -78,6 +82,7 @@ public:
UNpcStateMachineComponent* GetNpcStateMachine() const { return StateMachineComponent; }
virtual void ToggleInteractableUI_Implementation(bool bActive) override;
TSoftObjectPtr<USpeechDataAsset> GetStartingSpeech() const { return NpcCharacterData.StartingSpeech; }
protected:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Components")

View File

@@ -36,7 +36,7 @@ void UInventoryComponent::BeginPlay()
InitializeInventory();
}
int32 UInventoryComponent::HasItem(FPrimaryAssetId ItemId, bool HQ)
int32 UInventoryComponent::HasItem(FPrimaryAssetId ItemId, bool HQ) const
{
for (int32 i = 0; i < ItemList.Num(); i++)
{
@@ -131,7 +131,7 @@ void UInventoryComponent::EmptyInventory()
OnInventoryUpdated.Broadcast();
}
int32 UInventoryComponent::GetStackForItem(FPrimaryAssetId ItemId, bool HQ)
int32 UInventoryComponent::GetStackForItem(FPrimaryAssetId ItemId, bool HQ) const
{
for (int32 i = 0; i < ItemList.Num(); i++)
{

View File

@@ -129,10 +129,10 @@ public:
void EmptyInventory();
UFUNCTION(BlueprintCallable)
int32 GetStackForItem(FPrimaryAssetId ItemId, bool HQ = false);
int32 GetStackForItem(FPrimaryAssetId ItemId, bool HQ = false) const;
UFUNCTION(BlueprintCallable)
int32 HasItem(FPrimaryAssetId ItemToCheck, bool HQ = false);
int32 HasItem(FPrimaryAssetId ItemToCheck, bool HQ = false) const;
UFUNCTION(BlueprintCallable)
TArray<FPrimaryAssetId> GetItemAssetIds();

View File

@@ -0,0 +1,45 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "EleriAssetCategory.h"
#include "AssetToolsModule.h"
#include "IAssetTools.h"
#include "Internationalization/Text.h"
#include "Modules/ModuleManager.h"
#define LOCTEXT_NAMESPACE "EleriAssetCategory"
namespace EleriAssetCategory
{
const FAssetCategoryPath& Get()
{
// A function-local static rather than a namespace-scope global: LOCTEXT has to run once the
// localization system is up, which this module's static initialisers cannot count on.
static const FAssetCategoryPath Category(LOCTEXT("Category", "Eleri"));
return Category;
}
uint32 GetLegacyCategoryBit()
{
// The new Content Browser places a factory by the category path of the asset definition behind the
// class it supports. The older one still files the Add menu by an EAssetTypeCategories bitmask, and
// a bit for a category of our own only exists once someone has registered it. Doing that here, once
// and lazily, is what keeps the two paths pointing at the same entry instead of at two nearly
// identical ones.
static const uint32 Bit = []()
{
IAssetTools& AssetTools = FModuleManager::LoadModuleChecked<FAssetToolsModule>(TEXT("AssetTools")).Get();
// The key the engine groups by is the source string of the path's first entry rather than the
// localized one, so an editor running in another language still lands in the same category.
const FAssetCategoryPath& Category = Get();
return (uint32)AssetTools.RegisterAdvancedAssetCategory(
FName(*FTextInspector::GetSourceString(Category.GetCategoryText())),
Category.GetCategoryText());
}();
return Bit;
}
}
#undef LOCTEXT_NAMESPACE

View File

@@ -0,0 +1,26 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Misc/AssetCategoryPath.h"
/**
* The one category every data asset type of this project is filed under in the Content Browser.
*
* A category is a path rather than an enum entry: the asset definition a data asset type is described by
* hands this path to the engine, the engine derives the key it groups by from the path's source string,
* and both the Filters panel and the Add menu read that same list. Registering it with the Asset Tools
* as well is only what the older Content Browser style needs, which still files the Add menu by the
* EAssetTypeCategories bitmask instead of by the path.
*/
namespace EleriAssetCategory
{
/** The shared category path. The reference is to a function-local static, so it is safe to copy from
* a definition's initialiser, but it must not be held on to once the module has been shut down. */
const FAssetCategoryPath& Get();
/** The EAssetTypeCategories bit for this category, for UFactory::GetMenuCategories(). Registered on
* the first call and the same value on every call after it. */
uint32 GetLegacyCategoryBit();
}

View File

@@ -0,0 +1,253 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "EleriDataAssetDefinitions.h"
#include "EleriAssetCategory.h"
#include "ProjectEleri/Ai/NpcScheduleAsset.h"
#include "ProjectEleri/Animation/AnimationDataAsset.h"
#include "ProjectEleri/Data/BazarSettingsDataAsset.h"
#include "ProjectEleri/Data/FaceExpressionDataAsset.h"
#include "ProjectEleri/Data/Minigames/BaseMinigameDataAsset.h"
#include "ProjectEleri/Data/NpcDataAsset.h"
#include "ProjectEleri/Data/WeatherPresetDataAsset.h"
#include "ProjectEleri/DialogueSystem/QuestDatabase.h"
#include "ProjectEleri/DialogueSystem/SpeechDataAsset.h"
#include "ProjectEleri/GameEventSystem/GameEventDataAsset.h"
#include "ProjectEleri/Items/DataAssets/ItemDataAsset.h"
#include "ProjectEleri/Items/ItemContainer.h"
#include "ProjectEleri/QuestSystem/QuestDataAsset.h"
#define LOCTEXT_NAMESPACE "EleriDataAssetDefinitions"
/*-----------------------------------------------------------------------------
Shared behaviour
-----------------------------------------------------------------------------*/
TConstArrayView<FAssetCategoryPath> UEleriDataAssetDefinition::GetAssetCategories() const
{
// One entry, the same for every definition in here. It has to outlive the call, because the engine
// keeps the view it is handed rather than copying it.
static const TArray<FAssetCategoryPath> Categories = { EleriAssetCategory::Get() };
return Categories;
}
/*-----------------------------------------------------------------------------
Items
-----------------------------------------------------------------------------*/
FText UEleriItemDataAssetDefinition::GetAssetDisplayName() const
{
return LOCTEXT("ItemDataAssetName", "Item");
}
FLinearColor UEleriItemDataAssetDefinition::GetAssetColor() const
{
return FLinearColor(0.86f, 0.33f, 0.10f);
}
TSoftClassPtr<UObject> UEleriItemDataAssetDefinition::GetAssetClass() const
{
return UItemDataAsset::StaticClass();
}
FText UEleriItemContainerDefinition::GetAssetDisplayName() const
{
return LOCTEXT("ItemContainerName", "Item Container");
}
FLinearColor UEleriItemContainerDefinition::GetAssetColor() const
{
return FLinearColor(0.85f, 0.55f, 0.10f);
}
TSoftClassPtr<UObject> UEleriItemContainerDefinition::GetAssetClass() const
{
return UItemContainer::StaticClass();
}
/*-----------------------------------------------------------------------------
Quests and dialogue
-----------------------------------------------------------------------------*/
FText UEleriQuestDataAssetDefinition::GetAssetDisplayName() const
{
return LOCTEXT("QuestDataAssetName", "Quest");
}
FLinearColor UEleriQuestDataAssetDefinition::GetAssetColor() const
{
return FLinearColor(0.95f, 0.80f, 0.15f);
}
TSoftClassPtr<UObject> UEleriQuestDataAssetDefinition::GetAssetClass() const
{
return UQuestDataAsset::StaticClass();
}
FText UEleriQuestDatabaseDefinition::GetAssetDisplayName() const
{
return LOCTEXT("QuestDatabaseName", "Quest Database");
}
FLinearColor UEleriQuestDatabaseDefinition::GetAssetColor() const
{
return FLinearColor(0.65f, 0.62f, 0.15f);
}
TSoftClassPtr<UObject> UEleriQuestDatabaseDefinition::GetAssetClass() const
{
return UQuestDatabase::StaticClass();
}
FText UEleriSpeechDataAssetDefinition::GetAssetDisplayName() const
{
return LOCTEXT("SpeechDataAssetName", "Speech");
}
FLinearColor UEleriSpeechDataAssetDefinition::GetAssetColor() const
{
return FLinearColor(0.35f, 0.70f, 0.85f);
}
TSoftClassPtr<UObject> UEleriSpeechDataAssetDefinition::GetAssetClass() const
{
return USpeechDataAsset::StaticClass();
}
/*-----------------------------------------------------------------------------
World events and weather
-----------------------------------------------------------------------------*/
FText UEleriGameEventDataAssetDefinition::GetAssetDisplayName() const
{
return LOCTEXT("GameEventDataAssetName", "Game Event");
}
FLinearColor UEleriGameEventDataAssetDefinition::GetAssetColor() const
{
return FLinearColor(0.60f, 0.35f, 0.85f);
}
TSoftClassPtr<UObject> UEleriGameEventDataAssetDefinition::GetAssetClass() const
{
return UGameEventDataAsset::StaticClass();
}
FText UEleriWeatherPresetDataAssetDefinition::GetAssetDisplayName() const
{
return LOCTEXT("WeatherPresetDataAssetName", "Weather Preset");
}
FLinearColor UEleriWeatherPresetDataAssetDefinition::GetAssetColor() const
{
return FLinearColor(0.30f, 0.60f, 0.90f);
}
TSoftClassPtr<UObject> UEleriWeatherPresetDataAssetDefinition::GetAssetClass() const
{
return UWeatherPresetDataAsset::StaticClass();
}
/*-----------------------------------------------------------------------------
Characters
-----------------------------------------------------------------------------*/
FText UEleriFaceExpressionDataAssetDefinition::GetAssetDisplayName() const
{
return LOCTEXT("FaceExpressionDataAssetName", "Face Expression");
}
FLinearColor UEleriFaceExpressionDataAssetDefinition::GetAssetColor() const
{
return FLinearColor(0.95f, 0.55f, 0.70f);
}
TSoftClassPtr<UObject> UEleriFaceExpressionDataAssetDefinition::GetAssetClass() const
{
return UFaceExpressionDataAsset::StaticClass();
}
FText UEleriNpcDataAssetDefinition::GetAssetDisplayName() const
{
return LOCTEXT("NpcDataAssetName", "NPC");
}
FLinearColor UEleriNpcDataAssetDefinition::GetAssetColor() const
{
return FLinearColor(0.30f, 0.75f, 0.55f);
}
TSoftClassPtr<UObject> UEleriNpcDataAssetDefinition::GetAssetClass() const
{
return UNpcDataAsset::StaticClass();
}
FText UEleriNpcScheduleAssetDefinition::GetAssetDisplayName() const
{
return LOCTEXT("NpcScheduleAssetName", "NPC Schedule");
}
FLinearColor UEleriNpcScheduleAssetDefinition::GetAssetColor() const
{
return FLinearColor(0.20f, 0.60f, 0.45f);
}
TSoftClassPtr<UObject> UEleriNpcScheduleAssetDefinition::GetAssetClass() const
{
return UNpcScheduleAsset::StaticClass();
}
/*-----------------------------------------------------------------------------
Settings, animation and minigames
-----------------------------------------------------------------------------*/
FText UEleriBazarSettingsDataAssetDefinition::GetAssetDisplayName() const
{
return LOCTEXT("BazarSettingsDataAssetName", "Bazar Settings");
}
FLinearColor UEleriBazarSettingsDataAssetDefinition::GetAssetColor() const
{
return FLinearColor(0.80f, 0.45f, 0.25f);
}
TSoftClassPtr<UObject> UEleriBazarSettingsDataAssetDefinition::GetAssetClass() const
{
return UBazarSettingsDataAsset::StaticClass();
}
FText UEleriAnimationDataAssetDefinition::GetAssetDisplayName() const
{
return LOCTEXT("AnimationDataAssetName", "Animation");
}
FLinearColor UEleriAnimationDataAssetDefinition::GetAssetColor() const
{
return FLinearColor(0.45f, 0.45f, 0.85f);
}
TSoftClassPtr<UObject> UEleriAnimationDataAssetDefinition::GetAssetClass() const
{
return UAnimationDataAsset::StaticClass();
}
FText UEleriMinigameDataAssetDefinition::GetAssetDisplayName() const
{
return LOCTEXT("MinigameDataAssetName", "Minigame");
}
FLinearColor UEleriMinigameDataAssetDefinition::GetAssetColor() const
{
return FLinearColor(0.85f, 0.30f, 0.55f);
}
TSoftClassPtr<UObject> UEleriMinigameDataAssetDefinition::GetAssetClass() const
{
// The base class, deliberately: the engine answers for a class with the definition registered for
// its nearest ancestor that has one, so this single entry covers Potion Sort and every minigame
// added after it without any of them having to be listed here.
return UBaseMinigameDataAsset::StaticClass();
}
#undef LOCTEXT_NAMESPACE

View File

@@ -0,0 +1,235 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AssetDefinitionDefault.h"
#include "EleriDataAssetDefinitions.generated.h"
/**
* One asset definition per data asset type of the project, all of them filed under the Eleri category.
*
* A definition is what tells the editor what a data asset type is called, what colour it is drawn in and
* which category it belongs to. Both halves of the Content Browser read that: the Filters panel builds a
* filter per definition out of it, and the Add menu files the factory behind a type by the category of
* the definition registered for the class that factory makes. A type therefore only has to say that it
* is an Eleri asset in one place to turn up in both.
*
* The engine registers these itself as the module loads, one per class, so there is nothing to do at
* startup beyond declaring them. A definition also answers for the subclasses of its class, which is why
* the minigame entry below is declared on the base and covers every minigame there is.
*/
UCLASS(Abstract)
class UEleriDataAssetDefinition : public UAssetDefinitionDefault
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual TConstArrayView<FAssetCategoryPath> GetAssetCategories() const override;
// End UAssetDefinition
};
/*-----------------------------------------------------------------------------
Items
-----------------------------------------------------------------------------*/
/** An item: the thing a player can hold, gather, grow or craft. */
UCLASS()
class UEleriItemDataAssetDefinition : public UEleriDataAssetDefinition
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual FText GetAssetDisplayName() const override;
virtual FLinearColor GetAssetColor() const override;
virtual TSoftClassPtr<UObject> GetAssetClass() const override;
// End UAssetDefinition
};
/** A container: a named set of items, used where an inventory has to start with something in it. */
UCLASS()
class UEleriItemContainerDefinition : public UEleriDataAssetDefinition
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual FText GetAssetDisplayName() const override;
virtual FLinearColor GetAssetColor() const override;
virtual TSoftClassPtr<UObject> GetAssetClass() const override;
// End UAssetDefinition
};
/*-----------------------------------------------------------------------------
Quests and dialogue
-----------------------------------------------------------------------------*/
/** A quest: its steps, the conditions it can be taken under and what it hands back. */
UCLASS()
class UEleriQuestDataAssetDefinition : public UEleriDataAssetDefinition
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual FText GetAssetDisplayName() const override;
virtual FLinearColor GetAssetColor() const override;
virtual TSoftClassPtr<UObject> GetAssetClass() const override;
// End UAssetDefinition
};
/** The quest database: the asset every quest is looked up through. */
UCLASS()
class UEleriQuestDatabaseDefinition : public UEleriDataAssetDefinition
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual FText GetAssetDisplayName() const override;
virtual FLinearColor GetAssetColor() const override;
virtual TSoftClassPtr<UObject> GetAssetClass() const override;
// End UAssetDefinition
};
/** Speech: the lines an NPC says, and how they are said. */
UCLASS()
class UEleriSpeechDataAssetDefinition : public UEleriDataAssetDefinition
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual FText GetAssetDisplayName() const override;
virtual FLinearColor GetAssetColor() const override;
virtual TSoftClassPtr<UObject> GetAssetClass() const override;
// End UAssetDefinition
};
/*-----------------------------------------------------------------------------
World events and weather
-----------------------------------------------------------------------------*/
/** A game event: something the world does on a day, a condition or a trigger. */
UCLASS()
class UEleriGameEventDataAssetDefinition : public UEleriDataAssetDefinition
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual FText GetAssetDisplayName() const override;
virtual FLinearColor GetAssetColor() const override;
virtual TSoftClassPtr<UObject> GetAssetClass() const override;
// End UAssetDefinition
};
/** A weather preset: the sky, the fog and the particles one kind of weather is made of. */
UCLASS()
class UEleriWeatherPresetDataAssetDefinition : public UEleriDataAssetDefinition
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual FText GetAssetDisplayName() const override;
virtual FLinearColor GetAssetColor() const override;
virtual TSoftClassPtr<UObject> GetAssetClass() const override;
// End UAssetDefinition
};
/*-----------------------------------------------------------------------------
Characters
-----------------------------------------------------------------------------*/
/** A face expression set: the sprites each of an NPC's moods is drawn from. */
UCLASS()
class UEleriFaceExpressionDataAssetDefinition : public UEleriDataAssetDefinition
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual FText GetAssetDisplayName() const override;
virtual FLinearColor GetAssetColor() const override;
virtual TSoftClassPtr<UObject> GetAssetClass() const override;
// End UAssetDefinition
};
/** An NPC: who they are, how they look and what they are called. */
UCLASS()
class UEleriNpcDataAssetDefinition : public UEleriDataAssetDefinition
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual FText GetAssetDisplayName() const override;
virtual FLinearColor GetAssetColor() const override;
virtual TSoftClassPtr<UObject> GetAssetClass() const override;
// End UAssetDefinition
};
/** An NPC schedule: a day of a character, as a list of places and the times they are in them. */
UCLASS()
class UEleriNpcScheduleAssetDefinition : public UEleriDataAssetDefinition
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual FText GetAssetDisplayName() const override;
virtual FLinearColor GetAssetColor() const override;
virtual TSoftClassPtr<UObject> GetAssetClass() const override;
// End UAssetDefinition
};
/*-----------------------------------------------------------------------------
Settings, animation and minigames
-----------------------------------------------------------------------------*/
/** The bazar settings: what the market spawns, how often and how it pays. */
UCLASS()
class UEleriBazarSettingsDataAssetDefinition : public UEleriDataAssetDefinition
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual FText GetAssetDisplayName() const override;
virtual FLinearColor GetAssetColor() const override;
virtual TSoftClassPtr<UObject> GetAssetClass() const override;
// End UAssetDefinition
};
/** An animation set: which flipbook an action of a character plays. */
UCLASS()
class UEleriAnimationDataAssetDefinition : public UEleriDataAssetDefinition
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual FText GetAssetDisplayName() const override;
virtual FLinearColor GetAssetColor() const override;
virtual TSoftClassPtr<UObject> GetAssetClass() const override;
// End UAssetDefinition
};
/** A minigame: the rules and the content one minigame is set up with. Declared on the base class, so
* this one entry stands in for every minigame in the project, Potion Sort included. */
UCLASS()
class UEleriMinigameDataAssetDefinition : public UEleriDataAssetDefinition
{
GENERATED_BODY()
public:
// UAssetDefinition
virtual FText GetAssetDisplayName() const override;
virtual FLinearColor GetAssetColor() const override;
virtual TSoftClassPtr<UObject> GetAssetClass() const override;
// End UAssetDefinition
};

View File

@@ -0,0 +1,231 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "EleriDataAssetFactories.h"
#include "EleriAssetCategory.h"
#include "Engine/DataAsset.h"
#include "ProjectEleri/Ai/NpcScheduleAsset.h"
#include "ProjectEleri/Animation/AnimationDataAsset.h"
#include "ProjectEleri/Data/BazarSettingsDataAsset.h"
#include "ProjectEleri/Data/FaceExpressionDataAsset.h"
#include "ProjectEleri/Data/Minigames/PotionSortDataAsset.h"
#include "ProjectEleri/Data/NpcDataAsset.h"
#include "ProjectEleri/Data/WeatherPresetDataAsset.h"
#include "ProjectEleri/DialogueSystem/QuestDatabase.h"
#include "ProjectEleri/DialogueSystem/SpeechDataAsset.h"
#include "ProjectEleri/GameEventSystem/GameEventDataAsset.h"
#include "ProjectEleri/Items/DataAssets/ItemDataAsset.h"
#include "ProjectEleri/Items/ItemContainer.h"
#include "ProjectEleri/QuestSystem/QuestDataAsset.h"
#define LOCTEXT_NAMESPACE "EleriDataAssetFactories"
/*-----------------------------------------------------------------------------
Shared behaviour
-----------------------------------------------------------------------------*/
UEleriDataAssetFactory::UEleriDataAssetFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
// What these make is always a data asset, and the class is the only thing that separates one from
// the next, so that is all a subclass has to set. bCreateNew is what admits a factory to the Add
// menu, and bEditAfterNew is what opens the asset once it exists, which for a data asset means the
// details panel a fresh one has to be filled in through.
bCreateNew = true;
bEditAfterNew = true;
bEditorImport = false;
}
bool UEleriDataAssetFactory::ConfigureProperties()
{
// Nothing to ask about. Each factory makes the one class it is named after, so the class picker the
// engine would otherwise open here would be a dialog with a single entry in it.
return true;
}
uint32 UEleriDataAssetFactory::GetMenuCategories() const
{
return EleriAssetCategory::GetLegacyCategoryBit();
}
UObject* UEleriDataAssetFactory::FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn)
{
// SupportedClass rather than InClass: the Content Browser runs whichever factory it was asked to,
// and going through this factory's own member keeps the two from ever disagreeing.
UClass* ClassToCreate = SupportedClass.Get();
if (!ensureMsgf(ClassToCreate, TEXT("%s has no supported class, so there is nothing to create"), *GetName()))
{
return nullptr;
}
return NewObject<UDataAsset>(InParent, ClassToCreate, InName, Flags | RF_Transactional);
}
/*-----------------------------------------------------------------------------
Items
-----------------------------------------------------------------------------*/
UEleriItemDataAssetFactory::UEleriItemDataAssetFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
SupportedClass = UItemDataAsset::StaticClass();
}
FText UEleriItemDataAssetFactory::GetDisplayName() const
{
return LOCTEXT("ItemFactoryName", "Item");
}
UEleriItemContainerFactory::UEleriItemContainerFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
SupportedClass = UItemContainer::StaticClass();
}
FText UEleriItemContainerFactory::GetDisplayName() const
{
return LOCTEXT("ItemContainerFactoryName", "Item Container");
}
/*-----------------------------------------------------------------------------
Quests and dialogue
-----------------------------------------------------------------------------*/
UEleriQuestDataAssetFactory::UEleriQuestDataAssetFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
SupportedClass = UQuestDataAsset::StaticClass();
}
FText UEleriQuestDataAssetFactory::GetDisplayName() const
{
return LOCTEXT("QuestFactoryName", "Quest");
}
UEleriQuestDatabaseFactory::UEleriQuestDatabaseFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
SupportedClass = UQuestDatabase::StaticClass();
}
FText UEleriQuestDatabaseFactory::GetDisplayName() const
{
return LOCTEXT("QuestDatabaseFactoryName", "Quest Database");
}
UEleriSpeechDataAssetFactory::UEleriSpeechDataAssetFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
SupportedClass = USpeechDataAsset::StaticClass();
}
FText UEleriSpeechDataAssetFactory::GetDisplayName() const
{
return LOCTEXT("SpeechFactoryName", "Speech");
}
/*-----------------------------------------------------------------------------
World events and weather
-----------------------------------------------------------------------------*/
UEleriGameEventDataAssetFactory::UEleriGameEventDataAssetFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
SupportedClass = UGameEventDataAsset::StaticClass();
}
FText UEleriGameEventDataAssetFactory::GetDisplayName() const
{
return LOCTEXT("GameEventFactoryName", "Game Event");
}
UEleriWeatherPresetDataAssetFactory::UEleriWeatherPresetDataAssetFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
SupportedClass = UWeatherPresetDataAsset::StaticClass();
}
FText UEleriWeatherPresetDataAssetFactory::GetDisplayName() const
{
return LOCTEXT("WeatherPresetFactoryName", "Weather Preset");
}
/*-----------------------------------------------------------------------------
Characters
-----------------------------------------------------------------------------*/
UEleriFaceExpressionDataAssetFactory::UEleriFaceExpressionDataAssetFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
SupportedClass = UFaceExpressionDataAsset::StaticClass();
}
FText UEleriFaceExpressionDataAssetFactory::GetDisplayName() const
{
return LOCTEXT("FaceExpressionFactoryName", "Face Expression");
}
UEleriNpcDataAssetFactory::UEleriNpcDataAssetFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
SupportedClass = UNpcDataAsset::StaticClass();
}
FText UEleriNpcDataAssetFactory::GetDisplayName() const
{
return LOCTEXT("NpcFactoryName", "NPC");
}
UEleriNpcScheduleAssetFactory::UEleriNpcScheduleAssetFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
SupportedClass = UNpcScheduleAsset::StaticClass();
}
FText UEleriNpcScheduleAssetFactory::GetDisplayName() const
{
return LOCTEXT("NpcScheduleFactoryName", "NPC Schedule");
}
/*-----------------------------------------------------------------------------
Settings, animation and minigames
-----------------------------------------------------------------------------*/
UEleriBazarSettingsDataAssetFactory::UEleriBazarSettingsDataAssetFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
SupportedClass = UBazarSettingsDataAsset::StaticClass();
}
FText UEleriBazarSettingsDataAssetFactory::GetDisplayName() const
{
return LOCTEXT("BazarSettingsFactoryName", "Bazar Settings");
}
UEleriAnimationDataAssetFactory::UEleriAnimationDataAssetFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
SupportedClass = UAnimationDataAsset::StaticClass();
}
FText UEleriAnimationDataAssetFactory::GetDisplayName() const
{
return LOCTEXT("AnimationFactoryName", "Animation");
}
UEleriPotionSortDataAssetFactory::UEleriPotionSortDataAssetFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
// The concrete minigame rather than the base class the definition sits on: the base exists to be
// inherited from, so offering to make a bare one would only ever produce an asset with nothing in it.
SupportedClass = UPotionSortDataAsset::StaticClass();
}
FText UEleriPotionSortDataAssetFactory::GetDisplayName() const
{
return LOCTEXT("PotionSortFactoryName", "Potion Sort Minigame");
}
#undef LOCTEXT_NAMESPACE

View File

@@ -0,0 +1,238 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Factories/Factory.h"
#include "EleriDataAssetFactories.generated.h"
/**
* The factories behind the data asset types the Eleri category offers, one per type.
*
* A factory is what puts a type into the Content Browser's Add menu, and the engine files it there by
* asking the asset definition of the class it supports where that class belongs, so a factory only has
* to name the class it makes. It also hands back the EAssetTypeCategories bit for the Eleri category,
* which is what the older Content Browser style groups the Add menu by, so the group holds together
* whichever of the two styles is in use.
*
* These only ever create the class they are named after. There is nothing to configure, so the factory
* goes straight to creating the asset as soon as it is picked.
*/
UCLASS(Abstract)
class UEleriDataAssetFactory : public UFactory
{
GENERATED_BODY()
public:
UEleriDataAssetFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual bool ConfigureProperties() override;
virtual uint32 GetMenuCategories() const override;
virtual UObject* FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
// End UFactory
};
/*-----------------------------------------------------------------------------
Items
-----------------------------------------------------------------------------*/
/** Creates a new item data asset. */
UCLASS()
class UEleriItemDataAssetFactory : public UEleriDataAssetFactory
{
GENERATED_BODY()
public:
UEleriItemDataAssetFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual FText GetDisplayName() const override;
// End UFactory
};
/** Creates a new item container. */
UCLASS()
class UEleriItemContainerFactory : public UEleriDataAssetFactory
{
GENERATED_BODY()
public:
UEleriItemContainerFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual FText GetDisplayName() const override;
// End UFactory
};
/*-----------------------------------------------------------------------------
Quests and dialogue
-----------------------------------------------------------------------------*/
/** Creates a new quest. */
UCLASS()
class UEleriQuestDataAssetFactory : public UEleriDataAssetFactory
{
GENERATED_BODY()
public:
UEleriQuestDataAssetFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual FText GetDisplayName() const override;
// End UFactory
};
/** Creates a new quest database. */
UCLASS()
class UEleriQuestDatabaseFactory : public UEleriDataAssetFactory
{
GENERATED_BODY()
public:
UEleriQuestDatabaseFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual FText GetDisplayName() const override;
// End UFactory
};
/** Creates a new speech asset. */
UCLASS()
class UEleriSpeechDataAssetFactory : public UEleriDataAssetFactory
{
GENERATED_BODY()
public:
UEleriSpeechDataAssetFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual FText GetDisplayName() const override;
// End UFactory
};
/*-----------------------------------------------------------------------------
World events and weather
-----------------------------------------------------------------------------*/
/** Creates a new game event. */
UCLASS()
class UEleriGameEventDataAssetFactory : public UEleriDataAssetFactory
{
GENERATED_BODY()
public:
UEleriGameEventDataAssetFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual FText GetDisplayName() const override;
// End UFactory
};
/** Creates a new weather preset. */
UCLASS()
class UEleriWeatherPresetDataAssetFactory : public UEleriDataAssetFactory
{
GENERATED_BODY()
public:
UEleriWeatherPresetDataAssetFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual FText GetDisplayName() const override;
// End UFactory
};
/*-----------------------------------------------------------------------------
Characters
-----------------------------------------------------------------------------*/
/** Creates a new face expression set. */
UCLASS()
class UEleriFaceExpressionDataAssetFactory : public UEleriDataAssetFactory
{
GENERATED_BODY()
public:
UEleriFaceExpressionDataAssetFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual FText GetDisplayName() const override;
// End UFactory
};
/** Creates a new NPC. */
UCLASS()
class UEleriNpcDataAssetFactory : public UEleriDataAssetFactory
{
GENERATED_BODY()
public:
UEleriNpcDataAssetFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual FText GetDisplayName() const override;
// End UFactory
};
/** Creates a new NPC schedule. */
UCLASS()
class UEleriNpcScheduleAssetFactory : public UEleriDataAssetFactory
{
GENERATED_BODY()
public:
UEleriNpcScheduleAssetFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual FText GetDisplayName() const override;
// End UFactory
};
/*-----------------------------------------------------------------------------
Settings, animation and minigames
-----------------------------------------------------------------------------*/
/** Creates a new bazar settings asset. */
UCLASS()
class UEleriBazarSettingsDataAssetFactory : public UEleriDataAssetFactory
{
GENERATED_BODY()
public:
UEleriBazarSettingsDataAssetFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual FText GetDisplayName() const override;
// End UFactory
};
/** Creates a new animation set. */
UCLASS()
class UEleriAnimationDataAssetFactory : public UEleriDataAssetFactory
{
GENERATED_BODY()
public:
UEleriAnimationDataAssetFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual FText GetDisplayName() const override;
// End UFactory
};
/** Creates a new Potion Sort minigame. The category entry it turns up under is declared on the
* minigame base class, so a minigame added later needs its own factory here but no category. */
UCLASS()
class UEleriPotionSortDataAssetFactory : public UEleriDataAssetFactory
{
GENERATED_BODY()
public:
UEleriPotionSortDataAssetFactory(const FObjectInitializer& ObjectInitializer);
// UFactory
virtual FText GetDisplayName() const override;
// End UFactory
};

View File

@@ -13,6 +13,15 @@
#include "NpcScheduleAssetCustomization.h"
#include "ScheduleAssetRecheck.h"
// The asset definitions and factories that file every data asset type of the project under the Eleri
// category in the Content Browser. Nothing below calls into any of them: a definition registers itself
// with the engine as its class is loaded, and the factories are only ever run by the Content Browser, so
// declaring these files here is the whole of the wiring. They are included so that this file states
// where the category comes from rather than leaving it to be found by reading the folder.
#include "Eleri/EleriAssetCategory.h"
#include "Eleri/EleriDataAssetDefinitions.h"
#include "Eleri/EleriDataAssetFactories.h"
#define LOCTEXT_NAMESPACE "ProjectEleriEditorModule"
IMPLEMENT_GAME_MODULE(FProjectEleriEditorModule, ProjectEleriEditor);

View File

@@ -21,6 +21,12 @@ public class ProjectEleriEditor : ModuleRules
"Projects",
"ToolMenus",
"AssetRegistry",
// Asset categories are what the Content Browser files assets by, and in the engine version this
// project builds against a data asset type declares its own category as an asset definition
// rather than as an asset type action. AssetTools is still needed for the category bit the
// older Content Browser style files the Add menu by.
"AssetDefinition",
"AssetTools",
"ContentBrowser",
// The world map builder drives a scene capture and reads the render target back on the CPU, which
// is where the render thread and the pixel formats it copies between come in.