From 28f27d032ace1765bf494749529689568d360ac5 Mon Sep 17 00:00:00 2001 From: "adnan.mujkic" Date: Tue, 18 Aug 2026 22:58:29 +0200 Subject: [PATCH] Some work done on dialogue fixes and more bazaar iterations --- Config/DefaultGameplayTags.ini | 3 +++ .../DA_BazaarHaggleOptionsTemplate.uasset | 3 +++ .../DA_BazaarIntroDialogueSimple.uasset | 3 --- .../DA_Bazaar_Requst_1Item.uasset | 4 ++-- .../Scripts/Bazar/BP_BazarSellingStand.uasset | 4 ++-- .../DialogueSystem/UI/DialogueScreen.uasset | 4 ++-- .../MODULES/UI_DialogueOptionModule.uasset | 4 ++-- .../DialogueSystem/DialogueComponent.cpp | 22 ++++++++++++++----- .../DialogueSystem/DialogueComponent.h | 2 +- .../DialogueSystem/DialogueSubsystem.cpp | 6 ++--- .../DialogueSystem/DialogueSubsystem.h | 4 +++- .../DialogueSystem/SpeechDataAsset.cpp | 11 ++++++---- .../DialogueSystem/SpeechDataAsset.h | 22 +++++++++++-------- 13 files changed, 57 insertions(+), 35 deletions(-) create mode 100644 Content/GameData/Dialogue/Bazaar/DA_BazaarHaggleOptionsTemplate.uasset delete mode 100644 Content/GameData/Dialogue/Bazaar/IntroductoryDialogues/DA_BazaarIntroDialogueSimple.uasset diff --git a/Config/DefaultGameplayTags.ini b/Config/DefaultGameplayTags.ini index b2285ed6..773d28be 100644 --- a/Config/DefaultGameplayTags.ini +++ b/Config/DefaultGameplayTags.ini @@ -20,6 +20,9 @@ NetIndexFirstBitSegment=16 +GameplayTagList=(Tag="Characters.Yuki",DevComment="") +GameplayTagList=(Tag="Dialogue.Event",DevComment="") +GameplayTagList=(Tag="Dialogue.Event.Bazaar.Haggle",DevComment="") ++GameplayTagList=(Tag="Dialogue.Event.Bazaar.HaggleOption1",DevComment="") ++GameplayTagList=(Tag="Dialogue.Event.Bazaar.HaggleOption2",DevComment="") ++GameplayTagList=(Tag="Dialogue.Event.Bazaar.HaggleOption3",DevComment="") +GameplayTagList=(Tag="Dialogue.Event.Bazaar.QuickSell",DevComment="") +GameplayTagList=(Tag="Dialogue.Event.Merchant",DevComment="") +GameplayTagList=(Tag="Dialogue.Event.Merchant.Buy",DevComment="") diff --git a/Content/GameData/Dialogue/Bazaar/DA_BazaarHaggleOptionsTemplate.uasset b/Content/GameData/Dialogue/Bazaar/DA_BazaarHaggleOptionsTemplate.uasset new file mode 100644 index 00000000..bc5e8677 --- /dev/null +++ b/Content/GameData/Dialogue/Bazaar/DA_BazaarHaggleOptionsTemplate.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e67a034858d3694e62bb08c54d60ca777c906d24f9e35bc187799cbcb2e1a42d +size 7071 diff --git a/Content/GameData/Dialogue/Bazaar/IntroductoryDialogues/DA_BazaarIntroDialogueSimple.uasset b/Content/GameData/Dialogue/Bazaar/IntroductoryDialogues/DA_BazaarIntroDialogueSimple.uasset deleted file mode 100644 index ca5892e2..00000000 --- a/Content/GameData/Dialogue/Bazaar/IntroductoryDialogues/DA_BazaarIntroDialogueSimple.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1dbd4f56d02022d0dffd39af34b79724f7f6f5a7ba62b4f3de557ce3bb0aea91 -size 2959 diff --git a/Content/GameData/Dialogue/Bazaar/IntroductoryDialogues/DA_Bazaar_Requst_1Item.uasset b/Content/GameData/Dialogue/Bazaar/IntroductoryDialogues/DA_Bazaar_Requst_1Item.uasset index 2d939ce7..167ca897 100644 --- a/Content/GameData/Dialogue/Bazaar/IntroductoryDialogues/DA_Bazaar_Requst_1Item.uasset +++ b/Content/GameData/Dialogue/Bazaar/IntroductoryDialogues/DA_Bazaar_Requst_1Item.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6150c0c89d3cc575ae167baaddded549ea7841a9d8c63f1649902fe98f48c925 -size 3771 +oid sha256:7f679002944491ee469804716594400d78b315d4de89beb33edd3f5e062e74b2 +size 4429 diff --git a/Content/Scripts/Bazar/BP_BazarSellingStand.uasset b/Content/Scripts/Bazar/BP_BazarSellingStand.uasset index b0d3b991..33236642 100644 --- a/Content/Scripts/Bazar/BP_BazarSellingStand.uasset +++ b/Content/Scripts/Bazar/BP_BazarSellingStand.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a9b8532472a5d5fc5da4676214576006afc877e9fe46abbd1aa0047447d2614f -size 710045 +oid sha256:a5d48c380cc9ea6b3444d04143c43b625b1ea12dddccd40ab6db3d1352922ca5 +size 722288 diff --git a/Content/Scripts/DialogueSystem/UI/DialogueScreen.uasset b/Content/Scripts/DialogueSystem/UI/DialogueScreen.uasset index 8f1122a8..a4f7342c 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:46fa5dc42a2e08bd6d19f5696df036a2b45d7f8ebfab0341e5082afeed279b5c -size 621470 +oid sha256:fabf343e49112f6732dad98eb6bbc06676fc2545879abb037d87fc97a8c67f8e +size 661143 diff --git a/Content/Scripts/MODULES/UI_DialogueOptionModule.uasset b/Content/Scripts/MODULES/UI_DialogueOptionModule.uasset index 9d6629d0..a0396240 100644 --- a/Content/Scripts/MODULES/UI_DialogueOptionModule.uasset +++ b/Content/Scripts/MODULES/UI_DialogueOptionModule.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf1648d88ab6e9caa59299562da213cddaf9604a265a0a147f614d5e8352f050 -size 117056 +oid sha256:eae9c20bd314a3a91b807bc780697c4a7d8a2ebc016f25920de4afe6c7b42238 +size 116933 diff --git a/Source/ProjectEleri/DialogueSystem/DialogueComponent.cpp b/Source/ProjectEleri/DialogueSystem/DialogueComponent.cpp index 3ff267a1..7aec16a9 100644 --- a/Source/ProjectEleri/DialogueSystem/DialogueComponent.cpp +++ b/Source/ProjectEleri/DialogueSystem/DialogueComponent.cpp @@ -93,12 +93,14 @@ void UDialogueComponent::TriggerDialogue(USpeechDataAsset* DialogueAssetPath, co UDialogueSubsystem* DialogueSubsystem = UDialogueSubsystem::Get(this); if (!DialogueSubsystem) return; - if (!DialogueSubsystem->StartDialogue()) return; + if (!DialogueSubsystem->IsDialogueStarted()) + { + BindToControllerInput(); + bDialogueSelectOpen = false; + DialogueWidget = Cast(EleriPlayerController->ToggleDialogueWindow(true)); + DialogueWidget->AssignDialogueComponent(this); + } - BindToControllerInput(); - bDialogueSelectOpen = false; - DialogueWidget = Cast(EleriPlayerController->ToggleDialogueWindow(true)); - DialogueWidget->AssignDialogueComponent(this); CurrentLineIndex = 0; CurrentActiveDialogue = DialogueAssetPath; CurrentDialogueReplacementMap = ReplacementMap; @@ -113,8 +115,10 @@ void UDialogueComponent::TriggerDialogue(USpeechDataAsset* DialogueAssetPath, co MappedDialogueOptions.Add(i, CurrentActiveDialogue->PlayerSpeechMap[i]); PlayerSpeakOptions.Add(CurrentActiveDialogue->PlayerSpeechMap[i].PlayerSpeak); } - TriggerDialogueSelect(PlayerSpeakOptions, false); + //TriggerDialogueSelect(PlayerSpeakOptions, false); } + + DialogueSubsystem->StartDialogue(); } TArray UDialogueComponent::GetActiveSpeechData() { return ActiveSpeechData; } @@ -231,6 +235,7 @@ void UDialogueComponent::OnDialogueOptionSelected(int32 Index) { DialogueWidget->OnDialogueOptionSelected.RemoveDynamic(this, &UDialogueComponent::OnDialogueOptionSelected); SelectedDialogueOptionIndex = Index; + bDialogueSelectOpen = false; if (const FPlayerSpeakToDialogue* PlayerSpeak = MappedDialogueOptions.Find(SelectedDialogueOptionIndex)) { @@ -244,6 +249,11 @@ void UDialogueComponent::OnDialogueOptionSelected(int32 Index) TriggerDialogue_Async(PlayerSpeak->NextSpeechDataAsset, CurrentDialogueReplacementMap); return; } + + if (!PlayerSpeak->bEndDialogueAfterSelecting) + { + return; + } } CloseDialogue(); diff --git a/Source/ProjectEleri/DialogueSystem/DialogueComponent.h b/Source/ProjectEleri/DialogueSystem/DialogueComponent.h index 6181930d..930438c6 100644 --- a/Source/ProjectEleri/DialogueSystem/DialogueComponent.h +++ b/Source/ProjectEleri/DialogueSystem/DialogueComponent.h @@ -88,7 +88,7 @@ protected: USpeechDataAsset* CurrentActiveDialogue; UPROPERTY(EditAnywhere, BlueprintReadWrite) TMap MappedDialogueOptions; - UPROPERTY() + UPROPERTY(EditAnywhere, BlueprintReadWrite) TMap CurrentDialogueReplacementMap; protected: diff --git a/Source/ProjectEleri/DialogueSystem/DialogueSubsystem.cpp b/Source/ProjectEleri/DialogueSystem/DialogueSubsystem.cpp index e72a179b..2f9e113d 100644 --- a/Source/ProjectEleri/DialogueSystem/DialogueSubsystem.cpp +++ b/Source/ProjectEleri/DialogueSystem/DialogueSubsystem.cpp @@ -58,15 +58,15 @@ TArray> UDialogueSubsystem::GetDialogueForActor(con bool UDialogueSubsystem::StartDialogue() { - if(bDialogueStartd) return false; + if(bDialogueStarted) return false; - bDialogueStartd = true; + bDialogueStarted = true; return true; } void UDialogueSubsystem::EndDialogue() { - bDialogueStartd = false; + bDialogueStarted = false; } void UDialogueSubsystem::DialogueAssetsLoaded() diff --git a/Source/ProjectEleri/DialogueSystem/DialogueSubsystem.h b/Source/ProjectEleri/DialogueSystem/DialogueSubsystem.h index 3746ee22..3c969f27 100644 --- a/Source/ProjectEleri/DialogueSystem/DialogueSubsystem.h +++ b/Source/ProjectEleri/DialogueSystem/DialogueSubsystem.h @@ -32,6 +32,8 @@ public: virtual void Initialize(FSubsystemCollectionBase& Collection) override; bool IsDialogueLoaded() const { return bDialogueLoaded; } + UFUNCTION(BlueprintPure, Category = "Eleri|Dialogue") + bool IsDialogueStarted() const {return bDialogueStarted; } TArray> GetDialogueForActor(const AActor* Actor); UFUNCTION(BlueprintCallable) @@ -45,7 +47,7 @@ protected: TArray AllAssetPaths; UPROPERTY() - bool bDialogueStartd; + bool bDialogueStarted; UPROPERTY() bool bDialogueLoaded; diff --git a/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.cpp b/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.cpp index c7eef776..e6b24a13 100644 --- a/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.cpp +++ b/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.cpp @@ -30,18 +30,21 @@ bool USpeechDataAsset::TestRequirements(UWorld* World) return true; } -FText USpeechDataAsset::GetFormattedDialogueLine(const int32 Index, TMap ReplacementMap) +FText USpeechDataAsset::GetFormattedDialogueLine(const int32 Index, const TMap ReplacementMap) { if (DialogueLines.Num() - 1 < Index || Index < 0) return FText(); + + return ReplaceTextInLine(DialogueLines[Index].DialogueLine, ReplacementMap); +} - const FText& LineRef = DialogueLines[Index].DialogueLine; - +FText USpeechDataAsset::ReplaceTextInLine(const FText& Text, TMap ReplacementMap) +{ FFormatNamedArguments Args; for (const TTuple& ReplacementPair : ReplacementMap) { Args.Add(ReplacementPair.Key, ReplacementPair.Value); } - return FText::Format(LineRef, Args); + return FText::Format(Text, Args); } diff --git a/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.h b/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.h index 5f48af4a..23370083 100644 --- a/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.h +++ b/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.h @@ -29,6 +29,8 @@ struct FPlayerSpeakToDialogue { GENERATED_BODY() public: + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool bEndDialogueAfterSelecting = true; UPROPERTY(EditAnywhere, BlueprintReadWrite) FText PlayerSpeak; UPROPERTY(EditAnywhere, BlueprintReadWrite) @@ -46,30 +48,32 @@ class PROJECTELERI_API USpeechDataAsset : public UDataAsset GENERATED_BODY() public: - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Event Requirment") + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Eleri|Event Requirment") TArray EventsMustMeetRequirement; - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Event Requirment") + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Eleri|Event Requirment") TArray EventsMustNotMeetRequirement; - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Speech") + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Eleri|Speech") TSoftClassPtr Npc; - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Speech") + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Eleri|Speech") FText PlayerAsk; - UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Speech") + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Eleri|Speech") bool RandomizeLines; - UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Speech") + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Eleri|Speech") TArray DialogueLines; - UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Options") + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Eleri|Options") TArray PlayerSpeechMap; UFUNCTION() bool TestRequirements(UWorld* World); - UFUNCTION(BlueprintCallable) - FText GetFormattedDialogueLine(const int32 Index, TMap ReplacementMap); + UFUNCTION(BlueprintCallable, Category = "Eleri|Options") + FText GetFormattedDialogueLine(const int32 Index, const TMap ReplacementMap); + UFUNCTION(BlueprintPure, Category = "Eleri|Options") + static FText ReplaceTextInLine(const FText& Text, TMap ReplacementMap); };