From 2f4aabb3ab87c05d0b21fc77c2bab46b0e9a7886 Mon Sep 17 00:00:00 2001 From: "adnan.mujkic" Date: Wed, 12 Aug 2026 23:14:02 +0200 Subject: [PATCH] Iteration on bazaar, new npc name interface, initial setup for dialogue triggering --- .../Character/BP_BazarStaticCustomer.uasset | 4 +-- .../Bazaar/DA_SpeechBazarTest1.uasset | 3 ++ .../AlchemySystem/BP_AlchemyManager.uasset | 4 +-- .../Scripts/Bazar/BP_BazarSellingStand.uasset | 4 +-- .../DialogueSystem/DialogueManager.uasset | 4 +-- .../DialogueSystem/UI/DialogueScreen.uasset | 4 +-- .../Tutorial/BP_TutorialManager.uasset | 4 +-- Content/UI/Styles/DT_RichText_Normal.uasset | 4 +-- .../DialogueSystem/SpeechDataAsset.cpp | 18 ++++++++++++ .../DialogueSystem/SpeechDataAsset.h | 3 ++ .../ProjectEleri/GameObjects/BaseCharacter.h | 7 +++-- .../Interface/NpcSpeakerDataInterface.cpp | 7 +++++ Source/ProjectEleri/Private/MyCharacter.cpp | 11 ++++++-- .../Interface/NpcSpeakerDataInterface.h | 28 +++++++++++++++++++ Source/ProjectEleri/Public/MyCharacter.h | 6 +++- 15 files changed, 92 insertions(+), 19 deletions(-) create mode 100644 Content/GameData/Dialogue/Bazaar/DA_SpeechBazarTest1.uasset create mode 100644 Source/ProjectEleri/Private/Interface/NpcSpeakerDataInterface.cpp create mode 100644 Source/ProjectEleri/Public/Interface/NpcSpeakerDataInterface.h diff --git a/Content/Character/BP_BazarStaticCustomer.uasset b/Content/Character/BP_BazarStaticCustomer.uasset index 6e01a228..d0fb7783 100644 --- a/Content/Character/BP_BazarStaticCustomer.uasset +++ b/Content/Character/BP_BazarStaticCustomer.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:702cd22391e6c083d2370dbcb649e98ac5e565f68f64363b50e0084a53f01a2e -size 25946 +oid sha256:57677ec665f46a179a1b30d7faa9cf8f1e0116e0d5e3c5d392483578fc9f0c64 +size 32421 diff --git a/Content/GameData/Dialogue/Bazaar/DA_SpeechBazarTest1.uasset b/Content/GameData/Dialogue/Bazaar/DA_SpeechBazarTest1.uasset new file mode 100644 index 00000000..6da72e31 --- /dev/null +++ b/Content/GameData/Dialogue/Bazaar/DA_SpeechBazarTest1.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c93dfb97a2200b15b4027a1bdce80bf901d85699301e4f2379887c5f47a3f50 +size 2363 diff --git a/Content/Scripts/AlchemySystem/BP_AlchemyManager.uasset b/Content/Scripts/AlchemySystem/BP_AlchemyManager.uasset index 4204608f..b1393fd5 100644 --- a/Content/Scripts/AlchemySystem/BP_AlchemyManager.uasset +++ b/Content/Scripts/AlchemySystem/BP_AlchemyManager.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24aeadb9f8ee659fb5294beb5163158e2f42bad4c58b1e6d82ffdc3eb9f0d2e0 -size 2825066 +oid sha256:61afa506ffd24ce297ff2b5f18cf56c582a5e121700759f24ace77fe1f1b3be7 +size 2825394 diff --git a/Content/Scripts/Bazar/BP_BazarSellingStand.uasset b/Content/Scripts/Bazar/BP_BazarSellingStand.uasset index f5b930ec..6056172b 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:0ca6a52a34a6a4991a4b6b2612958a7e135d30fb70214db7e53f339fb4ccdbe4 -size 445341 +oid sha256:73981a56d35b330df21f130595e428593afdc98c5f55fda5691d6e654b95bfe3 +size 469443 diff --git a/Content/Scripts/DialogueSystem/DialogueManager.uasset b/Content/Scripts/DialogueSystem/DialogueManager.uasset index c8ca7ffd..a95995a7 100644 --- a/Content/Scripts/DialogueSystem/DialogueManager.uasset +++ b/Content/Scripts/DialogueSystem/DialogueManager.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0599575153b6803c0c06cd5517b61ac7c177adac02f13788e1b76698197eebfd -size 695471 +oid sha256:5d6abb9329d907cbb345defe91be195ebbbef5d3c0a61c267c82f345c9d84e8b +size 686318 diff --git a/Content/Scripts/DialogueSystem/UI/DialogueScreen.uasset b/Content/Scripts/DialogueSystem/UI/DialogueScreen.uasset index b3b416af..f221be05 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:99ed2f5deb9eeccfb11ca3629c6f92cfd96f1cdc057a11e1a69fffcc851af6c0 -size 809923 +oid sha256:6a49c86a6a801dd462cc79d0429aef5d599e29181a55d0a07ab7c93941528f59 +size 832967 diff --git a/Content/Scripts/Tutorial/BP_TutorialManager.uasset b/Content/Scripts/Tutorial/BP_TutorialManager.uasset index e695e89c..d733536e 100644 --- a/Content/Scripts/Tutorial/BP_TutorialManager.uasset +++ b/Content/Scripts/Tutorial/BP_TutorialManager.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:95426f14faf497fecd7a7e4525069f32ff57b970b5cfd0b187a1ceadcd89d6e6 -size 311504 +oid sha256:6dc95e7b0aa3c6a8f22ceb3258f820c1d29aaca59a08f7dc8be44175759b0c7d +size 311627 diff --git a/Content/UI/Styles/DT_RichText_Normal.uasset b/Content/UI/Styles/DT_RichText_Normal.uasset index 7bf1e0e5..f0cfed6b 100644 --- a/Content/UI/Styles/DT_RichText_Normal.uasset +++ b/Content/UI/Styles/DT_RichText_Normal.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7d4d143fd953bfe9bafaef0109d0e3cfda49c99f5d23e8c0568d260806b2f269 -size 15039 +oid sha256:28f50ad9e053202f9f9b57a9d0cda3eb5366db7f638d6f56bb6301591550e348 +size 14984 diff --git a/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.cpp b/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.cpp index 8a4d9b2e..c7eef776 100644 --- a/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.cpp +++ b/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.cpp @@ -5,6 +5,8 @@ #include #include +#include "Speech.h" + bool USpeechDataAsset::TestRequirements(UWorld* World) { UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(World); @@ -27,3 +29,19 @@ bool USpeechDataAsset::TestRequirements(UWorld* World) return true; } + +FText USpeechDataAsset::GetFormattedDialogueLine(const int32 Index, TMap ReplacementMap) +{ + if (DialogueLines.Num() - 1 < Index || Index < 0) + return FText(); + + const FText& LineRef = DialogueLines[Index].DialogueLine; + + FFormatNamedArguments Args; + for (const TTuple& ReplacementPair : ReplacementMap) + { + Args.Add(ReplacementPair.Key, ReplacementPair.Value); + } + + return FText::Format(LineRef, Args); +} diff --git a/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.h b/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.h index 7c4d0c07..5f48af4a 100644 --- a/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.h +++ b/Source/ProjectEleri/DialogueSystem/SpeechDataAsset.h @@ -69,4 +69,7 @@ public: UFUNCTION() bool TestRequirements(UWorld* World); + + UFUNCTION(BlueprintCallable) + FText GetFormattedDialogueLine(const int32 Index, TMap ReplacementMap); }; diff --git a/Source/ProjectEleri/GameObjects/BaseCharacter.h b/Source/ProjectEleri/GameObjects/BaseCharacter.h index 9612a159..46f11fef 100644 --- a/Source/ProjectEleri/GameObjects/BaseCharacter.h +++ b/Source/ProjectEleri/GameObjects/BaseCharacter.h @@ -5,7 +5,7 @@ #include "CoreMinimal.h" #include "GameFramework/Pawn.h" #include "ProjectEleri/Public/Interface/ZoneInteractableInterface.h" -#include "GameFramework/FloatingPawnMovement.h" +#include "ProjectEleri/Public/Interface/NpcSpeakerDataInterface.h" #include "ProjectEleri/Data/FaceExpressionDataAsset.h" #include "StateTreeModule/Public/StateTree.h" #include "BaseCharacter.generated.h" @@ -18,7 +18,7 @@ class UCapsuleComponent; class USkeletalMeshComponent; UCLASS(BlueprintType) -class PROJECTELERI_API ABaseCharacter : public APawn, public IZoneInteractableInterface +class PROJECTELERI_API ABaseCharacter : public APawn, public IZoneInteractableInterface, public INpcSpeakerDataInterface { GENERATED_BODY() @@ -84,4 +84,7 @@ protected: float SecondsTillNextFaceFrame = 0.f; int32 CurrentFaceFrameIndex = 0; + +public: + virtual FText GetNpcName_Implementation() override { return CharacterName;} }; diff --git a/Source/ProjectEleri/Private/Interface/NpcSpeakerDataInterface.cpp b/Source/ProjectEleri/Private/Interface/NpcSpeakerDataInterface.cpp new file mode 100644 index 00000000..de63ecee --- /dev/null +++ b/Source/ProjectEleri/Private/Interface/NpcSpeakerDataInterface.cpp @@ -0,0 +1,7 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "Interface/NpcSpeakerDataInterface.h" + + +// Add default functionality here for any INpcSpeakerDataInterface functions that are not pure virtual. diff --git a/Source/ProjectEleri/Private/MyCharacter.cpp b/Source/ProjectEleri/Private/MyCharacter.cpp index af29e653..c02f781e 100644 --- a/Source/ProjectEleri/Private/MyCharacter.cpp +++ b/Source/ProjectEleri/Private/MyCharacter.cpp @@ -27,11 +27,13 @@ #if WITH_EDITOR void AMyCharacter::DisplayDebug(UCanvas* Canvas, const FDebugDisplayInfo& DebugDisplay, float& YL, float& YPos) { Super::DisplayDebug(Canvas, DebugDisplay, YL, YPos); - - } #endif +#define LOCTEXT_NAMESPACE "MyCharacter" + const FText AMyCharacter::PlayerName = LOCTEXT("PlayerName", "Eleri"); +#undef LOCTEXT_NAMESPACE + // Sets default values AMyCharacter::AMyCharacter() { @@ -362,5 +364,10 @@ void AMyCharacter::ToggleBroomActor(bool bActive) } } +FText AMyCharacter::GetNpcName_Implementation() +{ + return PlayerName; +} + diff --git a/Source/ProjectEleri/Public/Interface/NpcSpeakerDataInterface.h b/Source/ProjectEleri/Public/Interface/NpcSpeakerDataInterface.h new file mode 100644 index 00000000..62b1da80 --- /dev/null +++ b/Source/ProjectEleri/Public/Interface/NpcSpeakerDataInterface.h @@ -0,0 +1,28 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "UObject/Interface.h" +#include "NpcSpeakerDataInterface.generated.h" + +// This class does not need to be modified. +UINTERFACE() +class UNpcSpeakerDataInterface : public UInterface +{ + GENERATED_BODY() +}; + +/** + * + */ +class PROJECTELERI_API INpcSpeakerDataInterface +{ + GENERATED_BODY() + + // Add interface functions to this class. This is the class that will be inherited to implement this interface. +public: + UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Eleri|NpcSpeaker") + FText GetNpcName(); + virtual FText GetNpcName_Implementation() { return FText(); } +}; diff --git a/Source/ProjectEleri/Public/MyCharacter.h b/Source/ProjectEleri/Public/MyCharacter.h index 65d6c094..61e354c7 100644 --- a/Source/ProjectEleri/Public/MyCharacter.h +++ b/Source/ProjectEleri/Public/MyCharacter.h @@ -11,6 +11,7 @@ #include "GlobalEnums.h" #include "Camera/CameraComponent.h" #include "Delegates/Delegate.h" +#include "Interface/NpcSpeakerDataInterface.h" #include "ProjectEleri/Public/Interface/SaveableObjectInterface.h" #include "MyCharacter.generated.h" @@ -31,7 +32,7 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnInteractExit); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnBookRenderTexUpdate); UCLASS() -class PROJECTELERI_API AMyCharacter : public ACharacter, public ISaveableObjectInterface +class PROJECTELERI_API AMyCharacter : public ACharacter, public ISaveableObjectInterface, public INpcSpeakerDataInterface { GENERATED_BODY() @@ -85,6 +86,7 @@ protected: float ZoomTime = 0.f; float NextZoomOffsetTarget = 0.f; + static const FText PlayerName; //----- ISaveableObjectInterface ----- // This is so actors can have custom data and we don't need to create new classes for it @@ -232,4 +234,6 @@ public: void ThrowWaterBall() const; void ToggleBroomActor(bool bActive); + + virtual FText GetNpcName_Implementation() override; };