Dialogue widget moving stuff to cpp

This commit is contained in:
2026-08-13 23:53:25 +02:00
parent 2f4aabb3ab
commit b73e9065d1
7 changed files with 79 additions and 8 deletions

Binary file not shown.

View File

@@ -2,3 +2,12 @@
#include "DialogueWidget.h"
#include "EleriPlayerController.h"
#include "Kismet/GameplayStatics.h"
void UDialogueWidget::NativeOnInitialized()
{
Super::NativeOnInitialized();
EleriPlayerController = Cast<AEleriPlayerController>(UGameplayStatics::GetPlayerController(GetWorld(), 0));
}

View File

@@ -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<FString, FText>& 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<FText>& Options);
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable)
void SetSpeakerName(const FText& NewSpeakerName);
};