From b73e9065d193c851b31aa271be561b6ab4eaffb7 Mon Sep 17 00:00:00 2001 From: "adnan.mujkic" Date: Thu, 13 Aug 2026 23:53:25 +0200 Subject: [PATCH] Dialogue widget moving stuff to cpp --- .../Scripts/Bazar/BP_BazarSellingStand.uasset | 4 +- .../DialogueSystem/DialogueManager.uasset | 4 +- .../DialogueSystem/UI/DialogueScreen.uasset | 4 +- .../Blueprints/BP_ThirdPersonCharacter.uasset | 2 +- Content/UI/MainMenuScreenUI.uasset | 2 +- .../DialogueSystem/DialogueWidget.cpp | 9 +++ .../DialogueSystem/DialogueWidget.h | 62 +++++++++++++++++++ 7 files changed, 79 insertions(+), 8 deletions(-) diff --git a/Content/Scripts/Bazar/BP_BazarSellingStand.uasset b/Content/Scripts/Bazar/BP_BazarSellingStand.uasset index 6056172b..2c087708 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:73981a56d35b330df21f130595e428593afdc98c5f55fda5691d6e654b95bfe3 -size 469443 +oid sha256:e61e96bc45f0c4d9cfd459a48398430f83a55ac06db4d0852016d82f8693e824 +size 468991 diff --git a/Content/Scripts/DialogueSystem/DialogueManager.uasset b/Content/Scripts/DialogueSystem/DialogueManager.uasset index a95995a7..530d867c 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:5d6abb9329d907cbb345defe91be195ebbbef5d3c0a61c267c82f345c9d84e8b -size 686318 +oid sha256:e95191a3d7a5f044d452ecdcab63f2c1108995c5ff70f9fdf4674c3e9c4b9f12 +size 631218 diff --git a/Content/Scripts/DialogueSystem/UI/DialogueScreen.uasset b/Content/Scripts/DialogueSystem/UI/DialogueScreen.uasset index f221be05..bc8d618f 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:6a49c86a6a801dd462cc79d0429aef5d599e29181a55d0a07ab7c93941528f59 -size 832967 +oid sha256:38b7edf6c68a1b7d4cace285176b061fc39e5cb910af6441c9109893ca7692f1 +size 586567 diff --git a/Content/ThirdPersonBP/Blueprints/BP_ThirdPersonCharacter.uasset b/Content/ThirdPersonBP/Blueprints/BP_ThirdPersonCharacter.uasset index 6966bf56..5fb07972 100644 --- a/Content/ThirdPersonBP/Blueprints/BP_ThirdPersonCharacter.uasset +++ b/Content/ThirdPersonBP/Blueprints/BP_ThirdPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2ca33e17f125f636a69e01c7f82596bc584941bf9cdbe69f15698378a29b44ff +oid sha256:194705a9f6c34e3d343b7ceefd9b1bc1da5d0315950cad00efc36c9cac288d2b size 1400575 diff --git a/Content/UI/MainMenuScreenUI.uasset b/Content/UI/MainMenuScreenUI.uasset index 7de431d6..afc7c2fa 100644 --- a/Content/UI/MainMenuScreenUI.uasset +++ b/Content/UI/MainMenuScreenUI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bb76cc2e01de8f5fa75d9944bcceaed45170af7a3d805bbf94fe8fbdd5a7336d +oid sha256:8e7ae1d26420d20a98edb8dab783cce40b15b33f2f2ae684280027c272d8a6cc size 481436 diff --git a/Source/ProjectEleri/DialogueSystem/DialogueWidget.cpp b/Source/ProjectEleri/DialogueSystem/DialogueWidget.cpp index 5503adf9..f40861b1 100644 --- a/Source/ProjectEleri/DialogueSystem/DialogueWidget.cpp +++ b/Source/ProjectEleri/DialogueSystem/DialogueWidget.cpp @@ -2,3 +2,12 @@ #include "DialogueWidget.h" +#include "EleriPlayerController.h" +#include "Kismet/GameplayStatics.h" + +void UDialogueWidget::NativeOnInitialized() +{ + Super::NativeOnInitialized(); + + EleriPlayerController = Cast(UGameplayStatics::GetPlayerController(GetWorld(), 0)); +} diff --git a/Source/ProjectEleri/DialogueSystem/DialogueWidget.h b/Source/ProjectEleri/DialogueSystem/DialogueWidget.h index ae2df3c9..d55e330a 100644 --- a/Source/ProjectEleri/DialogueSystem/DialogueWidget.h +++ b/Source/ProjectEleri/DialogueSystem/DialogueWidget.h @@ -7,6 +7,12 @@ #include "UI/EleriBaseWidget.h" #include "DialogueWidget.generated.h" +class UDialogueComponent; +class USpeechDataAsset; +class AEleriPlayerController; + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnDialogueOptionSelected, int32, Index); + /** * */ @@ -18,7 +24,63 @@ class PROJECTELERI_API UDialogueWidget : public UEleriBaseWidget public: UFUNCTION() bool IsAnimating() const { return bIsAnimating; } + + virtual void NativeOnInitialized() override; + protected: UPROPERTY(EditAnywhere, BlueprintReadWrite) bool bIsAnimating = false; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + AEleriPlayerController* EleriPlayerController; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + UDialogueComponent* DialogueComponent; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + int32 DialogueCounter = 0; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool bDialogueOpen = false; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool bIsTypingDialogue = false; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + FText CurrentDialogueLine; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + int32 CurrentTypingDialogueIndex = 0; + + UPROPERTY(BlueprintAssignable, BlueprintReadWrite, BlueprintCallable) + FOnDialogueOptionSelected OnDialogueOptionSelected; + +public: + UFUNCTION(BlueprintImplementableEvent, BlueprintCallable) + void SetDialogueOptionsPadding(); + + UFUNCTION(BlueprintImplementableEvent, BlueprintCallable) + void StartDialogueTyping(); + + UFUNCTION(BlueprintImplementableEvent, BlueprintCallable) + void SkipDialogueTyping(); + + UFUNCTION(BlueprintImplementableEvent, BlueprintCallable) + void SelectDialogueOption(int32 Index); + + UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, meta = (AutoCreateRefTerm = "ReplacementMap")) + void DisplayDialogue(USpeechDataAsset* SpeechDataAsset, AActor* Speaker, const TMap& ReplacementMap); + + UFUNCTION(BlueprintImplementableEvent, BlueprintCallable) + void AdvanceDialogue(const FText& Line, const FText& SpeakerName); + + UFUNCTION(BlueprintImplementableEvent, BlueprintCallable) + void DisplayDialogueSingleLine(const FText& Line, const FText& SpeakerName); + + UFUNCTION(BlueprintImplementableEvent, BlueprintCallable) + void ShowDialogueOptions(bool bActive, const TArray& Options); + + UFUNCTION(BlueprintImplementableEvent, BlueprintCallable) + void SetSpeakerName(const FText& NewSpeakerName); + };