Files
ProjectEleri/Source/ProjectEleri/DialogueSystem/DialogueWidget.h

93 lines
2.8 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "UI/EleriBaseWidget.h"
#include "DialogueWidget.generated.h"
class UDialogueComponent;
class USpeechDataAsset;
class AEleriPlayerController;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnDialogueOptionSelected, int32, Index);
/**
*
*/
UCLASS()
class PROJECTELERI_API UDialogueWidget : public UEleriBaseWidget
{
GENERATED_BODY()
public:
UFUNCTION()
bool IsAnimating() const { return bIsAnimating; }
virtual void NativeOnInitialized() override;
bool IsTypingDialogue() const { return bIsTypingDialogue; }
virtual void HandleUiInputAction_Implementation(EEleriUIInputAction InputAction, FInputActionValue Value) 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;
public:
void AssignDialogueComponent(UDialogueComponent* InDialogueComponent) { DialogueComponent = InDialogueComponent; }
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);
UPROPERTY(BlueprintAssignable, BlueprintReadWrite, BlueprintCallable)
FOnDialogueOptionSelected OnDialogueOptionSelected;
};