A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DlgNode_Selector.h
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
2#pragma once
3#include "CoreMinimal.h"
4
5#include "Nodes/DlgNode.h"
6
7#include "DlgNode_Selector.generated.h"
8
9
10UENUM(BlueprintType)
11enum class EDlgNodeSelectorType : uint8
12{
13 // As soon as it is entered it selects its first satisfied child.
14 First UMETA(DisplayName = "First"),
15
16 // As soon as it is entered it selects a satisfied child randomly.
17 Random UMETA(DisplayName = "Random"),
18};
19
24UCLASS(BlueprintType, ClassGroup = "Dialogue")
25class DLGSYSTEM_API UDlgNode_Selector : public UDlgNode
26{
27 GENERATED_BODY()
28
29public:
30 UDlgNode_Selector() { bCheckChildrenOnEvaluation = true; }
32 // @return a one line description of an object.
33 FString GetDesc() override
34 {
35 switch (SelectorType)
36 {
38 return TEXT("Node without text and as soon as entered it selects its first satisfied child.\n It should have at least one (satisfied child), otherwise the Dialogue is terminated.");
40 return TEXT("Node without text and as soon as entered it selects a satisfied child randomly.\nIt should have at least one (satisfied child), otherwise the Dialogue is terminated.");
41 default:
42 return TEXT("UNHANDLED");
43 }
44 }
45
46 //
47 // Begin UDlgNode Interface.
48 //
49
50 bool HandleNodeEnter(UDlgContext& Context, TSet<const UDlgNode*> NodesEnteredWithThisStep) override;
51
52#if WITH_EDITOR
53 FString GetNodeTypeString() const override { return TEXT("Selector"); }
54#endif
55
56 //
57 // Begin own functions
58 //
59
60 // Gets the Selector Type
61 UFUNCTION(BlueprintPure, Category = "Dialogue|Node")
62 EDlgNodeSelectorType GetSelectorType() const { return SelectorType; }
63
64 // Sets the Selector Type
65 void SetSelectorType(EDlgNodeSelectorType InType) { SelectorType = InType; }
66
67 // Helper functions to get the names of some properties. Used by the DlgSystemEditor module.
68 static FName GetMemberNameSelectorType() { return GET_MEMBER_NAME_CHECKED(UDlgNode_Selector, SelectorType); }
69
70protected:
71 // Defines the type of selector this node represents
72 UPROPERTY(EditAnywhere, Category = "Dialogue|Node")
74};
EDlgNodeSelectorType
UENUM(BlueprintType)
UCLASS(BlueprintType)
Definition DlgContext.h:96
UCLASS(BlueprintType, ClassGroup = "Dialogue")
EDlgNodeSelectorType GetSelectorType() const
UFUNCTION(BlueprintPure, Category = "Dialogue|Node")
static FName GetMemberNameSelectorType()
FString GetDesc() override
void SetSelectorType(EDlgNodeSelectorType InType)
UCLASS(BlueprintType, Abstract, EditInlineNew, ClassGroup = "Dialogue")
Definition DlgNode.h:40
virtual bool HandleNodeEnter(UDlgContext &Context, TSet< const UDlgNode * > NodesEnteredWithThisStep)
Definition DlgNode.cpp:129