A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DialogueCondition_Details.h
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
2#pragma once
3
4#include "IPropertyTypeCustomization.h"
5#include "Layout/Visibility.h"
6#include "IDetailPropertyRow.h"
7
8#include "DlgDialogue.h"
9#include "DlgCondition.h"
10#include "DlgManager.h"
13
18
24{
26
27public:
28 static TSharedRef<IPropertyTypeCustomization> MakeInstance() { return MakeShared<Self>(); }
29
39 void CustomizeHeader(TSharedRef<IPropertyHandle> StructPropertyHandle,
40 FDetailWidgetRow& HeaderRow,
41 IPropertyTypeCustomizationUtils& StructCustomizationUtils) override;
42
50 void CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle,
51 IDetailChildrenBuilder& StructBuilder,
52 IPropertyTypeCustomizationUtils& StructCustomizationUtils) override;
53
54private:
55 // Called every time the condition type is changed
56 void OnConditionTypeChanged(bool bForceRefresh);
57
58 // Called every time the compare type is changed
59 void OnCompareTypeChanged(bool bForceRefresh);
60
61 // Getters for the visibility of some properties
62 EVisibility GetParticipantNameVisibility() const
63 {
66 ? EVisibility::Visible : EVisibility::Hidden;
67 }
68
70 {
74 ? EVisibility::Visible : EVisibility::Hidden;
75 }
76
77 EVisibility GetCallbackNameVisibility() const
78 {
82 ? EVisibility::Visible : EVisibility::Hidden;
83 }
84
93
94 EVisibility GetFloatValueVisibility() const
95 {
98 ? EVisibility::Visible : EVisibility::Hidden;
99 }
100
101 EVisibility GetNameValueVisibility() const
102 {
105 ? EVisibility::Visible : EVisibility::Hidden;
106 }
107
119
120 EVisibility GetLongTermMemoryVisibility() const
121 {
122 return ConditionType == EDlgConditionType::WasNodeVisited ? EVisibility::Visible : EVisibility::Hidden;
123 }
124
125 EVisibility GetGUIDVisibility() const
126 {
129 ? EVisibility::Visible : EVisibility::Hidden;
130 }
131
132 EVisibility GetOperationVisibility() const
133 {
138 ? EVisibility::Visible : EVisibility::Hidden;
139 }
140
153
155 {
156 return ConditionType == EDlgConditionType::Custom ? EVisibility::Visible : EVisibility::Hidden;
157 }
158
159 // Gets all the condition name suggestions depending on ConditionType from all Dialogues.
160 TArray<FName> GetAllDialoguesCallbackNames() const
161 {
162 return GetCallbackNamesForParticipant(false, false);
163 }
164
165 // Gets all the condition name suggestions depending on EventType from the current Dialogue
167 {
168 return GetCallbackNamesForParticipant(true, false);
169 }
170
172 {
173 return GetCallbackNamesForParticipant(false, true);
174 }
175
177 {
178 return GetCallbackNamesForParticipant(true, true);
179 }
180
181 TArray<FName> GetCallbackNamesForParticipant(bool bCurrentOnly, bool bOtherValue) const;
182
183 // Gets the ParticipantNames from all Dialogues.
185 {
186 TArray<FName> OutArray;
188 return OutArray;
189 }
190
191 // Gets the current Dialogue Participant Names.
196
197 // Handler for when text in the editable text box changed
198 void HandleTextCommitted(const FText& InSearchText, ETextCommit::Type CommitInfo) const
199 {
200 if (Dialogue)
201 {
203 }
204 }
205
206private:
207 // The current Condition type of the struct.
210
211 // Cache the Struct property handle
212 TSharedPtr<IPropertyHandle> StructPropertyHandle;
213
214 // Cache the property handle of some properties
215 TSharedPtr<IPropertyHandle> ParticipantNamePropertyHandle;
216 TSharedPtr<IPropertyHandle> OtherParticipantNamePropertyHandle;
217 TSharedPtr<IPropertyHandle> ConditionTypePropertyHandle;
218 TSharedPtr<IPropertyHandle> CompareTypePropertyHandle;
219 TSharedPtr<IPropertyHandle> IntValuePropertyHandle;
220
221 // just some nice utilities
222 TSharedPtr<IPropertyUtilities> PropertyUtils;
223
224 // Cache the rows of the properties, created in CustomizeChildren
225 TSharedPtr<FDialogueTextPropertyPickList_CustomRowHelper> ParticipantNamePropertyRow;
226 TSharedPtr<FDialogueTextPropertyPickList_CustomRowHelper> CallbackNamePropertyRow;
227 TSharedPtr<FDialogueIntTextBox_CustomRowHelper> IntValuePropertyRow;
228
229 IDetailPropertyRow* FloatValuePropertyRow = nullptr;
230 IDetailPropertyRow* NameValuePropertyRow = nullptr;
231 IDetailPropertyRow* BoolValuePropertyRow = nullptr;
232 IDetailPropertyRow* LongTermMemoryPropertyRow = nullptr;
233 IDetailPropertyRow* OperationPropertyRow = nullptr;
234 IDetailPropertyRow* CompareTypePropertyRow = nullptr;
235 IDetailPropertyRow* GUIDPropertyRow = nullptr;
236
237 IDetailPropertyRow* CustomConditionPropertyRow = nullptr;
238 TSharedPtr<FDialogueObject_CustomRowHelper> CustomConditionPropertyRow_CustomDisplay;
239
240 IDetailPropertyRow* ConditionTypePropertyRow = nullptr;
241 TSharedPtr<FDialogueEnumTypeWithObject_CustomRowHelper> ConditionTypePropertyRow_CustomDisplay;
242
243 TSharedPtr<FDialogueTextPropertyPickList_CustomRowHelper> OtherParticipantNamePropertyRow;
244 TSharedPtr<FDialogueTextPropertyPickList_CustomRowHelper> OtherVariableNamePropertyRow;
245
246 // Hold a reference to dialogue we are displaying.
248};
EDlgConditionType
UENUM(BlueprintType)
EDlgCompare
UENUM(BlueprintType)
EVisibility GetParticipantNameVisibility() const
EVisibility GetCallbackNameVisibility() const
void OnConditionTypeChanged(bool bForceRefresh)
TArray< FName > GetCurrentDialogueCallbackNames() const
TSharedPtr< IPropertyHandle > ConditionTypePropertyHandle
EVisibility GetFloatValueVisibility() const
TSharedPtr< FDialogueEnumTypeWithObject_CustomRowHelper > ConditionTypePropertyRow_CustomDisplay
TSharedPtr< FDialogueTextPropertyPickList_CustomRowHelper > CallbackNamePropertyRow
FDialogueCondition_Details Self
TArray< FName > GetAllDialoguesOtherVariableNames() const
TSharedPtr< IPropertyUtilities > PropertyUtils
void HandleTextCommitted(const FText &InSearchText, ETextCommit::Type CommitInfo) const
TSharedPtr< IPropertyHandle > StructPropertyHandle
TSharedPtr< IPropertyHandle > IntValuePropertyHandle
TSharedPtr< FDialogueTextPropertyPickList_CustomRowHelper > OtherVariableNamePropertyRow
static TSharedRef< IPropertyTypeCustomization > MakeInstance()
TSharedPtr< FDialogueTextPropertyPickList_CustomRowHelper > ParticipantNamePropertyRow
void CustomizeChildren(TSharedRef< IPropertyHandle > StructPropertyHandle, IDetailChildrenBuilder &StructBuilder, IPropertyTypeCustomizationUtils &StructCustomizationUtils) override
TArray< FName > GetAllDialoguesCallbackNames() const
EVisibility GetOtherParticipantNameAndVariableVisibility() const
IDetailPropertyRow * ConditionTypePropertyRow
IDetailPropertyRow * LongTermMemoryPropertyRow
EVisibility GetLongTermMemoryVisibility() const
TSharedPtr< IPropertyHandle > CompareTypePropertyHandle
IDetailPropertyRow * CompareTypePropertyRow
TSharedPtr< FDialogueIntTextBox_CustomRowHelper > IntValuePropertyRow
EVisibility GetCustomConditionVisibility() const
void CustomizeHeader(TSharedRef< IPropertyHandle > StructPropertyHandle, FDetailWidgetRow &HeaderRow, IPropertyTypeCustomizationUtils &StructCustomizationUtils) override
TArray< FName > GetCallbackNamesForParticipant(bool bCurrentOnly, bool bOtherValue) const
TArray< FName > GetAllDialoguesParticipantNames() const
void OnCompareTypeChanged(bool bForceRefresh)
TSharedPtr< FDialogueTextPropertyPickList_CustomRowHelper > OtherParticipantNamePropertyRow
IDetailPropertyRow * CustomConditionPropertyRow
TSharedPtr< IPropertyHandle > OtherParticipantNamePropertyHandle
TSharedPtr< IPropertyHandle > ParticipantNamePropertyHandle
TArray< FName > GetCurrentDialogueParticipantNames() const
TSharedPtr< FDialogueObject_CustomRowHelper > CustomConditionPropertyRow_CustomDisplay
TArray< FName > GetCurrentDialogueOtherVariableNames() const
UCLASS(BlueprintType, Meta = (DisplayThumbnail = "true"))
Definition DlgDialogue.h:85
void UpdateAndRefreshData(bool bUpdateTextsNamespacesAndKeys=false)
static void GetAllDialoguesParticipantNames(TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static TArray< FName > GetDialogueSortedParticipantNames(UDlgDialogue *Dialogue)