Node colours are now driven by combo input assets, and overridden by the combo action if a colour is set there.

This commit is contained in:
Jamie Greunbaum 2023-10-03 00:23:30 -04:00
parent 510ccb936a
commit dcaac98f50
22 changed files with 29 additions and 1342 deletions

View File

@ -1,6 +0,0 @@
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
#include "Data/ComboActionAdditionalData.h"

View File

@ -1,222 +0,0 @@
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
#include "Data/ComboActionContext.h"
#include "Interfaces/ComboActionInterface.h"
bool UComboActionContext::IsValid() const
{
return ActiveNode != nullptr;// && DialogueParticipant.GetInterface() != nullptr && PlayerDialogueParticipant.GetInterface() != nullptr;
}
void UComboActionContext::SetComboActionContext(UComboActionGraphNode *NewActiveNode, const TArray<UComboActionGraphNode*> NewAllowedChildNodes)
{
//DialogueParticipant = NewParticipant;
//ActiveNode = NewActiveNode;
//AllowedChildNodes = NewAllowedChildNodes;
//if (!DialogueParticipants.Contains(NewParticipant))
//{
// DialogueParticipants.Add(NewParticipant);
//}
}
//void UComboActionContext::UpdateDialogueParticipant(const TScriptInterface<IComboActionParticipantInterface> NewParticipant)
//{
// DialogueParticipant = NewParticipant;
//
// AddDialogueParticipant(NewParticipant);
//}
//
//void UComboActionContext::UpdateActiveDialogueNode(UComboActionGraphNode *NewActiveNode)
//{
// ActiveNode = NewActiveNode;
//}
//
//void UComboActionContext::UpdateAllowedChildrenNodes(const TArray<UComboActionGraphNode*> &NewNodes)
//{
// AllowedChildNodes = NewNodes;
//}
//
//void UComboActionContext::UpdateActiveDialogueRowDataIndex(const int32 NewIndex)
//{
// ActiveDialogueRowDataIndex = NewIndex;
//}
//
//void UComboActionContext::UpdateDialoguePlayerParticipant(const TScriptInterface<IComboActionParticipantInterface> NewParticipant)
//{
// PlayerDialogueParticipant = NewParticipant;
//
// AddDialogueParticipant(NewParticipant);
//}
//
//void UComboActionContext::UpdateActiveDialogueParticipant(const TScriptInterface<IComboActionParticipantInterface> NewParticipant)
//{
// if (NewParticipant != PlayerDialogueParticipant && NewParticipant != DialogueParticipant)
// {
// //TODO: Properly log this
// return;
// }
//
// ActiveDialogueParticipant = NewParticipant;
//}
//
//void UComboActionContext::AddTraversedNode(const UComboActionGraphNode *TraversedNode)
//{
// if (!TraversedNode) return;
//
// // If we have already passed over this Node, then just increase the counter
// if (TraversedPath.Contains(TraversedNode->GetNodeGUID()))
// {
// TraversedPath[TraversedNode->GetNodeGUID()]++;
// }
// else
// {
// TraversedPath.Add(TraversedNode->GetNodeGUID(), 1);
// }
//}
//
//bool UComboActionContext::AddDialogueParticipants(const TArray<TScriptInterface<IComboActionParticipantInterface>>& NewParticipants)
//{
// bool bSatisfied = true;
// for (const auto& Itr : NewParticipants)
// {
// const bool bTempSatisfied = AddDialogueParticipant(Itr);
// bSatisfied = bTempSatisfied ? bSatisfied : bTempSatisfied;
// }
//
// return bSatisfied;
//}
//
//bool UComboActionContext::AddDialogueParticipant(const TScriptInterface<IComboActionParticipantInterface>& NewParticipant)
//{
// if (DialogueParticipants.Contains(NewParticipant))
// {
// return false;
// }
//
// DialogueParticipants.Add(NewParticipant);
// return true;
//}
//
//bool UComboActionContext::RemoveDialogueParticipants(const TArray<TScriptInterface<IComboActionParticipantInterface>>& NewParticipants)
//{
// bool bSatisfied = true;
// for (const auto& Itr : NewParticipants)
// {
// const bool bTempSatisfied = RemoveDialogueParticipant(Itr);
// bSatisfied = bTempSatisfied ? bSatisfied : bTempSatisfied;
// }
//
// return bSatisfied;
//}
//
//bool UComboActionContext::RemoveDialogueParticipant(const TScriptInterface<IComboActionParticipantInterface>& NewParticipant)
//{
// if (DialogueParticipants.Contains(NewParticipant))
// {
// DialogueParticipants.Remove(NewParticipant);
// return true;
// }
//
// return false;
//}
//
//void UComboActionContext::ClearDialogueParticipants()
//{
// DialogueParticipants.Empty();
//}
void UComboActionContext::SetComboActionContextBP(UComboActionGraphNode *NewActiveNode,TArray<UComboActionGraphNode*> NewAllowedChildNodes)
{
//this->SetComboActionContext(NewParticipant, NewActiveNode, NewAllowedChildNodes);
ComboActionContextUpdatedFromBlueprint.Broadcast(this);
}
//void UComboActionContext::UpdateDialogueParticipantBP(const TScriptInterface<IComboActionParticipantInterface> NewParticipant)
//{
// UpdateDialogueParticipant(NewParticipant);
//
// DialogueContextUpdatedFromBlueprint.Broadcast(this);
//}
//
//void UComboActionContext::UpdateActiveDialogueNodeBP(UComboActionGraphNode *NewActiveNode)
//{
// UpdateActiveDialogueNode(NewActiveNode);
//
// DialogueContextUpdatedFromBlueprint.Broadcast(this);
//}
//
//void UComboActionContext::UpdateActiveDialogueRowBP(const FDialogueRow &NewActiveRow)
//{
// UpdateActiveDialogueRow(NewActiveRow);
//
// DialogueContextUpdatedFromBlueprint.Broadcast(this);
//}
//
//void UComboActionContext::UpdateActiveDialogueRowDataIndexBP(const int32 NewIndex)
//{
// UpdateActiveDialogueRowDataIndex(NewIndex);
//
// DialogueContextUpdatedFromBlueprint.Broadcast(this);
//}
//
//void UComboActionContext::UpdateDialoguePlayerParticipantBP(const TScriptInterface<IComboActionParticipantInterface> NewParticipant)
//{
// UpdateDialoguePlayerParticipant(NewParticipant);
//
// DialogueContextUpdatedFromBlueprint.Broadcast(this);
//}
//
//void UComboActionContext::UpdateActiveDialogueParticipantBP(const TScriptInterface<IComboActionParticipantInterface> NewParticipant)
//{
// UpdateActiveDialogueParticipant(NewParticipant);
//
// DialogueContextUpdatedFromBlueprint.Broadcast(this);
//}
//
//bool UComboActionContext::AddDialogueParticipantBP(const TScriptInterface<IComboActionParticipantInterface> &NewParticipant)
//{
// if (AddDialogueParticipant(NewParticipant))
// {
// DialogueContextUpdatedFromBlueprint.Broadcast(this);
// return true;
// }
//
// return false;
//}
//
//bool UComboActionContext::RemoveDialogueParticipantBP(const TScriptInterface<IComboActionParticipantInterface> &NewParticipant)
//{
// if (RemoveDialogueParticipant(NewParticipant))
// {
// DialogueContextUpdatedFromBlueprint.Broadcast(this);
// return true;
// }
//
// return false;
//}
//
//bool UComboActionContext::AddDialogueParticipantsBP(const TArray<TScriptInterface<IComboActionParticipantInterface>> &NewParticipants)
//{
// if (AddDialogueParticipants(NewParticipants))
// {
// DialogueContextUpdatedFromBlueprint.Broadcast(this);
// return true;
// }
//
// return false;
//}
//
//bool UComboActionContext::RemoveDialogueParticipantsBP(const TArray<TScriptInterface<IComboActionParticipantInterface>> &NewParticipants)
//{
// if (RemoveDialogueParticipants(NewParticipants))
// {
// DialogueContextUpdatedFromBlueprint.Broadcast(this);
// return true;
// }
//
// return false;
//}

View File

@ -1,55 +0,0 @@
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
#include "Decorators/ComboActionDecoratorBase.h"
#if WITH_EDITOR
#include "Editor.h"
#endif
DEFINE_LOG_CATEGORY(LogComboActionDecoratorBase);
#define LOCTEXT_NAMESPACE "ComboActionDecoratorBase"
bool UComboActionDecoratorBase::ValidateDecorator_Implementation(TArray<FText>& ValidationMessages)
{
bool bSatisfied = true;
const FText Name = FText::FromString(GetName());
// This is to ensure we are not throwing InvalidWorld errors in Editor with no Gameplay.
bool bIsEditorCall = false;
#if WITH_EDITOR
if (GEditor != nullptr)
{
bIsEditorCall = !GEditor->GetPlayInEditorSessionInfo().IsSet();
}
#endif
if (GetOwningWorld() == nullptr && bIsEditorCall == false)
{
const FText TempText = FText::Format(LOCTEXT("ComboActionDecorator_Base_Validation_World", "[{0}]: No valid World!"), Name);
ValidationMessages.Add(TempText);
bSatisfied = false;
}
if (DecoratorState == EComboActionDecoratorState::Uninitialized && bIsEditorCall == false)
{
const FText TempText = FText::Format(LOCTEXT("ComboActionDecorator_Base_Validation_State", "[{0}]: Not Initialized properly!"), Name);
ValidationMessages.Add(TempText);
bSatisfied = false;
}
if (GetOwner() == nullptr)
{
const FText TempText = FText::Format(LOCTEXT("ComboActionDecorator_Base_Validation_Owner", "[{0}]: No valid Owner!"), Name);
ValidationMessages.Add(TempText);
bSatisfied = false;
}
return bSatisfied;
}
#undef LOCTEXT_NAMESPACE

View File

@ -1,6 +0,0 @@
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
#include "Interfaces/ComboActionGraphManagerInterface.h"

View File

@ -1,6 +0,0 @@
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
#include "Interfaces/ComboActionInterface.h"

View File

@ -6,10 +6,6 @@
#include "ComboInputAssets.h"
#include "ComboInputTriggers.h"
#include "Data/ComboActionContext.h"
#include "Decorators/ComboActionDecoratorBase.h"
#include "Interfaces/ComboActionGraphManagerInterface.h"
DEFINE_LOG_CATEGORY(LogComboActionGraphNode);
#define LOCTEXT_NAMESPACE "ComboActionGraphNode"
@ -69,17 +65,6 @@ void UComboActionGraphNode::ProcessNode(const TScriptInterface<IComboActionGraph
UE_LOG(LogComboActionGraphNode, Error, TEXT("[ProcessNode] Invalid owning Graph!!"));
return;
}
//UComboActionContext *Context = Manager->GetDialogueContext();
//if (!Context || !UComboActionSystemBFC::IsContextValid(Context))
//{
// Manager->GetDialogueFailedEventHandle().Broadcast(TEXT("[ProcessNode] Invalid Dialogue Context!!"));
// return;
//}
//
//UComboActionSystemBFC::ExecuteDecorators(this, Context);
//
//Manager->GetDialogueNodeStartedEventHandle().Broadcast(Context);
}
void UComboActionGraphNode::SetNodeIndex(const int32 NewIndex)

View File

@ -1,9 +1,6 @@
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
#include "Nodes/ComboActionGraphNode_ActionNode.h"
#include "Data/ComboActionContext.h"
#include "Interfaces/ComboActionGraphManagerInterface.h"
#include "Nodes/ComboActionGraphNode_StartNode.h"
#define LOCTEXT_NAMESPACE "ComboActionGraphNode_ActionNode"
@ -15,8 +12,6 @@ UComboActionGraphNode_ActionNode::UComboActionGraphNode_ActionNode()
this->NodeTitle = LOCTEXT("ComboActionGraphNode_ActionNodeTitle", "Action Node");
this->NodeTypeName = LOCTEXT("ComboActionGraphNode_ActionNodeInternalTitle", "Action Node");
this->ContextMenuName = LOCTEXT("ComboActionGraphNode_ActionNodeContextMenuName", "Action Node");
this->BackgroundColor = FLinearColor(FColor::Turquoise);
this->NodeTooltipText = LOCTEXT("ComboActionGraphNode_ActionTooltip", "Action node is a node which contains combo actions based on inputs.");
#endif

View File

@ -2,6 +2,8 @@
#include "Nodes/ComboActionGraphNode_ActionNodeBase.h"
#include "ComboInputAssets.h"
#define LOCTEXT_NAMESPACE "ComboActionGraphNode_ActionNodeBase"
@ -11,7 +13,6 @@ UComboActionGraphNode_ActionNodeBase::UComboActionGraphNode_ActionNodeBase()
this->NodeTitle = LOCTEXT("ComboActionGraphNode_ActionNodeBaseTitle", "Action Node Base");
this->NodeTypeName = LOCTEXT("ComboActionGraphNode_ActionNodeBaseInternalTitle", "Action Node Base");
this->ContextMenuName = LOCTEXT("ComboActionGraphNode_ActionNodeBaseContextMenu", "Action Node");
this->BackgroundColor = FLinearColor(FColor::Orange);
this->NodeTooltipText = LOCTEXT("ComboActionGraphNode_BaseTooltip", "* Abstract class, should not appear in graph editor.\n* Enhances 'ComboActionGraphNode' Base class with action data.");
#endif
@ -150,6 +151,19 @@ void UComboActionGraphNode_ActionNodeBase::PostEditChangeProperty(FPropertyChang
}
}
FLinearColor UComboActionGraphNode_ActionNodeBase::GetBackgroundColor() const
{
if (this->ComboAction && this->ComboAction->NodeColor != FLinearColor())
{
return this->ComboAction->NodeColor;
}
else if (this->ComboInput)
{
return this->ComboInput->NodeColor;
}
return Super::GetBackgroundColor();
}
FText UComboActionGraphNode_ActionNodeBase::GetDescription_Implementation() const
{
return LOCTEXT("ComboActionGraphNode_BaseDescription", "Action base node has no logic tied to itself.");
@ -157,22 +171,7 @@ FText UComboActionGraphNode_ActionNodeBase::GetDescription_Implementation() cons
TArray<FText> UComboActionGraphNode_ActionNodeBase::GetPreviews() const
{
TArray<FText> ReturnValues;
//const auto Row = UComboActionSystemBFC::GetDialogueRow( this );
//if (UComboActionSystemBFC::IsDialogueRowValid(Row))
//{
// for (auto Itr : Row.DialogueRowData.Array())
// {
// ReturnValues.Add( Itr.RowText );
// }
//}
//else
//{
// ReturnValues.Empty();
//}
return ReturnValues;
return TArray<FText>();
}
#endif

View File

@ -12,7 +12,7 @@ UComboActionGraphNode_StartNode::UComboActionGraphNode_StartNode()
this->NodeTitle = LOCTEXT("ComboActionGraphNode_StartNodeTitle", "Start Action");
this->NodeTypeName = LOCTEXT("ComboActionGraphNode_StartNodeInternalTitle", "Start Action");
this->ContextMenuName = LOCTEXT("ComboActionGraphNode_StartNodeContextMenuName", "Start Action");
this->BackgroundColor = FLinearColor(0, 1, 0, 1);
this->BackgroundColor = FLinearColor(0.0f, 1.0f, 0.0f, 1.0f);
this->bAllowCopy = false;
this->bAllowCut = false;

View File

@ -4,8 +4,7 @@
#include "CoreMinimal.h"
#include "GameplayTagContainer.h"
#include "Decorators/ComboActionDecoratorBase.h"
#include "Nodes/ComboActionGraphEdge.h"
#include "ComboActionGraph.generated.h"
@ -30,11 +29,6 @@ public:
#pragma region Variables
protected:
/**
* A set of gameplay tags associated with this dialogue graph.
*/
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Combo Input|Action")
FGameplayTagContainer GraphTags;
/**
* GUID for this Mountea Dialogue Graph.
* Unique identifier for this Dialogue Graph instance.

View File

@ -23,6 +23,10 @@ public:
// Human-readable name of this combo action.
UPROPERTY(BlueprintReadOnly, EditAnywhere)
FName ActionName;
// Sets the colour of the node this action is tied to. Will override any other colours.
UPROPERTY(BlueprintReadOnly, EditAnywhere)
FLinearColor NodeColor;
};
/**
@ -87,4 +91,8 @@ public:
// this combo input asset will simply represent that action.
UPROPERTY(BlueprintReadWrite, EditAnywhere)
TSet<const class UInputAction*> ActionGroup;
// Sets the colour of the node this action is tied to. Can be overridden by UComboAction.
UPROPERTY(BlueprintReadOnly, EditAnywhere)
FLinearColor NodeColor;
};

View File

@ -1,14 +0,0 @@
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "ComboActionAdditionalData.generated.h"
UCLASS(Abstract, BlueprintType, meta=(UsesHierarchy=true), Blueprintable, ClassGroup="Combo Input|Action")
class COMBOINPUT_API UComboActionAdditionalData : public UObject
{
GENERATED_BODY()
};

View File

@ -1,203 +0,0 @@
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Data/ComboActionGraphDataTypes.h"
#include "Nodes/ComboActionGraphNode.h"
#include "UObject/Object.h"
#include "ComboActionContext.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FComboActionContextUpdatedFromBlueprint, class UComboActionContext *, Context);
/**
* Dialogue Context.
*
* Contains information needed to successfully start Dialogue.
* Also helps tracking Dialogue Specific data. Is recycled for whole Dialogue Graph.
*
* In Dialogue Manager Component is used as Transient object, which is nullified once Dialogue ends and is never saved.
*/
UCLASS()
class COMBOINPUT_API UComboActionContext : public UObject
{
GENERATED_BODY()
public:
///**
// * Active Dialogue Participant Interface reference.
// *
// * This is the Participant who is Active right now.
// * ❔ Lead Node sets this value to Dialogue Participant.
// * ❔ Answer Node sets this value to Player Participant.
// * ❗ Might be invalid
// */
//UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Combo Input|Action")
// TScriptInterface<IComboActionParticipantInterface> ActionParticipant;
///**
// * Player Dialogue Participant Interface reference.
// *
// * This is the Participant who represent the Player.
// * ❗ Might be invalid
// */
//UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Combo Input|Action")
// TScriptInterface<class IComboActionParticipantInterface> PlayerDialogueParticipant;
//UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Combo Input|Action")
// TScriptInterface<class IComboActionParticipantInterface> DialogueParticipant;
//UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Combo Input|Action")
// TArray<TScriptInterface<class IComboActionParticipantInterface>> DialogueParticipants;
/**
* Pointer to the Node which is currently active.
* Might be null
*/
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Combo Input|Action")
class UComboActionGraphNode *ActiveNode = nullptr;
/**
* List of Nodes that can be accessed from Active Node.
* Already filtered to contain only those that can be triggered.
*
* Filter is done by 'CanStartNode', which can have its own logic and can be driven by Decorators as well.
* Might be empty
*/
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Combo Input|Action")
TArray<class UComboActionGraphNode*> AllowedChildNodes;
/**
* Index of currently used Dialogue Row Data row.
*/
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Combo Input|Action")
int32 ActiveDialogueRowDataIndex = 0;
/**
* Contains mapped list of Traversed Nodes by GUIDs.
* Each time Dialogue is updated, like node is selected or starts itself, this Path is updated.
* Updates Participant once Dialogue is done.
*/
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Combo Input|Action", meta=(NoResetToDefault))
TMap<FGuid, int32> TraversedPath;
public:
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action|Debug")
virtual bool IsValid() const;
//TScriptInterface<class IComboActionParticipantInterface> GetDialoguePlayerParticipant() const { return this->PlayerDialogueParticipant; }
//TScriptInterface<class IComboActionParticipantInterface> GetDialogueParticipant() const { return this->DialogueParticipant; }
//TArray<TScriptInterface<class IComboActionParticipantInterface>> GetDialogueParticipants() const { return this->DialogueParticipants; }
/**
* Returns the Active Node object.
* Might be null
*
* @return Active Node if any specified
*/
class UComboActionGraphNode *GetActiveNode() const { return this->ActiveNode; }
/**
* Returns lsit of Children Nodes from Active Node.
* Might be empty
*
* @return List of allowed Children Nodes
*/
TArray<class UComboActionGraphNode*> GetChildrenNodes() const { return this->AllowedChildNodes; }
///**
// *Returns the Active Dialogue Row Data Index.
// *
// * @return Active Row Index
// */
//int32 GetActiveDialogueRowDataIndex() const { return this->ActiveDialogueRowDataIndex; }
/**
* Returns the map of nodes traversed during this dialogue instance.
*
* @return The map of nodes traversed during this dialogue instance.
*/
TMap<FGuid, int32> GetTraversedPath() const { return TraversedPath; }
virtual void SetComboActionContext(class UComboActionGraphNode *NewActiveNode, TArray<class UComboActionGraphNode*> NewAllowedChildNodes);
//virtual void UpdateDialogueParticipant(TScriptInterface<class IComboActionParticipantInterface> NewParticipant);
//virtual void UpdateActiveDialogueNode(class UComboActionGraphNode *NewActiveNode);
//virtual void UpdateAllowedChildrenNodes(const TArray<class UComboActionGraphNode*> &NewNodes);
//virtual void UpdateActiveDialogueRowDataIndex(int32 NewIndex);
//void UpdateDialoguePlayerParticipant(TScriptInterface<class IComboActionParticipantInterface> NewParticipant);
//void UpdateActiveDialogueParticipant(TScriptInterface<class IComboActionParticipantInterface> NewParticipant);
//void AddTraversedNode(const class UComboActionGraphNode* TraversedNode);
//virtual bool AddDialogueParticipants(const TArray<TScriptInterface<class IComboActionParticipantInterface>> &NewParticipants);
//virtual bool AddDialogueParticipant(const TScriptInterface<class IComboActionParticipantInterface> &NewParticipant);
//virtual bool RemoveDialogueParticipants(const TArray<TScriptInterface<class IComboActionParticipantInterface>> &NewParticipants);
//virtual bool RemoveDialogueParticipant(const TScriptInterface<class IComboActionParticipantInterface> &NewParticipant);
//virtual void ClearDialogueParticipants();
/**
* Sets the dialogue context.
*
* @param NewParticipant The new dialogue participant.
* @param NewActiveNode The new active dialogue node.
* @param NewAllowedChildNodes The new allowed child dialogue nodes.
*/
UFUNCTION(BlueprintCallable, Category="Combo Input|Action|Context", meta=(DisplayName="SetDialogueContext"))
virtual void SetComboActionContextBP(class UComboActionGraphNode *NewActiveNode, TArray<class UComboActionGraphNode*> NewAllowedChildNodes);
///**
// * Updates Dialogue Participant.
// *
// * @param NewParticipant - new Dialogue Participant.
// * ❗ Must implement IComboActionParticipantInterface.
// */
//UFUNCTION(BlueprintCallable, Category="Combo Input|Action|Context", meta=(DisplayName="UpdateDialogueParticipant"))
// virtual void UpdateDialogueParticipantBP(TScriptInterface<class IComboActionParticipantInterface> NewParticipant);
/**
* Updates Active Dialogue Node in Context.
*
* @param NewActiveNode - New Active Dialogue Node to update to.
* Must not be Null
*/
//UFUNCTION(BlueprintCallable, Category="Combo Input|Action|Context", meta=(DisplayName="UpdateActiveDialogueNode"))
// virtual void UpdateActiveDialogueNodeBP(class UComboActionGraphNode *NewActiveNode);
/**
* Updates the active dialogue row Data Index.
*
* @param NewIndex - The new active dialogue data row Index.
*/
//UFUNCTION(BlueprintCallable, Category="Combo Input|Action|Context", meta=(DisplayName="UpdateActiveDialogueRowDataIndex"))
// virtual void UpdateActiveDialogueRowDataIndexBP(int32 NewIndex);
///**
// * Updates Dialogue Player Participant.
// *
// * @param NewParticipant - new Dialogue Player Participant.
// * ❗ Must implement IMounteaDialogueParticipantInterface.
// */
//UFUNCTION(BlueprintCallable, Category="Combo Input|Action|Context", meta=(DisplayName="UpdateDialoguePlayerParticipant"))
// void UpdateDialoguePlayerParticipantBP(TScriptInterface<class IComboActionParticipantInterface> NewParticipant);
///**
// * Updates Dialogue Active Participant.
// *
// * @param NewParticipant - new Dialogue Active Participant.
// * ❗ Must implement IMounteaDialogueParticipantInterface.
// */
//UFUNCTION(BlueprintCallable, Category="Combo Input|Action|Context", meta=(DisplayName="UpdateActiveDialogueParticipant"))
// void UpdateActiveDialogueParticipantBP(TScriptInterface<class IComboActionParticipantInterface> NewParticipant);
//UFUNCTION(BlueprintCallable, Category="Combo Input|Action|Context", meta=(DisplayName="AddDialogueParticipant"))
// virtual bool AddDialogueParticipantBP(const TScriptInterface<class IComboActionParticipantInterface>& NewParticipant);
//
//UFUNCTION(BlueprintCallable, Category="Combo Input|Action|Context", meta=(DisplayName="RemoveDialogueParticipant"))
// virtual bool RemoveDialogueParticipantBP(const TScriptInterface<class IComboActionParticipantInterface>& NewParticipant);
//UFUNCTION(BlueprintCallable, Category="Combo Input|Action|Context", meta=(DisplayName="AddDialogueParticipants"))
// virtual bool AddDialogueParticipantsBP(const TArray<TScriptInterface<class IComboActionParticipantInterface>>& NewParticipants);
//
//UFUNCTION(BlueprintCallable, Category="Combo Input|Action|Context", meta=(DisplayName="RemoveDialogueParticipants"))
// virtual bool RemoveDialogueParticipantsBP(const TArray<TScriptInterface<class IComboActionParticipantInterface>>& NewParticipants);
FComboActionContextUpdatedFromBlueprint ComboActionContextUpdatedFromBlueprint;
};

View File

@ -1,27 +0,0 @@
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "ComboActionAdditionalData.h"
#include "GameplayTagContainer.h"
#include "Blueprint/UserWidget.h"
#include "Engine/DataTable.h"
#include "UObject/Object.h"
#include "Fonts/SlateFontInfo.h"
#include "Styling/CoreStyle.h"
#include "ComboActionGraphDataTypes.generated.h"
/**
* Combo Action Manager state
*/
UENUM(BlueprintType)
enum class EComboActionManagerState : uint8
{
Disabled UMETA(DisplayName="Disabled", Tooltip="Disabled. Combo action cannot be used."),
Enabled UMETA(DisplayName="Enabled", Tooltip="Enabled. Combo action can start."),
Active UMETA(DisplayName="Activated", Tooltip="Combo action is activated"),
};

View File

@ -1,254 +0,0 @@
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Engine/Level.h"
#include "ComboActionDecoratorBase.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(LogComboActionDecoratorBase, Log, All);
#define LOCTEXT_NAMESPACE "NodeDecoratorBase"
UENUM(BlueprintType)
enum class EComboActionDecoratorState : uint8
{
Uninitialized,
Initialized
};
/**
* Combo Action Decorator
*
* Decorators are instanced and exist only as "triggers".
* Could be used to start audio, play animation or do some logic behind the curtains, like triggering Cutscene etc.
*/
UCLASS(Abstract, Blueprintable, BlueprintType, EditInlineNew, ClassGroup=("Combo Input|Action"), AutoExpandCategories=("Combo Input, Action"))
class COMBOINPUT_API UComboActionDecoratorBase : public UObject
{
GENERATED_BODY()
public:
FORCEINLINE ULevel *GetLevel() const { return this->GetTypedOuter<ULevel>(); }
public:
virtual UWorld *GetWorld() const override
{
if (this->OwningWorld)
{
return this->OwningWorld;
}
// CDO objects do not belong to a world
// If the actors outer is destroyed or unreachable we are shutting down and the world should be nullptr
if (!this->HasAnyFlags(EObjectFlags::RF_ClassDefaultObject) && ensureMsgf(this->GetOuter(), TEXT("Actor: %s has a null OuterPrivate in AActor::GetWorld()"), *this->GetFullName()) &&
!this->GetOuter()->HasAnyFlags(EObjectFlags::RF_BeginDestroyed) && !this->GetOuter()->IsUnreachable())
{
if (ULevel *Level = this->GetLevel())
{
return Level->OwningWorld;
}
}
return nullptr;
}
UFUNCTION(BlueprintNativeEvent, Category="Combo Input|Action|Decorators")
FString GetDecoratorDocumentationLink() const;
virtual FString GetDecoratorDocumentationLink_Implementation() const { return TEXT("This is a place where a link to the documentation will go eventually."); }
public:
/**
* Initializes the Decorator.
* In C++ saves the World for later use.
* In Blueprints should be used to cache values to avoid overhead in 'ExecuteDecorator'.
*/
UFUNCTION(BlueprintNativeEvent, Category="Combo Input|Action|Decorators")
void InitializeDecorator(UWorld *World);
virtual void InitializeDecorator_Implementation(UWorld *World)
{
this->OwningWorld = World;
if (World)
{
this->DecoratorState = EComboActionDecoratorState::Initialized;
}
}
/**
* Cleans up the Decorator.
* In Blueprints should be used to reset cached values to avoid blocking garbage collector.
*/
UFUNCTION(BlueprintNativeEvent, Category="Combo Input|Action|Decorators")
void CleanupDecorator();
virtual void CleanupDecorator_Implementation() { this->DecoratorState = EComboActionDecoratorState::Uninitialized; }
/**
* Validates the Decorator.
* Called for each Node it is attached to.
* Works as safety measure to avoid calling broken Decorators with invalid references.
*
* False value stops Dialogue whatsoever.
* Validation is called before Context is initialized!
*/
UFUNCTION(BlueprintNativeEvent, Category="Combo Input|Action|Decorators")
bool ValidateDecorator(TArray<FText> &ValidationMessages);
virtual bool ValidateDecorator_Implementation(TArray<FText> &ValidationMessages);
/**
* Evaluates the Decorator.
* Called for each Node it is attached to.
* Could enhance Node's 'CanStartNode'. Example would be: BP_RequireItem decorator, which would return true if Player has specific Item in inventory. Otherwise it returns false and its Node is not available in Selection of Answers.
*/
UFUNCTION(BlueprintNativeEvent, Category="Combo Input|Action|Decorators")
bool EvaluateDecorator();
virtual bool EvaluateDecorator_Implementation() { return this->OwningWorld != nullptr; }
/**
* Executes the Decorator.
* Useful for triggering special events per Node, for instance, switching dialogue cameras.
*/
UFUNCTION(BlueprintNativeEvent, Category="Combo Input|Action|Decorators")
void ExecuteDecorator();
virtual bool ExecuteDecorator_Implementation() { return true; }
/**
* Stores reference to World.
* World is needed to perform World affecting tasks.
*/
UFUNCTION(BlueprintCallable, Category="Combo Input|Action|Decorators")
void StoreWorldReference(UWorld *World) { this->OwningWorld = World; }
/**
* Returns Owning World this Decorator belongs to.
*
* Should not return Null, but possibly can.
*/
UFUNCTION(BlueprintCallable, Category="Combo Input|Action|Decorators", meta=(CompactNodeTitle="World"))
UWorld *GetOwningWorld() const { return this->OwningWorld; }
/**
* Returns Owning Node of this Decorator.
*
* Might return Null if this Decorator is owned by Graph!
*/
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action|Decorators", meta=(CompactNodeTitle="OwningNode"))
class UComboActionGraphNode *GetOwningNode() const { return this->GetTypedOuter<UComboActionGraphNode>(); }
/**
* Returns Owning Graph of this Decorator.
*
* Might return Null if this Decorator is owned by Node!
*/
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action|Decorators", meta=(CompactNodeTitle="OwningGraph"))
class UComboActionGraph *GetOwningGraph() const { return this->GetTypedOuter<UComboActionGraph>(); }
/**
* Returns Owning Object of this Decorator.
*/
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action|Decorators", meta=(CompactNodeTitle="Owner"))
UObject *GetOwner() const { return this->GetOuter(); }
FText GetDecoratorName() const
{
#if WITH_EDITORONLY_DATA
return this->GetClass()->GetDisplayNameText();
#else
return FText::FromString(GetName());
#endif
}
private:
UPROPERTY() EComboActionDecoratorState DecoratorState = EComboActionDecoratorState::Uninitialized;
UPROPERTY() UWorld *OwningWorld = nullptr;
};
/**
* Dialogue Decorator Structure.
* Holds reference to its Instanced Decorator.
*/
USTRUCT(BlueprintType)
struct FComboActionDecorator
{
GENERATED_BODY()
FComboActionDecorator() : DecoratorType(nullptr) {};
public:
void InitializeDecorator(UWorld *World) const
{
if (this->DecoratorType)
{
this->DecoratorType->InitializeDecorator(World);
}
else
{
UE_LOG(LogComboActionDecoratorBase, Error, TEXT("[InitializeDecorator] DecoratorType is null (invalid)!"));
}
}
bool ValidateDecorator(TArray<FText>& ValidationMessages) const
{
if (this->DecoratorType)
{
return this->DecoratorType->ValidateDecorator(ValidationMessages);
}
UE_LOG(LogComboActionDecoratorBase, Error, TEXT("[EvaluateDecorator] DecoratorType is null (invalid)!"));
return false;
}
void CleanupDecorator() const
{
if (this->DecoratorType)
{
this->DecoratorType->CleanupDecorator();
}
else
{
UE_LOG(LogComboActionDecoratorBase, Error, TEXT("[CleanupDecorator] DecoratorType is null (invalid)!"));
}
}
bool EvaluateDecorator() const
{
if (this->DecoratorType)
{
return this->DecoratorType->EvaluateDecorator();
}
UE_LOG(LogComboActionDecoratorBase, Error, TEXT("[EvaluateDecorator] DecoratorType is null (invalid)!"));
return false;
}
void ExecuteDecorator() const
{
if (this->DecoratorType)
{
this->DecoratorType->ExecuteDecorator();
}
else
{
UE_LOG(LogComboActionDecoratorBase, Error, TEXT("[ExecuteDecorator] DecoratorType is null (invalid)!"));
}
}
public:
/**
* Decorators can help out with enhancing the Dialogue flow.
* Those Decorators are instanced and exist only as "triggers".
* Could be used to start audio, play animation or do some logic behind the curtains, like triggering Cutscene etc.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced, Category = "Combo Input|Action", meta=(NoResetToDefault, AllowAbstract = "false", BlueprintBaseOnly = "true"))
UComboActionDecoratorBase *DecoratorType = nullptr;
bool operator==(const FComboActionDecorator &Other) const { return this->DecoratorType == Other.DecoratorType; }
};
#undef LOCTEXT_NAMESPACE

View File

@ -1,233 +0,0 @@
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Data/ComboActionGraphDataTypes.h"
#include "UObject/Interface.h"
#include "ComboActionGraphManagerInterface.generated.h"
// This class does not need to be modified.
UINTERFACE(MinimalAPI, BlueprintType, Blueprintable)
class UComboActionGraphManagerInterface : public UInterface
{
GENERATED_BODY()
};
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDialogueInitialized, UMounteaDialogueContext*, Context);
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDialogueEvent, UMounteaDialogueContext*, Context);
//
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDialogueContextUpdated, UMounteaDialogueContext*, Context);
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDialogueUserInterfaceChanged, TSubclassOf<UUserWidget>, DialogueWidgetClass, UUserWidget*, DialogueWidget);
//
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDialogueNodeEvent, UMounteaDialogueContext*, Context);
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDialogueRowEvent, UMounteaDialogueContext*, Context);
//
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDialogueFailed, const FString&, ErrorMessage);
//
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDialogueManagerStateChanged, const EDialogueManagerState&, NewState);
//
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDialogueVoiceEvent, class USoundBase*, NewDialogueVoice);
/**
* Mountea Dialogue Manager Interface.
*
* Should attached directly to Player Controller or used for Components that are attached to some Controller.
* Provides options to start and stop dialogue as well as ability to select dialogue options.
*/
class COMBOINPUT_API IComboActionGraphManagerInterface
{
GENERATED_BODY()
public:
/**
* Notifies the Dialogue that a node has been selected.
*
* @param NodeGUID The GUID of the selected node.
*/
//UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category="Combo Input|Action", meta=(Keywords="select, chosen, option"))
// void CallDialogueNodeSelected(const FGuid &NodeGUID);
/**
* Starts the Dialogue if possible.
*/
//virtual void StartDialogue() = 0;
/**
* Closes the Dialogue if is active.
*/
//virtual void CloseDialogue() = 0;
/**
* Tries to Invoke Dialogue UI.
* This function servers a purpose to try showing Dialogue UI to player.
* If this function fails, Message will be populated with error message explaining what went wrong.
*
* @param Message InMessage to be populated with error message explaining why returns false
* @return true if UI can be added to screen, false if cannot
*/
//virtual bool InvokeDialogueUI(FString& Message) = 0;
/**
* Gets the widget class used to display Dialogue UI.
*
* @return The widget class used to display Dialogue UI.
*/
//virtual TSubclassOf<UUserWidget> GetDialogueWidgetClass() const = 0;
/**
* Sets the widget class for the Dialogue UI.
* This is a pure virtual function that must be implemented in derived classes.
*
* @param NewWidgetClass The new widget class to set.
*/
//virtual void SetDialogueWidgetClass(TSubclassOf<UUserWidget> NewWidgetClass) = 0;
/**
* Returns Dialogue UI pointer.
*
* Could be null
* @return UserWidget pointer to created UI
*/
//virtual UUserWidget *GetDialogueUIPtr() const = 0;
/**
* Sets Dialogue UI pointer.
*
* Using null value resets saved value
* @param DialogueUIPtr UserWidget pointer to be saved as Dialogue UI
*/
//virtual void SetDialogueUIPtr(UUserWidget *DialogueUIPtr) = 0;
/**
* Starts Dialogue Row execution.
* Dialogue Data contain Dialogue Data Rows, which are individual dialogue lines, which can be skipped.
* Once all Dialogue Data Rows are finished, Dialogue Data is finished as well.
*/
//virtual void StartExecuteDialogueRow() = 0;
/**
* Function responsible for cleanup once Dialogue Row is finished.
* Dialogue Data contain Dialogue Data Rows, which are individual dialogue lines, which can be skipped.
* Once all Dialogue Data Rows are finished, Dialogue Data is finished as well.
*/
//virtual void FinishedExecuteDialogueRow() = 0;
/**
* Retrieves the current dialogue context associated with this dialogue instance.
*
* @return The dialogue context object for this instance.
*/
//UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Combo Input|Action")
//UMounteaDialogueContext* GetDialogueContextEvent() const;
//UMounteaDialogueContext* GetDialogueContextEvent_Implementation() const
//{
// return GetDialogueContext();
//}
/**
* Returns the widget used to display the current dialogue.
*
* @return The widget used to display the current dialogue.
*/
//UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category="Combo Input|Action", meta=(Keywords="UI, Widget"))
//UUserWidget* GetDialogueWidget();
//UUserWidget* GetDialogueWidget_Implementation()
//{
// return GetDialogueWidget();
//};
/**
* Returns the owning actor for this Dialogue Manager Component.
*
* @return The owning actor for this Dialogue Manager Component.
*/
//UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Combo Input|Action")
//AActor* GetOwningActor() const;
//virtual AActor* GetOwningActor_Implementation() const
//{
// return nullptr;
//};
/**
* Prepares the node for execution.
* Asks Active Node to 'PreProcessNode' and then to 'ProcessNode'.
* In this preparation stage, Nodes are asked to process all Decorators.
*/
//UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Combo Input|Action")
//void PrepareNode();
//virtual void PrepareNode_Implementation() {};
/**
* Retrieves current Dialogue Context.
*
* Could be null
* @return DialogueContext Dialogue Context is transient data holder for current dialogue instance.
*/
//virtual UMounteaDialogueContext* GetDialogueContext() const = 0;
/**
* Sets new Dialogue Context.
*
* Null value clears saved data
* @param NewContext Dialogue Context to be set as Dialogue Context
*/
//virtual void SetDialogueContext(UMounteaDialogueContext* NewContext) = 0;
/**
* Interface call.
* Retrieves current Dialogue Manager State.
* State defines whether Manager can start/close dialogue or not.
*
* @return ManagerState Manager state value
*/
//UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Combo Input|Action")
//EDialogueManagerState GetState() const;
//EDialogueManagerState GetState_Implementation() const
//{ return GetDialogueManagerState(); };
/**
* Retrieves current Dialogue Manager State.
* State defines whether Manager can start/close dialogue or not.
*
* @return ManagerState Manager state value
*/
//virtual EDialogueManagerState GetDialogueManagerState() const = 0;
/**
* Sets new Dialogue Manager State.
*
* @param NewState Manager State to be set as Manager State
*/
//virtual void SetDialogueManagerState(const EDialogueManagerState NewState) = 0;
/**
* Retrieves current Default Dialogue Manager State.
* Default Dialogue Manager State sets Dialogue Manager state upon BeginPlay and is used as fallback once Dialogue ends.
*
* @return ManagerState Default Manager state value
*/
//virtual EDialogueManagerState GetDefaultDialogueManagerState() const = 0;
/**
* Sets new Default Dialogue Manager State.
*
* @param NewState Manager State to be set as Default Manager State
*/
//virtual void SetDefaultDialogueManagerState(const EDialogueManagerState NewState) = 0;
//
//virtual FDialogueInitialized& GetDialogueInitializedEventHandle() = 0;
//virtual FDialogueEvent& GetDialogueStartedEventHandle() = 0;
//virtual FDialogueEvent& GetDialogueClosedEventHandle() = 0;
//
//virtual FDialogueContextUpdated& GetDialogueContextUpdatedEventHande() = 0;
//virtual FDialogueUserInterfaceChanged& GetDialogueUserInterfaceChangedEventHandle() = 0;
//virtual FDialogueNodeEvent& GetDialogueNodeSelectedEventHandle() = 0;
//virtual FDialogueNodeEvent& GetDialogueNodeStartedEventHandle() = 0;
//virtual FDialogueNodeEvent& GetDialogueNodeFinishedEventHandle() = 0;
//virtual FDialogueRowEvent& GetDialogueRowStartedEventHandle() = 0;
//virtual FDialogueRowEvent& GetDialogueRowFinishedEventHandle() = 0;
//virtual FDialogueFailed& GetDialogueFailedEventHandle() = 0;
//virtual FDialogueManagerStateChanged& GetDialogueManagerStateChangedEventHandle() = 0;
//virtual FDialogueVoiceEvent& GetDialogueVoiceStartRequestEventHandle() = 0;
//virtual FDialogueVoiceEvent& GetDialogueVoiceSkipRequestEventHandle() = 0;
//virtual FTimerHandle& GetDialogueRowTimerHandle() = 0;
};

View File

@ -1,199 +0,0 @@
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Data/ComboActionGraphDataTypes.h"
#include "UObject/Interface.h"
#include "ComboActionInterface.generated.h"
UINTERFACE(MinimalAPI, BlueprintType, Blueprintable)
class UComboActionInterface : public UInterface
{
GENERATED_BODY()
};
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDialogueGraphChanged, UMounteaDialogueGraph*, NewGraph);
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDialogueParticipantStateChanged, const EDialogueParticipantState&, NewState);
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDialogueParticipantAudioComponentChanged, const UAudioComponent*, NewAudioComp);
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FParticipantStartingNodeSaved, const UMounteaDialogueGraphNode*, NewSavedNode);
/**
* Combo Action Interface
*/
class COMBOINPUT_API IComboActionInterface
{
GENERATED_BODY()
public:
#pragma region EventFunctions
/*
* A way to determine whether the Dialogue can even start.
* It does come with Native C++ implementation, which can be overriden in child C++ classes.
* If you are using Blueprint implementation, don't forget to call Parent Node, which contains all parent implementations.
*/
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Combo Input|Action")
bool CanStartDialogueEvent() const;
/**
* Returns the owning actor for this Dialogue Participant Component.
*
* @return The owning actor for this Dialogue Participant Component.
*/
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Combo Input|Action")
AActor *GetOwningActor() const;
/**
* Saves the starting node for this Dialogue Participant Component.
*
* @param NewStartingNode The node to set as the starting node
*/
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Combo Input|Action")
void SaveStartingNode(class UComboActionGraphNode *NewStartingNode);
/**
* Saves the traversed path for this Dialogue Participant Component.
* This function is called once Dialogue ends and is updated from Dialogue Context.
*
* @param InPath The traversed path of the dialogue graph to be saved.
*/
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Combo Input|Action")
void SaveTraversedPath(TMap<FGuid,int32> &InPath);
/**
* Interface call.
* Retrieves current Dialogue Participant State.
* State defines whether Participant can start/close dialogue or not.
*
* @return ParticipantState Participant state value
*/
//UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Combo Input|Action")
// EDialogueParticipantState GetState() const;
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Combo Input|Action")
FGameplayTag GetTag() const;
#pragma endregion
protected:
#pragma region EventFunctions_Implementations
bool CanStartDialogueEvent_Implementation() const { return CanStartDialogue(); }
virtual void SaveStartingNode_Implementation(UComboActionGraphNode *NewStartingNode){}
virtual AActor *GetOwningActor_Implementation() const { return nullptr; }
virtual void SaveTraversedPath_Implementation(TMap<FGuid,int32> &InPath){}
//EDialogueParticipantState GetState_Implementation() const { return GetParticipantState(); }
FGameplayTag GetTag_Implementation() const { return GetParticipantTag(); }
#pragma endregion
public:
#pragma region Functions
/**
* Checks if the Participant can be start Dialogue.
* To enhance this, you can implement 'CanStartDialogueEvent' and add custom checks to that function.
*
* @return Whether the dialogue can be started
*/
virtual bool CanStartDialogue() const = 0;
/**
* Gets the saved starting node for this Dialogue Participant.
* Could be null
*
* @return The saved starting node, or nullptr if there is none
*/
virtual UComboActionGraphNode *GetSavedStartingNode() const = 0;
/**
* Tries to play the specified sound as the voice of this dialogue participant.
*
* @param ParticipantVoice The sound to play as the voice of this dialogue participant
*/
virtual void PlayParticipantVoice(USoundBase *ParticipantVoice) = 0;
/**
* Tries to skip the specified sound this participant is playing as voice.
*
* @param ParticipantVoice The sound to skip this participant is playing as voice.
*/
virtual void SkipParticipantVoice(USoundBase *ParticipantVoice) = 0;
/**
* Returns the dialogue graph assigned to this Participant.
* Could be updated using 'SetDialogueGraph', providing ability to swith Dialogue graphs on fly
* Could be null
*
* @return A pointer to the dialogue graph
*/
virtual class UComboActionGraph *GetDialogueGraph() const = 0;
/**
* Sets new Dialogue graph for this Participant.
* Should not be null
*
* @param NewDialogueGraph A pointer to the dialogue graph to be used
*/
virtual void SetDialogueGraph(class UComboActionGraph *NewDialogueGraph) = 0;
/**
* Returns the current state of the Dialogue Participant.
*/
//virtual EDialogueParticipantState GetParticipantState() const = 0;
/**
* Sets the state of the dialogue participant to the given state.
*
* @param NewState The new state to set the dialogue participant to
*/
//virtual void SetParticipantState(const EDialogueParticipantState NewState) = 0;
/**
* Returns the default state of the Dialogue Participant.
*/
//virtual EDialogueParticipantState GetDefaultParticipantState() const = 0;
/**
* Sets the Default state of the dialogue participant to the given state.
*
* @param NewState The new state to set the dialogue participant to
*/
//virtual void SetDefaultParticipantState(const EDialogueParticipantState NewState) = 0;
/**
* Returns the audio component used to play the participant voices.
* Could be null
*/
virtual UAudioComponent *GetAudioComponent() const = 0;
/**
* Sets the audio component used to play dialogue audio.
*
* @param NewAudioComponent The new audio component to use for dialogue audio.
*/
virtual void SetAudioComponent(UAudioComponent *NewAudioComponent) = 0;
/**
* Returns the map of nodes traversed during the dialogue.
*
* @return The map of nodes traversed during the dialogue.
*/
virtual TMap<FGuid,int32> GetTraversedPath() const = 0;
virtual FGameplayTag GetParticipantTag() const = 0;
#pragma endregion
#pragma region EventHandles
//virtual FDialogueGraphChanged &GetDialogueGraphChangedEventHandle() = 0;
//virtual FDialogueParticipantStateChanged &GetDialogueParticipantStateChangedEventHandle() = 0;
//virtual FDialogueParticipantAudioComponentChanged &GetDialogueParticipantAudioComponentChangedEventHandle() = 0;
//virtual FParticipantStartingNodeSaved &GetParticipantStartingNodeSavedEventHandle() = 0;
#pragma endregion
};

View File

@ -4,8 +4,6 @@
#include "CoreMinimal.h"
#include "Decorators/ComboActionDecoratorBase.h"
#include "ComboActionGraphNode.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(LogComboActionGraphNode, Log, All);

View File

@ -39,6 +39,8 @@ public:
virtual bool ValidateNodeRuntime_Implementation() const override;
virtual FLinearColor GetBackgroundColor() const override;
public:
#if WITH_EDITORONLY_DATA
@ -69,7 +71,7 @@ protected:
#if WITH_EDITOR
protected:
virtual bool ValidateNode(TArray<FText> &ValidationMessages, const bool RichFormat) override;
virtual void PostEditChangeProperty(FPropertyChangedEvent &PropertyChangedEvent) override;
virtual FText GetDescription_Implementation() const override;

View File

@ -84,16 +84,6 @@ void UEdComboActionGraphNode::AutowireNewNode(UEdGraphPin* FromPin)
FLinearColor UEdComboActionGraphNode::GetBackgroundColor() const
{
// Getting Node colour based on the Settings if any found, otherwise use this logic
if (UComboActionGraphEditorSettings *GraphEditorSettings = GetMutableDefault<UComboActionGraphEditorSettings>())
{
FLinearColor ReturnColour;
if (GraphEditorSettings->FindNodeBackgroundColourOverride(this->ComboActionGraphNode->GetClass(), ReturnColour))
{
return ReturnColour;
}
}
return this->ComboActionGraphNode ? this->ComboActionGraphNode->GetBackgroundColor() : FLinearColor::Black;
}

View File

@ -117,56 +117,6 @@ bool FComboActionSearchManager::QueryGraphNode(const FComboActionSearchFilter &S
return bContainsSearchString;
}
bool FComboActionSearchManager::QueryNodeDecorators(const FComboActionSearchFilter &SearchFilter, const FComboActionDecorator &InDecorator, const TSharedPtr<FComboActionSearchResult> &OutParentNode, int32 DecoratorIndex, FName DecoratorMemberName) const
{
if (SearchFilter.SearchString.IsEmpty() || !OutParentNode.IsValid())
{
return false;
}
bool bContainsSearchString = false;
if (InDecorator.DecoratorType == nullptr) return false;
// Search by Decorator Name
if (InDecorator.DecoratorType->GetName().Contains(SearchFilter.SearchString))
{
bContainsSearchString = true;
FString DecoratorName = InDecorator.DecoratorType->GetClass()->GetName();
// Format Name
{
if (DecoratorName.Contains(TEXT("_GEN_VARIABLE")))
{
DecoratorName.ReplaceInline(TEXT("_GEN_VARIABLE"), TEXT(""));
}
if(DecoratorName.EndsWith(TEXT("_C")) && DecoratorName.StartsWith(TEXT("Default__")))
{
DecoratorName.RightChopInline(9);
DecoratorName.LeftChopInline(2);
}
if (DecoratorName.EndsWith(TEXT("_C")))
{
DecoratorName.LeftChopInline(2);
}
}
const FText Category = FText::Format
(
LOCTEXT("DecoratorName", "Node Decorator: {0} at Index: {1}"),
FText::FromString(DecoratorName), FText::AsNumber(DecoratorIndex)
);
MakeChildTextNode
(
OutParentNode,
FText::FromString(DecoratorName),
Category,
Category.ToString()
);
}
return bContainsSearchString;
}
bool FComboActionSearchManager::QuerySingleAction(const FComboActionSearchFilter &SearchFilter, const UComboActionGraph *InAction, TSharedPtr<FComboActionSearchResult> &OutParentNode)
{
if (SearchFilter.SearchString.IsEmpty() || !OutParentNode.IsValid() || !IsValid(InAction))

View File

@ -36,15 +36,6 @@ public:
*/
bool QueryGraphNode(const FComboActionSearchFilter &SearchFilter, const UEdComboActionGraphNode *InGraphNode, const TSharedPtr<class FComboActionSearchResult> &OutParentNode) const;
bool QueryNodeDecorators
(
const FComboActionSearchFilter &SearchFilter,
const FComboActionDecorator &InDecorator,
const TSharedPtr<class FComboActionSearchResult> &OutParentNode,
int32 DecoratorIndex,
FName DecoratorMemberName
) const;
/**
* Searches for InSearchString in the InAction. Adds the result as a child of OutParentNode.
* @return True if found anything matching the InSearchString