A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DlgTextArgument.h
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
2#pragma once
3
4#include "CoreMinimal.h"
6
7#include "DlgTextArgument.generated.h"
8
10class UDlgContext;
11
12
13// Argument type, which defines both the type of the argument and the way the system will acquire the value
14// NOTE: the values are out of order here for backwards compatibility
15UENUM(BlueprintType)
16enum class EDlgTextArgumentType : uint8
17{
18 // Calls GetParticipantDisplayName on the Participant
19 DisplayName = 0 UMETA(DisplayName = "Participant Display Name"),
20
21 // Calls GetParticipantGender on the Participant
22 Gender UMETA(DisplayName = "Participant Gender"),
23
24 // Calls GetIntValue on the Participant
25 DialogueInt UMETA(DisplayName = "Dialogue Int Value"),
26
27 // Calls GetFloatValue on the Participant
28 DialogueFloat UMETA(DisplayName = "Dialogue Float Value"),
29
30 // Gets the value from the Participant Int Variable
31 ClassInt UMETA(DisplayName = "Class Int Variable"),
32
33 // Gets the value from the Participant Float Variable
34 ClassFloat UMETA(DisplayName = "Class Float Variable"),
35
36 // Gets the value from the Participant Text Variable
37 ClassText UMETA(DisplayName = "Class Text Variable"),
38
39
40 // User Defined Text Argument, calls GetText on the custom text argument object.
41 //
42 // 1. Create a new Blueprint derived from DlgTextArgumentCustom (or DlgTextArgumentCustomHideCategories)
43 // 2. Override GetText
44 Custom UMETA(DisplayName = "Custom Text Argument")
45};
46
52USTRUCT(BlueprintType)
53struct DLGSYSTEM_API FDlgTextArgument
54{
55 GENERATED_USTRUCT_BODY()
56
57public:
58 //
59 // ICppStructOps Interface
60 //
62 bool operator==(const FDlgTextArgument& Other) const
63 {
64 return DisplayString == Other.DisplayString &&
65 Type == Other.Type &&
66 ParticipantName == Other.ParticipantName &&
67 VariableName == Other.VariableName &&
68 CustomTextArgument == Other.CustomTextArgument;
69 }
70
71 //
72 // Own methods
73 //
74
75 // Construct the argument for usage in FText::Format
76 FFormatArgumentValue ConstructFormatArgumentValue(const UDlgContext& Context, FName NodeOwner) const;
77
78 // Helper method to update the array InOutArgumentArray with the new arguments from Text.
79 static void UpdateTextArgumentArray(const FText& Text, TArray<FDlgTextArgument>& InOutArgumentArray);
80
81 static FString ArgumentTypeToString(EDlgTextArgumentType Type);
82
83public:
84 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Dialogue|TextArgument")
85 FString DisplayString;
86
87 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dialogue|TextArgument")
89
90 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dialogue|TextArgument")
91 FName ParticipantName;
92
93 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dialogue|TextArgument")
94 FName VariableName;
96 // User Defined Text Argument, calls GetText on the custom text argument object.
97 //
98 // 1. Create a new Blueprint derived from DlgTextArgumentCustom (or DlgTextArgumentCustomHideCategories)
99 // 2. Override GetText
100 UPROPERTY(Instanced, EditAnywhere, BlueprintReadWrite, Category = "Dialogue|TextArgument")
101 UDlgTextArgumentCustom* CustomTextArgument = nullptr;
103
104template<>
105struct TStructOpsTypeTraits<FDlgTextArgument> : public TStructOpsTypeTraitsBase2<FDlgTextArgument>
106{
107 enum
108 {
109 WithIdenticalViaEquality = true
110 };
111};
EDlgTextArgumentType
UENUM(BlueprintType)
UCLASS(BlueprintType)
Definition DlgContext.h:96
UCLASS(Blueprintable, BlueprintType, Abstract, EditInlineNew)
USTRUCT(BlueprintType)
FString DisplayString
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Dialogue|TextArgument")
FName ParticipantName
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dialogue|TextArgument")
FName VariableName
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dialogue|TextArgument")
bool operator==(const FDlgTextArgument &Other) const