A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
SDialogueGraphNode.h
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
2#pragma once
3
4#include "Layout/Visibility.h"
5#include "Widgets/DeclarativeSyntaxSupport.h"
6#include "Input/Reply.h"
7#include "SGraphNode.h"
8#include "SGraphPanel.h"
9
10#include "DialogueGraphNode.h"
12
13class SVerticalBox;
14
19{
22
23public:
25 SLATE_END_ARGS()
26
27 void Construct(const FArguments& InArgs, UDialogueGraphNode* InNode);
28
29 // Begin SWidget interface
30 void OnDragEnter(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override
31 {
32 Super::OnDragEnter(MyGeometry, DragDropEvent);
33 }
34 void OnDragLeave(const FDragDropEvent& DragDropEvent) override
35 {
36 Super::OnDragLeave(DragDropEvent);
37 }
38
39 FReply OnDragOver(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override
40 {
41 return Super::OnDragOver(MyGeometry, DragDropEvent);
42 }
43 FReply OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override;
44
45 FReply OnMouseButtonDoubleClick(const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent) override
46 {
47 return Super::OnMouseButtonDoubleClick(InMyGeometry, InMouseEvent);
48 }
49 FReply OnMouseMove(const FGeometry& SenderGeometry, const FPointerEvent& MouseEvent) override
50 {
51 return Super::OnMouseMove(SenderGeometry, MouseEvent);
52 }
53 // End of SWidget interface
54
55 // Begin SNodePanel::SNode Interface
56
58 TArray<FOverlayWidgetInfo> GetOverlayWidgets(bool bSelected, const FVector2D& WidgetSize) const override;
59
61 void GetOverlayBrushes(bool bSelected, const FVector2D WidgetSize, TArray<FOverlayBrushInfo>& Brushes) const override;
62 // End SNodePanel::SNode Interface
63
64 // Begin SGraphNode Interface
65
67 void UpdateGraphNode() override;
68 // End SGraphNode Interface
69
70 // Begin SDialogueGraphNode_Base Interface
71 EVisibility GetNodeVisibility() const override
72 {
73 return DialogueGraphNode && DialogueGraphNode->ShouldDrawNode() ? EVisibility::Visible : EVisibility::Hidden;
74 }
75 // End SDialogueGraphNode_Base Interface
76
77protected:
78 //
79 // SGraphNode Interface
80 //
81
83 TSharedPtr<SToolTip> GetComplexTooltip() override { return Super::GetComplexTooltip(); }
84
86 bool UseLowDetailNodeTitles() const override
87 {
88 if (const SGraphPanel* MyOwnerPanel = GetOwnerPanel().Get())
89 {
90 return MyOwnerPanel->GetCurrentLOD() <= EGraphRenderingLOD::LowestDetail;
91 }
92
93 return false;
94 }
95
97 FSlateColor GetCommentColor() const override { return DialogueGraphNode->GetNodeBackgroundColor(); }
98
99 /* Populate a meta data tag with information about this graph node. sed by UpdateGraphNode() */
100 void PopulateMetaTag(class FGraphNodeMetaData* TagMeta) const override { Super::PopulateMetaTag(TagMeta); }
101
102 //
103 // Begin own functions
104 //
105
107 TSharedRef<SWidget> GetNodeBodyWidget();
108
110 TSharedRef<SWidget> GetTitleWidget();
111
113 TSharedRef<SWidget> GetDescriptionWidget();
114
115 // Gets the background color for a node
117
118 // Gets the main description of this Node.
120 {
122 {
123 return DialogueGraphNode->GetDialogueNode().GetNodeUnformattedText();
124 }
125
126 return FText::GetEmpty();
127 }
128
129 // Gets all speech sequence entries for the Node of type Speech Sequence
130 const TArray<FDlgSpeechSequenceEntry>& GetSpeechSequenceEntries() const
131 {
132 return DialogueGraphNode->GetDialogueNode<UDlgNode_SpeechSequence>().GetNodeSpeechSequence();
133 }
134
135 // Gets the speech sequence description for the entry at index SpeechEntryIndex
136 FText GetDescriptionForSpeechSequenceEntryAt(int32 SpeechEntryIndex) const
137 {
139 {
140 return GetSpeechSequenceEntries()[SpeechEntryIndex].Text;
141 }
142
143 return FText::GetEmpty();
144 }
145
146 // Gets the speaker (owner) of speech sequence for the entry at index SpeechEntryIndex
147 FText GetSpeakerForSpeechSequenceEntryAt(int32 SpeechEntryIndex) const
148 {
150 {
151 return FText::FromName(GetSpeechSequenceEntries()[SpeechEntryIndex].Speaker);
152 }
153
154 return FText::GetEmpty();
155 }
156
157 // Gets the visibility of the Description
158 EVisibility GetDescriptionVisibility() const
159 {
160 // LOD this out once things get too small
161 TSharedPtr<SGraphPanel> MyOwnerPanel = GetOwnerPanel();
162 return !MyOwnerPanel.IsValid() || MyOwnerPanel->GetCurrentLOD() > EGraphRenderingLOD::LowDetail ? EVisibility::Visible : EVisibility::Collapsed;
163 }
164
166 FText GetIndexText() const { return FText::AsNumber(DialogueGraphNode->GetDialogueNodeIndex()); }
167
170
173
176
179
182
184 EVisibility GetOverlayWidgetVisibility() const;
185
187 FSlateColor GetOverlayWidgetBackgroundColor(bool bHovered) const
188 {
189 // Hovered is gray
191 }
192
194 void OnIndexHoverStateChanged(bool bHovered);
195 // End own functions
196
197protected:
198 // The dialogue this view represents
200
202 TSharedPtr<SBorder> NodeBodyWidget;
203
205 TSharedPtr<SWidget> TitleWidget;
206
208 TSharedPtr<SWidget> DescriptionWidget;
209
211 TSharedPtr<SWidget> IndexOverlayWidget;
212
214 TSharedPtr<SWidget> ConditionOverlayWidget;
215
217 TSharedPtr<SWidget> EventOverlayWidget;
218
220 TSharedPtr<SWidget> VoiceOverlayWidget;
221
223 TSharedPtr<SWidget> GenericOverlayWidget;
224};
const UDlgSystemSettings * Settings
void OnDragLeave(const FDragDropEvent &DragDropEvent) override
TSharedRef< SWidget > GetNodeBodyWidget()
TSharedPtr< SToolTip > GetComplexTooltip() override
FText GetGenericOverlayTooltipText() const
UDialogueGraphNode * DialogueGraphNode
FText GetDescriptionForSpeechSequenceEntryAt(int32 SpeechEntryIndex) const
FSlateColor GetBackgroundColor() const
FSlateColor GetOverlayWidgetBackgroundColor(bool bHovered) const
FText GetIndexOverlayTooltipText() const
void UpdateGraphNode() override
TSharedPtr< SWidget > GenericOverlayWidget
FText GetVoiceOverlayTooltipText() const
FSlateColor GetCommentColor() const override
FReply OnDrop(const FGeometry &MyGeometry, const FDragDropEvent &DragDropEvent) override
void GetOverlayBrushes(bool bSelected, const FVector2D WidgetSize, TArray< FOverlayBrushInfo > &Brushes) const override
TSharedPtr< SBorder > NodeBodyWidget
void Construct(const FArguments &InArgs, UDialogueGraphNode *InNode)
const TArray< FDlgSpeechSequenceEntry > & GetSpeechSequenceEntries() const
FReply OnDragOver(const FGeometry &MyGeometry, const FDragDropEvent &DragDropEvent) override
FText GetEventOverlayTooltipText() const
TSharedRef< SWidget > GetTitleWidget()
TSharedPtr< SWidget > VoiceOverlayWidget
EVisibility GetNodeVisibility() const override
FReply OnMouseMove(const FGeometry &SenderGeometry, const FPointerEvent &MouseEvent) override
void PopulateMetaTag(class FGraphNodeMetaData *TagMeta) const override
TSharedRef< SWidget > GetDescriptionWidget()
void OnIndexHoverStateChanged(bool bHovered)
TSharedPtr< SWidget > IndexOverlayWidget
TSharedPtr< SWidget > TitleWidget
FReply OnMouseButtonDoubleClick(const FGeometry &InMyGeometry, const FPointerEvent &InMouseEvent) override
TSharedPtr< SWidget > EventOverlayWidget
TSharedPtr< SWidget > ConditionOverlayWidget
TArray< FOverlayWidgetInfo > GetOverlayWidgets(bool bSelected, const FVector2D &WidgetSize) const override
FText GetConditionOverlayTooltipText() const
FText GetSpeakerForSpeechSequenceEntryAt(int32 SpeechEntryIndex) const
EVisibility GetOverlayWidgetVisibility() const
EVisibility GetDescriptionVisibility() const
bool UseLowDetailNodeTitles() const override
void OnDragEnter(const FGeometry &MyGeometry, const FDragDropEvent &DragDropEvent) override
FText GetDescription() const
SDialogueGraphNode_Base Super
SDialogueGraphNode Self
TSharedPtr< SWidget > DescriptionWidget
virtual int32 GetDialogueNodeIndex() const
bool ShouldDrawNode() const
FLinearColor GetNodeBackgroundColor() const override
bool IsDialogueNodeSet() const
const DlgNodeType & GetDialogueNode() const
bool IsSpeechSequenceNode() const
UCLASS(BlueprintType, ClassGroup = "Dialogue")
FLinearColor BorderBackgroundColor
UPROPERTY(Category = "Graph Node Color", Config, EditAnywhere)
FLinearColor BorderHoveredBackgroundColor
UPROPERTY(Category = "Graph Node Color", Config, EditAnywhere)