diff --git a/Config/DefaultGameplayTags.ini b/Config/DefaultGameplayTags.ini index 60f6a8c6..726563ef 100644 --- a/Config/DefaultGameplayTags.ini +++ b/Config/DefaultGameplayTags.ini @@ -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="") diff --git a/Content/GameData/Dialogue/Characters/Test/S_Trish_MeetDialogue.uasset b/Content/GameData/Dialogue/Characters/Test/S_Trish_MeetDialogue.uasset new file mode 100644 index 00000000..972211a8 --- /dev/null +++ b/Content/GameData/Dialogue/Characters/Test/S_Trish_MeetDialogue.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5163ac91ec96b9c91e03e437aa94592a22a6a2be512bc37d44bac23bb7892af5 +size 4044 diff --git a/Content/GameData/Events/Characters/Trish/GEDA_TrishMeet.uasset b/Content/GameData/Events/Characters/Trish/GEDA_TrishMeet.uasset new file mode 100644 index 00000000..09141070 --- /dev/null +++ b/Content/GameData/Events/Characters/Trish/GEDA_TrishMeet.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa12d7e85320a0d19730432127cb858045db898958c426d86ace38d1a738a3ad +size 1619 diff --git a/Content/Scripts/DialogueSystem/UI/DialogueScreen.uasset b/Content/Scripts/DialogueSystem/UI/DialogueScreen.uasset index a0857ce3..6c69c15c 100644 --- a/Content/Scripts/DialogueSystem/UI/DialogueScreen.uasset +++ b/Content/Scripts/DialogueSystem/UI/DialogueScreen.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bb9930001d01905e1f6644be20d8ce5d7c421cf77f010a54443fdb2722b857b0 -size 538095 +oid sha256:19ab1d8e8e7d0f22ba184894c6bb000bd103629cbb67585484f86b1a060376ed +size 526309 diff --git a/Source/ProjectEleri/DialogueSystem/DialogueComponent.cpp b/Source/ProjectEleri/DialogueSystem/DialogueComponent.cpp index 046d2979..80924c07 100644 --- a/Source/ProjectEleri/DialogueSystem/DialogueComponent.cpp +++ b/Source/ProjectEleri/DialogueSystem/DialogueComponent.cpp @@ -44,16 +44,6 @@ 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); @@ -67,8 +57,12 @@ void UDialogueComponent::StartDialogueWithNpc() // answer, and it is the single funnel every dialogue goes through. if (!DialogueSubsystem->StartDialogue(GetOwner())) return; + USpeechDataAsset* StartingDialogue = NpcBaseCharacter->GetStartingSpeech().Get(); + TArray StartingDialogues = GetStartingDialogues(); + if (!StartingDialogues.IsEmpty()) StartingDialogue = StartingDialogues[0]; + MappedDialogueOptions.Empty(); - TriggerDialogue(NpcBaseCharacter->GetStartingSpeech().Get(), CurrentDialogueReplacementMap); + TriggerDialogue(StartingDialogue, CurrentDialogueReplacementMap); } void UDialogueComponent::TriggerDialogue_Async(TSoftObjectPtr DialogueAssetPath, const TMap& ReplacementMap) @@ -117,27 +111,19 @@ void UDialogueComponent::TriggerDialogue(USpeechDataAsset* DialogueAssetPath, co DialogueSubsystem->StartDialogue(GetOwner()); } -TArray UDialogueComponent::GetActiveSpeechData() { return ActiveSpeechData; } - TArray UDialogueComponent::GetStartingDialogues() { TArray 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 UDialogueComponent::GetActiveDialogues() -{ - TArray 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; @@ -195,7 +181,7 @@ void UDialogueComponent::AdvanceDialogue() } } - 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); diff --git a/Source/ProjectEleri/DialogueSystem/DialogueComponent.h b/Source/ProjectEleri/DialogueSystem/DialogueComponent.h index 930438c6..4cf6a9ac 100644 --- a/Source/ProjectEleri/DialogueSystem/DialogueComponent.h +++ b/Source/ProjectEleri/DialogueSystem/DialogueComponent.h @@ -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& ReplacementMap); - UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue") - TArray 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 GetStartingDialogues(); - - UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue") - TArray GetActiveDialogues(); UFUNCTION(BlueprintCallable, Category = "Eleri|Dialogue") void SetTextReplacementMap(const TMap& ReplacementMap); @@ -67,16 +59,12 @@ protected: AActor* OwnerActor; UPROPERTY(EditAnywhere, BlueprintReadWrite) AEleriPlayerController* EleriPlayerController; - - TObjectPtr DialogueWidgetComponent; + UPROPERTY() TObjectPtr DialogueWidget; UPROPERTY() TArray> SpeechData; - - UPROPERTY() - TArray> ActiveSpeechData; UPROPERTY(EditAnywhere, BlueprintReadWrite) bool bDialogueSelectOpen = false; diff --git a/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.cpp b/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.cpp index 4101d02f..b6c33d3b 100644 --- a/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.cpp +++ b/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.cpp @@ -7,6 +7,7 @@ #include "InventoryComponent.h" #include "Speech.h" +#include "Misc/DataValidation.h" #include "QuestSystem/QuestSubsystem.h" bool FEventRequirement::TestRequirement(const UObject* WorldContext) const @@ -22,14 +23,10 @@ bool FEventRequirement::TestRequirement(const UObject* WorldContext) const if (!GameEventSubsystem) return false; const EEventStage EventStage = GameEventSubsystem->GetEventStage(EventAsset); - - if (!bMustAchieveEvent && EventStage != EEventStage::NONE) - return false; - - if (bMustAchieveEvent && (GameEventSubsystem->GetEventStage(EventAsset) < Stage)) - return false; - - return true; + + return bMustAchieveEvent? + EventStage >= Stage : + EventStage < Stage; } case EEventRequirementType::Quest: { @@ -96,3 +93,15 @@ FText USpeechDataAsset::ReplaceTextInLine(const FText& Text, TMap DialogueLines; @@ -107,4 +107,8 @@ public: FText GetFormattedDialogueLine(const int32 Index, const TMap ReplacementMap); UFUNCTION(BlueprintPure, Category = "Eleri|Options") static FText ReplaceTextInLine(const FText& Text, TMap ReplacementMap); + +#if WITH_EDITOR + virtual EDataValidationResult IsDataValid(class FDataValidationContext& Context) const override; +#endif };