Space Plunder
Loading...
Searching...
No Matches
DialogueComponent.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
7#include "DlgSystem/DlgDialogueParticipant.h"
9#include "DialogueComponent.generated.h"
10
11USTRUCT(BlueprintType, Blueprintable)
13{
14 GENERATED_USTRUCT_BODY()
15
16 UPROPERTY(BlueprintReadWrite, VisibleAnywhere)
17 TMap<FName, int32> Integers;
18
19 UPROPERTY(BlueprintReadWrite, VisibleAnywhere)
20 TMap<FName, int32> Floats;
21
22 UPROPERTY(BlueprintReadWrite, VisibleAnywhere)
23 TMap<FName, FName> Names;
24
25 UPROPERTY(BlueprintReadWrite, VisibleAnywhere)
26 TSet<FName> TrueBools;
27};
28
29UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent) )
30class DIALOGUECOMPONENT_API UDialogueComponent : public UCharacterComponent, public IDlgDialogueParticipant, public IDialogueInterface
31{
32 GENERATED_BODY()
33
34public:
35 UDialogueComponent();
36
37 UFUNCTION(BlueprintCallable, Category = "Dialogue")
38 bool GetIsInDialogue() const{return bIsInDialogue;}
39
40 void InitialSetup();
41
42 UFUNCTION(BlueprintCallable, Category = "Dialogue")
43 virtual bool StartDialogue(class UDlgDialogue* Dialogue, const TArray<UObject*>& Participants) override;
44
45 UFUNCTION(BlueprintCallable, Category = "Dialogue")
46 virtual void SelectDialogueOption(int32 Option) override;
47 //bool?
48
49protected:
50 virtual void BeginPlay() override;
51
52
53 // Interface Values
54 // Name of this participant
55 // Used for GetParticipantName
56 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Dialogue)
57 FName DialogueParticipantName = FName("ExampleParticipantName");
58
59 // UI name of this participant, what is displayed inside the UI
60 // Used for GetParticipantDisplayName
61 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Dialogue)
62 FText DialogueParticipantDisplayName = NSLOCTEXT("ExampleNamespace", "ExampleCharacterName", "ExampleParticipantName");
63
64 // Used for GetParticipantIcon
65 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Dialogue)
66 UTexture2D* DialogueParticipantIcon;
67
68 // Context used to control the Dialogue follow
69 UPROPERTY(BlueprintReadWrite, Category = Dialogue)
70 UDlgContext* DialogueContext = nullptr;
71
72 // // Struct used to get/set the Dialogue Values
73 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Dialogue)
74 FDialogueDataValues DialogueDataStruct;
75
76 // Interface Functions
77 virtual FName GetParticipantName_Implementation() const override { return DialogueParticipantName; }
78 virtual FText GetParticipantDisplayName_Implementation(FName ActiveSpeaker) const override {return DialogueParticipantDisplayName;}
79 virtual UTexture2D* GetParticipantIcon_Implementation(FName ActiveSpeaker, FName ActiveSpeakerState) const override {return DialogueParticipantIcon;}
80 virtual ETextGender GetParticipantGender_Implementation() const override { return ETextGender::Neuter; }
81
82 virtual bool ModifyIntValue_Implementation(FName ValueName, bool bDelta, int32 Value) override;
83 virtual bool ModifyFloatValue_Implementation(FName ValueName, bool bDelta, float Value) override;
84 virtual bool ModifyBoolValue_Implementation(FName ValueName, bool bValue) override;
85 virtual bool ModifyNameValue_Implementation(FName ValueName, FName NameValue) override;
86
87 virtual float GetFloatValue_Implementation(FName ValueName) const override;
88 virtual int32 GetIntValue_Implementation(FName ValueName) const override;
89 virtual bool GetBoolValue_Implementation(FName ValueName) const override;
90 virtual FName GetNameValue_Implementation(FName ValueName) const override;
91
92 virtual bool OnDialogueEvent_Implementation(UDlgContext* Context, FName EventName) override;
93 virtual bool CheckCondition_Implementation(const UDlgContext* Context, FName ConditionName) const override;
94
95
96 UPROPERTY(BlueprintReadWrite, Category = Dialogue)
97 class UDlgContext* ActiveContext;
98
99private:
100
101
102
103
104 //Widget
105 UPROPERTY()
106 class UDialogueWidget* DialogueWidget;
107 UPROPERTY(EditAnywhere)
108 TSubclassOf<class UUserWidget> DialogueWidgetClass;
109
110 bool bIsInDialogue;
111
112};
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
Definition DialogueInterface.h:16
Represents a character component that can be added to an actor.
Definition DialogueWidget.h:11
Definition DialogueComponent.h:13