Compare commits
3 Commits
f2115c537b
...
3ba640ac53
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ba640ac53 | |||
| f2acd7eb4c | |||
| b3f4eefe06 |
@@ -30,6 +30,9 @@ NetIndexFirstBitSegment=16
|
|||||||
+GameplayTagList=(Tag="GameEvents",DevComment="")
|
+GameplayTagList=(Tag="GameEvents",DevComment="")
|
||||||
+GameplayTagList=(Tag="GameEvents.BazarOpen",DevComment="")
|
+GameplayTagList=(Tag="GameEvents.BazarOpen",DevComment="")
|
||||||
+GameplayTagList=(Tag="GameEvents.Birthday.Yuki",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",DevComment="")
|
||||||
+GameplayTagList=(Tag="GameEvents.World.Time.NewDay",DevComment="")
|
+GameplayTagList=(Tag="GameEvents.World.Time.NewDay",DevComment="")
|
||||||
+GameplayTagList=(Tag="GameEvents.World.Weather",DevComment="")
|
+GameplayTagList=(Tag="GameEvents.World.Weather",DevComment="")
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
BIN
Content/GameData/Dialogue/Characters/Test/DA_Test_Speech_1.uasset
LFS
Normal file
BIN
Content/GameData/Dialogue/Characters/Test/DA_Test_Speech_1.uasset
LFS
Normal file
Binary file not shown.
BIN
Content/GameData/Dialogue/Characters/Test/DA_Test_StartingDialogue.uasset
LFS
Normal file
BIN
Content/GameData/Dialogue/Characters/Test/DA_Test_StartingDialogue.uasset
LFS
Normal file
Binary file not shown.
BIN
Content/GameData/Dialogue/Characters/Test/S_Trish_MeetDialogue.uasset
LFS
Normal file
BIN
Content/GameData/Dialogue/Characters/Test/S_Trish_MeetDialogue.uasset
LFS
Normal file
Binary file not shown.
BIN
Content/GameData/Events/Characters/Trish/GEDA_TrishMeet.uasset
LFS
Normal file
BIN
Content/GameData/Events/Characters/Trish/GEDA_TrishMeet.uasset
LFS
Normal file
Binary file not shown.
Binary file not shown.
@@ -9,6 +9,7 @@
|
|||||||
#include "Speech.h"
|
#include "Speech.h"
|
||||||
#include "SpeechDataAsset.h"
|
#include "SpeechDataAsset.h"
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
|
#include "NPC/NpcBaseCharacter.h"
|
||||||
#include "ProjectEleri/GameEventSystem/GameEventSubsystem.h"
|
#include "ProjectEleri/GameEventSystem/GameEventSubsystem.h"
|
||||||
#include "QuestSystem/QuestSubsystem.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()
|
void UDialogueComponent::StartDialogueWithNpc()
|
||||||
{
|
{
|
||||||
UDialogueSubsystem* DialogueSubsystem = UDialogueSubsystem::Get(this);
|
UDialogueSubsystem* DialogueSubsystem = UDialogueSubsystem::Get(this);
|
||||||
ensure(DialogueSubsystem);
|
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 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
|
// 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.
|
// answer, and it is the single funnel every dialogue goes through.
|
||||||
if (!DialogueSubsystem->StartDialogue(GetOwner())) return;
|
if (!DialogueSubsystem->StartDialogue(GetOwner())) return;
|
||||||
|
|
||||||
MappedDialogueOptions.Empty();
|
USpeechDataAsset* StartingDialogue = NpcBaseCharacter->GetStartingSpeech().Get();
|
||||||
FilterSpeechData();
|
|
||||||
TArray<USpeechDataAsset*> StartingDialogues = GetStartingDialogues();
|
TArray<USpeechDataAsset*> StartingDialogues = GetStartingDialogues();
|
||||||
if (StartingDialogues.IsEmpty()) return;
|
if (!StartingDialogues.IsEmpty()) StartingDialogue = StartingDialogues[0];
|
||||||
|
|
||||||
TriggerDialogue(StartingDialogues[FMath::RandRange(0, StartingDialogues.Num() - 1)], CurrentDialogueReplacementMap);
|
MappedDialogueOptions.Empty();
|
||||||
|
TriggerDialogue(StartingDialogue, 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDialogueComponent::TriggerDialogue_Async(TSoftObjectPtr<USpeechDataAsset> DialogueAssetPath, const TMap<FString, FText>& ReplacementMap)
|
void UDialogueComponent::TriggerDialogue_Async(TSoftObjectPtr<USpeechDataAsset> DialogueAssetPath, const TMap<FString, FText>& ReplacementMap)
|
||||||
@@ -111,42 +95,35 @@ void UDialogueComponent::TriggerDialogue(USpeechDataAsset* DialogueAssetPath, co
|
|||||||
CurrentDialogueReplacementMap = ReplacementMap;
|
CurrentDialogueReplacementMap = ReplacementMap;
|
||||||
DialogueWidget->DisplayDialogue(CurrentActiveDialogue, GetOwner(), CurrentDialogueReplacementMap);
|
DialogueWidget->DisplayDialogue(CurrentActiveDialogue, GetOwner(), CurrentDialogueReplacementMap);
|
||||||
|
|
||||||
if (DialogueAssetPath->RandomizeLines && !DialogueAssetPath->PlayerSpeechMap.IsEmpty())
|
if (!DialogueAssetPath->PlayerSpeechMap.IsEmpty())
|
||||||
{
|
{
|
||||||
MappedDialogueOptions.Empty();
|
MappedDialogueOptions.Empty();
|
||||||
TArray<FText> PlayerSpeakOptions;
|
TArray<FText> PlayerSpeakOptions;
|
||||||
for (int32 i = 0; i <= CurrentActiveDialogue->PlayerSpeechMap.Num() - 1; i++)
|
for (int32 i = 0; i <= CurrentActiveDialogue->PlayerSpeechMap.Num() - 1; i++)
|
||||||
{
|
{
|
||||||
|
if (!CurrentActiveDialogue->PlayerSpeechMap[i].PassesRequirements(this)) continue;
|
||||||
|
|
||||||
MappedDialogueOptions.Add(i, CurrentActiveDialogue->PlayerSpeechMap[i]);
|
MappedDialogueOptions.Add(i, CurrentActiveDialogue->PlayerSpeechMap[i]);
|
||||||
PlayerSpeakOptions.Add(CurrentActiveDialogue->PlayerSpeechMap[i].PlayerSpeak);
|
PlayerSpeakOptions.Add(CurrentActiveDialogue->PlayerSpeechMap[i].PlayerSpeak);
|
||||||
}
|
}
|
||||||
//TriggerDialogueSelect(PlayerSpeakOptions, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogueSubsystem->StartDialogue(GetOwner());
|
DialogueSubsystem->StartDialogue(GetOwner());
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<USpeechDataAsset*> UDialogueComponent::GetActiveSpeechData() { return ActiveSpeechData; }
|
|
||||||
|
|
||||||
TArray<USpeechDataAsset*> UDialogueComponent::GetStartingDialogues()
|
TArray<USpeechDataAsset*> UDialogueComponent::GetStartingDialogues()
|
||||||
{
|
{
|
||||||
TArray<USpeechDataAsset*> TempSpeechData;
|
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())
|
if( !SpeechData[i]->bIsStartingDialogue ||
|
||||||
TempSpeechData.AddUnique(ActiveSpeechData[i]);
|
!SpeechData[i]->PlayerAsk.IsEmpty() ||
|
||||||
|
!SpeechData[i]->TestRequirements(GetWorld()))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TempSpeechData;
|
TempSpeechData.AddUnique(SpeechData[i]);
|
||||||
}
|
|
||||||
|
|
||||||
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]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TempSpeechData;
|
return TempSpeechData;
|
||||||
@@ -200,11 +177,11 @@ void UDialogueComponent::AdvanceDialogue()
|
|||||||
{
|
{
|
||||||
for (const FGameplayTag& QuestTag : CurrentActiveDialogue->StartQuests)
|
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++;
|
CurrentLineIndex++;
|
||||||
DialogueWidget->AdvanceDialogue(CurrentActiveDialogue->DialogueLines[CurrentLineIndex].DialogueLine, CurrentActiveDialogue->DialogueLines[CurrentLineIndex].SpeakerName);
|
DialogueWidget->AdvanceDialogue(CurrentActiveDialogue->DialogueLines[CurrentLineIndex].DialogueLine, CurrentActiveDialogue->DialogueLines[CurrentLineIndex].SpeakerName);
|
||||||
@@ -217,13 +194,18 @@ void UDialogueComponent::AdvanceDialogue()
|
|||||||
TArray<FText> PlayerSpeakOptions;
|
TArray<FText> PlayerSpeakOptions;
|
||||||
for (int32 i = 0; i <= CurrentActiveDialogue->PlayerSpeechMap.Num() - 1; i++)
|
for (int32 i = 0; i <= CurrentActiveDialogue->PlayerSpeechMap.Num() - 1; i++)
|
||||||
{
|
{
|
||||||
|
if (!CurrentActiveDialogue->PlayerSpeechMap[i].PassesRequirements(this)) continue;
|
||||||
|
|
||||||
MappedDialogueOptions.Add(i, CurrentActiveDialogue->PlayerSpeechMap[i]);
|
MappedDialogueOptions.Add(i, CurrentActiveDialogue->PlayerSpeechMap[i]);
|
||||||
PlayerSpeakOptions.Add(CurrentActiveDialogue->PlayerSpeechMap[i].PlayerSpeak);
|
PlayerSpeakOptions.Add(CurrentActiveDialogue->PlayerSpeechMap[i].PlayerSpeak);
|
||||||
}
|
}
|
||||||
|
if (!PlayerSpeakOptions.IsEmpty())
|
||||||
|
{
|
||||||
TriggerDialogueSelect(PlayerSpeakOptions, false);
|
TriggerDialogueSelect(PlayerSpeakOptions, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CloseDialogue();
|
CloseDialogue();
|
||||||
DialogueSubsystem->OnDialogueEnded.Broadcast();
|
DialogueSubsystem->OnDialogueEnded.Broadcast();
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ class PROJECTELERI_API UDialogueComponent : public UActorComponent
|
|||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
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
|
// use when you want to chit chat with an npc instead of play a specific dialogue option
|
||||||
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue")
|
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue")
|
||||||
@@ -30,16 +28,10 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue", meta = (AutoCreateRefTerm = "ReplacementMap"))
|
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue", meta = (AutoCreateRefTerm = "ReplacementMap"))
|
||||||
void TriggerDialogue(USpeechDataAsset* DialogueAssetPath, const TMap<FString, FText>& 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
|
//Goes through active speech data and returns the all speech data asset without a condition and player ask
|
||||||
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue")
|
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue")
|
||||||
TArray<USpeechDataAsset*> GetStartingDialogues();
|
TArray<USpeechDataAsset*> GetStartingDialogues();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue")
|
|
||||||
TArray<USpeechDataAsset*> GetActiveDialogues();
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue")
|
UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue")
|
||||||
void SetTextReplacementMap(const TMap<FString, FText>& ReplacementMap);
|
void SetTextReplacementMap(const TMap<FString, FText>& ReplacementMap);
|
||||||
|
|
||||||
@@ -68,16 +60,12 @@ protected:
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
AEleriPlayerController* EleriPlayerController;
|
AEleriPlayerController* EleriPlayerController;
|
||||||
|
|
||||||
TObjectPtr<UWidgetComponent> DialogueWidgetComponent;
|
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
TObjectPtr<UDialogueWidget> DialogueWidget;
|
TObjectPtr<UDialogueWidget> DialogueWidget;
|
||||||
|
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
TArray<TObjectPtr<USpeechDataAsset>> SpeechData;
|
TArray<TObjectPtr<USpeechDataAsset>> SpeechData;
|
||||||
|
|
||||||
UPROPERTY()
|
|
||||||
TArray<TObjectPtr<USpeechDataAsset>> ActiveSpeechData;
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
bool bDialogueSelectOpen = false;
|
bool bDialogueSelectOpen = false;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
|||||||
@@ -5,26 +5,71 @@
|
|||||||
#include <ProjectEleri/GameEventSystem/GameEventSubsystem.h>
|
#include <ProjectEleri/GameEventSystem/GameEventSubsystem.h>
|
||||||
#include <Kismet/GameplayStatics.h>
|
#include <Kismet/GameplayStatics.h>
|
||||||
|
|
||||||
|
#include "InventoryComponent.h"
|
||||||
#include "Speech.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 (!GameInstance) return false;
|
||||||
|
|
||||||
if (UGameEventSubsystem* GameEventSubsystem = GameInstance->GetSubsystem<UGameEventSubsystem>())
|
switch (RequirementType)
|
||||||
{
|
{
|
||||||
for (const FEventRequirement& EventReq : EventsMustMeetRequirement)
|
case EEventRequirementType::Event:
|
||||||
{
|
{
|
||||||
if (EventReq.Stage != GameEventSubsystem->GetEventStage(EventReq.EventAsset))
|
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 false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case EEventRequirementType::Max:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const FEventRequirement& EventReq : EventsMustNotMeetRequirement)
|
return true;
|
||||||
{
|
|
||||||
if (EventReq.Stage == GameEventSubsystem->GetEventStage(EventReq.EventAsset))
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
return true;
|
||||||
@@ -48,3 +93,15 @@ FText USpeechDataAsset::ReplaceTextInLine(const FText& Text, TMap<FString, FText
|
|||||||
|
|
||||||
return FText::Format(Text, Args);
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,23 +5,50 @@
|
|||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "Engine/DataAsset.h"
|
#include "Engine/DataAsset.h"
|
||||||
#include "ProjectEleri/GameEventSystem/GameEventDataAsset.h"
|
#include "ProjectEleri/GameEventSystem/GameEventDataAsset.h"
|
||||||
|
#include "QuestSystem/QuestTypes.h"
|
||||||
#include "SpeechDataAsset.generated.h"
|
#include "SpeechDataAsset.generated.h"
|
||||||
|
|
||||||
struct FLineData;
|
struct FLineData;
|
||||||
class USpeechDataAsset;
|
class USpeechDataAsset;
|
||||||
|
|
||||||
|
UENUM(BlueprintType)
|
||||||
|
enum class EEventRequirementType : uint8
|
||||||
|
{
|
||||||
|
Event,
|
||||||
|
Quest,
|
||||||
|
Item,
|
||||||
|
Max UMETA(Hidden)
|
||||||
|
};
|
||||||
|
|
||||||
USTRUCT(BlueprintType)
|
USTRUCT(BlueprintType)
|
||||||
struct FEventRequirement
|
struct FEventRequirement
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, meta = (MetaClass = "/Script/ProjectEleri.GameEventDataAsset"))
|
|
||||||
FSoftObjectPath EventAsset;
|
|
||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
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;
|
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)
|
USTRUCT(BlueprintType)
|
||||||
@@ -37,6 +64,10 @@ public:
|
|||||||
TSoftObjectPtr<USpeechDataAsset> NextSpeechDataAsset;
|
TSoftObjectPtr<USpeechDataAsset> NextSpeechDataAsset;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ForceInlineRow, Categories = "Dialogue|Event"))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ForceInlineRow, Categories = "Dialogue|Event"))
|
||||||
FGameplayTag GameplayTag;
|
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:
|
public:
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Eleri|Event Requirment")
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Eleri|Event Requirment")
|
||||||
TArray<FEventRequirement> EventsMustMeetRequirement;
|
TArray<FEventRequirement> EventRequirements;
|
||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Eleri|Event Requirment")
|
|
||||||
TArray<FEventRequirement> EventsMustNotMeetRequirement;
|
|
||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Eleri|Speech")
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Eleri|Speech")
|
||||||
TSoftClassPtr<AActor> Npc;
|
TSoftClassPtr<AActor> Npc;
|
||||||
@@ -64,7 +92,7 @@ public:
|
|||||||
FText PlayerAsk;
|
FText PlayerAsk;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Eleri|Speech")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Eleri|Speech")
|
||||||
bool RandomizeLines;
|
bool bIsStartingDialogue;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Eleri|Speech")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Eleri|Speech")
|
||||||
TArray<FLineData> DialogueLines;
|
TArray<FLineData> DialogueLines;
|
||||||
@@ -73,10 +101,14 @@ public:
|
|||||||
TArray<FPlayerSpeakToDialogue> PlayerSpeechMap;
|
TArray<FPlayerSpeakToDialogue> PlayerSpeechMap;
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
bool TestRequirements(UWorld* World);
|
bool TestRequirements(const UWorld* World);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Eleri|Options")
|
UFUNCTION(BlueprintCallable, Category = "Eleri|Options")
|
||||||
FText GetFormattedDialogueLine(const int32 Index, const TMap<FString, FText> ReplacementMap);
|
FText GetFormattedDialogueLine(const int32 Index, const TMap<FString, FText> ReplacementMap);
|
||||||
UFUNCTION(BlueprintPure, Category = "Eleri|Options")
|
UFUNCTION(BlueprintPure, Category = "Eleri|Options")
|
||||||
static FText ReplaceTextInLine(const FText& Text, TMap<FString, FText> ReplacementMap);
|
static FText ReplaceTextInLine(const FText& Text, TMap<FString, FText> ReplacementMap);
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
virtual EDataValidationResult IsDataValid(class FDataValidationContext& Context) const override;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "ProjectEleri/NPC/ExtendedPawnMovement.h"
|
#include "ProjectEleri/NPC/ExtendedPawnMovement.h"
|
||||||
#include "ProjectEleri/NPC/NpcStateMachineComponent.h"
|
#include "ProjectEleri/NPC/NpcStateMachineComponent.h"
|
||||||
#include "ProjectEleri/Public/InventoryComponent.h"
|
#include "ProjectEleri/Public/InventoryComponent.h"
|
||||||
|
#include "ProjectEleri/DialogueSystem/SpeechDataAsset.h"
|
||||||
|
|
||||||
ANpcBaseCharacter::ANpcBaseCharacter()
|
ANpcBaseCharacter::ANpcBaseCharacter()
|
||||||
{
|
{
|
||||||
@@ -78,10 +79,7 @@ void ANpcBaseCharacter::BeginPlay()
|
|||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
|
||||||
// There is nothing to start here. The state machine waits to be told what to do by the schedule
|
NpcCharacterData.StartingSpeech.LoadSynchronous();
|
||||||
// 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.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ANpcBaseCharacter::ToggleInteractableUI_Implementation(bool bActive)
|
void ANpcBaseCharacter::ToggleInteractableUI_Implementation(bool bActive)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "Interface/InteractableActorInterface.h"
|
#include "Interface/InteractableActorInterface.h"
|
||||||
#include "NpcBaseCharacter.generated.h"
|
#include "NpcBaseCharacter.generated.h"
|
||||||
|
|
||||||
|
class USpeechDataAsset;
|
||||||
class UCapsuleComponent;
|
class UCapsuleComponent;
|
||||||
class UEleriFlipbookComponent;
|
class UEleriFlipbookComponent;
|
||||||
class UExtendedPawnMovement;
|
class UExtendedPawnMovement;
|
||||||
@@ -26,6 +27,9 @@ struct FNpcCharacterData
|
|||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
FText NpcName;
|
FText NpcName;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
TSoftObjectPtr<USpeechDataAsset> StartingSpeech;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,6 +82,7 @@ public:
|
|||||||
UNpcStateMachineComponent* GetNpcStateMachine() const { return StateMachineComponent; }
|
UNpcStateMachineComponent* GetNpcStateMachine() const { return StateMachineComponent; }
|
||||||
|
|
||||||
virtual void ToggleInteractableUI_Implementation(bool bActive) override;
|
virtual void ToggleInteractableUI_Implementation(bool bActive) override;
|
||||||
|
TSoftObjectPtr<USpeechDataAsset> GetStartingSpeech() const { return NpcCharacterData.StartingSpeech; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Components")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Components")
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ void UInventoryComponent::BeginPlay()
|
|||||||
InitializeInventory();
|
InitializeInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 UInventoryComponent::HasItem(FPrimaryAssetId ItemId, bool HQ)
|
int32 UInventoryComponent::HasItem(FPrimaryAssetId ItemId, bool HQ) const
|
||||||
{
|
{
|
||||||
for (int32 i = 0; i < ItemList.Num(); i++)
|
for (int32 i = 0; i < ItemList.Num(); i++)
|
||||||
{
|
{
|
||||||
@@ -131,7 +131,7 @@ void UInventoryComponent::EmptyInventory()
|
|||||||
OnInventoryUpdated.Broadcast();
|
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++)
|
for (int32 i = 0; i < ItemList.Num(); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -129,10 +129,10 @@ public:
|
|||||||
void EmptyInventory();
|
void EmptyInventory();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
int32 GetStackForItem(FPrimaryAssetId ItemId, bool HQ = false);
|
int32 GetStackForItem(FPrimaryAssetId ItemId, bool HQ = false) const;
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
int32 HasItem(FPrimaryAssetId ItemToCheck, bool HQ = false);
|
int32 HasItem(FPrimaryAssetId ItemToCheck, bool HQ = false) const;
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
TArray<FPrimaryAssetId> GetItemAssetIds();
|
TArray<FPrimaryAssetId> GetItemAssetIds();
|
||||||
|
|||||||
@@ -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
|
||||||
26
Source/ProjectEleriEditor/Private/Eleri/EleriAssetCategory.h
Normal file
26
Source/ProjectEleriEditor/Private/Eleri/EleriAssetCategory.h
Normal 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();
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
|
};
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
|
};
|
||||||
@@ -13,6 +13,15 @@
|
|||||||
#include "NpcScheduleAssetCustomization.h"
|
#include "NpcScheduleAssetCustomization.h"
|
||||||
#include "ScheduleAssetRecheck.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"
|
#define LOCTEXT_NAMESPACE "ProjectEleriEditorModule"
|
||||||
|
|
||||||
IMPLEMENT_GAME_MODULE(FProjectEleriEditorModule, ProjectEleriEditor);
|
IMPLEMENT_GAME_MODULE(FProjectEleriEditorModule, ProjectEleriEditor);
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ public class ProjectEleriEditor : ModuleRules
|
|||||||
"Projects",
|
"Projects",
|
||||||
"ToolMenus",
|
"ToolMenus",
|
||||||
"AssetRegistry",
|
"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",
|
"ContentBrowser",
|
||||||
// The world map builder drives a scene capture and reads the render target back on the CPU, which
|
// 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.
|
// is where the render thread and the pixel formats it copies between come in.
|
||||||
|
|||||||
Reference in New Issue
Block a user