Merge branch 'Dialogue-System' into Bounty-System-Rework
This commit is contained in:
commit
bc8a390332
BIN
EndlessVendetta/Content/Dialogue/BP_ChoiceButton.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/BP_ChoiceButton.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/BP_DialogueUI.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Dialogue/BP_DialogueUI.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/D_Mayor_Tutorial.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/D_Mayor_Tutorial.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/TestDialogueCube.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/TestDialogueCube.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/Testing/BP_Mayor.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/Testing/BP_Mayor.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/Testing/Catman_Idle.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/Testing/Catman_Idle.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/Testing/Catman_Idle_PhysicsAsset.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/Testing/Catman_Idle_PhysicsAsset.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/Testing/Catman_Idle_Skeleton.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/Testing/Catman_Idle_Skeleton.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/Testing/Material.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/Testing/Material.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/Testing/Material_001.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/Testing/Material_001.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/Testing/Material_002.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/Testing/Material_002.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/Testing/TestDialogueCube.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/Testing/TestDialogueCube.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/Testing/TestDialogueTree.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/Testing/TestDialogueTree.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/test.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Dialogue/test.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/EnemyAITest/E/WM/7S8OEF1ALOX6NKI759UPUB.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/EnemyAITest/E/WM/7S8OEF1ALOX6NKI759UPUB.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -25,6 +25,21 @@ void UAC_PlayerDialogueInterpreter::BeginPlay()
|
||||
// ...
|
||||
}
|
||||
|
||||
FDialogueCharacter* UAC_PlayerDialogueInterpreter::GetCharacterSpeakingFromEnum(ECharacterSpeaking CharacterSpeakingEnum) const
|
||||
{
|
||||
switch (CharacterSpeakingEnum)
|
||||
{
|
||||
case ECharacterSpeaking::Character1:
|
||||
return &CurrentDialogueTree->Character1;
|
||||
case ECharacterSpeaking::Character2:
|
||||
return &CurrentDialogueTree->Character2;
|
||||
case ECharacterSpeaking::Character3:
|
||||
return &CurrentDialogueTree->Character3;
|
||||
case ECharacterSpeaking::Character4:
|
||||
return &CurrentDialogueTree->Character4;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void UAC_PlayerDialogueInterpreter::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||
@ -38,6 +53,8 @@ void UAC_PlayerDialogueInterpreter::StartDialogue(UDialogueTree* DialogueTree)
|
||||
{
|
||||
CurrentDialogueTree = DialogueTree;
|
||||
CurrentTextNode = Cast<UDialogueTextNode>(DialogueTree->RootNodes[0]->ChildrenNodes[0]);
|
||||
if (!IsValid(CurrentTextNode)) return;
|
||||
CurrentCharacterSpeaking = *GetCharacterSpeakingFromEnum(CurrentTextNode->DialogueCharacterSpeaking);
|
||||
OnStartDialogue.Broadcast(CurrentTextNode);
|
||||
|
||||
if (APlayerController* PlayerController = GetWorld()->GetFirstPlayerController())
|
||||
@ -66,6 +83,7 @@ void UAC_PlayerDialogueInterpreter::NextDialogue()
|
||||
else
|
||||
{
|
||||
CurrentTextNode = Cast<UDialogueTextNode>(CurrentTextNode->ChildrenNodes[0]);
|
||||
CurrentCharacterSpeaking = *GetCharacterSpeakingFromEnum(CurrentTextNode->DialogueCharacterSpeaking);
|
||||
OnNextDialogue.Broadcast(CurrentTextNode);
|
||||
CurrentChoiceNode = nullptr;
|
||||
}
|
||||
@ -83,6 +101,7 @@ void UAC_PlayerDialogueInterpreter::MakeChoiceDialogue(const int Choice)
|
||||
else
|
||||
{
|
||||
CurrentTextNode = Cast<UDialogueTextNode>(CurrentChoiceNode->ChildrenNodes[Choice]);
|
||||
CurrentCharacterSpeaking = *GetCharacterSpeakingFromEnum(CurrentTextNode->DialogueCharacterSpeaking);
|
||||
OnNextDialogue.Broadcast(CurrentTextNode);
|
||||
CurrentChoiceNode = nullptr;
|
||||
}
|
||||
@ -92,6 +111,7 @@ void UAC_PlayerDialogueInterpreter::EndDialogue()
|
||||
{
|
||||
CurrentChoiceNode = nullptr;
|
||||
CurrentTextNode = nullptr;
|
||||
CurrentCharacterSpeaking = FDialogueCharacter();
|
||||
OnEndDialogue.Broadcast();
|
||||
|
||||
if (APlayerController* PlayerController = GetWorld()->GetFirstPlayerController())
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Dialogue")
|
||||
UDialogueTree* CurrentDialogueTree;
|
||||
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Dialogue")
|
||||
FDialogueCharacter CurrentCharacterSpeaking;
|
||||
|
||||
protected:
|
||||
// Called when the game starts
|
||||
@ -47,6 +49,7 @@ private:
|
||||
UDialogueTextNode* CurrentTextNode;
|
||||
UPROPERTY()
|
||||
UDialogueChoiceNode* CurrentChoiceNode;
|
||||
FDialogueCharacter* GetCharacterSpeakingFromEnum(ECharacterSpeaking CharacterSpeakingEnum) const;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "DialogueChoiceNode.h"
|
||||
|
||||
#include "DialogueEdge.h"
|
||||
#include "DialogueTree.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "UDialogueChoiceNode"
|
||||
@ -14,6 +16,33 @@ UDialogueChoiceNode::UDialogueChoiceNode()
|
||||
|
||||
#if WITH_EDITOR
|
||||
|
||||
FText UDialogueChoiceNode::GetNodeTitle() const
|
||||
{
|
||||
bool bHasValidNumberOfChoices = false;
|
||||
if (Choices.Num() == ChildrenNodes.Num()) bHasValidNumberOfChoices = true;
|
||||
for (int i = 0; i < Edges.Num(); i++)
|
||||
{
|
||||
if (!bHasValidNumberOfChoices)
|
||||
{
|
||||
Cast<UDialogueEdge>(Edges[ChildrenNodes[i]])->EdgeColour = FLinearColor::Red;
|
||||
Cast<UDialogueEdge>(Edges[ChildrenNodes[i]])->SetNodeTitle(FText::FromString("INVALID"));
|
||||
}
|
||||
else if (Choices[i].Len() > 15)
|
||||
{
|
||||
FString Substring = Choices[i].Left(15);
|
||||
Substring.Append("...");
|
||||
Cast<UDialogueEdge>(Edges[ChildrenNodes[i]])->SetNodeTitle(FText::FromString(Substring));
|
||||
}
|
||||
else
|
||||
{
|
||||
Cast<UDialogueEdge>(Edges[ChildrenNodes[i]])->SetNodeTitle(FText::FromString(Choices[i]));
|
||||
Cast<UDialogueEdge>(Edges[ChildrenNodes[i]])->EdgeColour = FLinearColor::White;
|
||||
}
|
||||
}
|
||||
const FText ChoiceNodeTitle = NodeTitle.IsEmpty() ? LOCTEXT("Choice Node", "Choice Node") : NodeTitle;
|
||||
return FText::Format(LOCTEXT("Choice Node Title", "{0} [{1}]"), ChoiceNodeTitle, FText::AsNumber(Choices.Num()));
|
||||
}
|
||||
|
||||
FLinearColor UDialogueChoiceNode::GetBackgroundColor() const
|
||||
{
|
||||
const UDialogueTree* DialogueTree = Cast<UDialogueTree>(GetGraph());
|
||||
|
@ -13,13 +13,10 @@ public:
|
||||
UDialogueChoiceNode();
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
|
||||
FString Choice1Text = "None";
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
|
||||
FString Choice2Text = "None";
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
|
||||
FString Choice3Text = "None";
|
||||
TArray<FString> Choices;
|
||||
|
||||
#if WITH_EDITOR
|
||||
virtual FText GetNodeTitle() const override;
|
||||
virtual FLinearColor GetBackgroundColor() const override;
|
||||
#endif
|
||||
};
|
||||
|
@ -10,7 +10,10 @@ class UDialogueEdge: public UGenericGraphEdge
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// public:
|
||||
// UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
|
||||
// FText Selection;
|
||||
UDialogueEdge();
|
||||
};
|
||||
|
||||
inline UDialogueEdge::UDialogueEdge()
|
||||
{
|
||||
bShouldDrawTitle = true;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ FLinearColor UDialogueRootNode::GetBackgroundColor() const
|
||||
if (const UDialogueTree* DialogueTree = Cast<UDialogueTree>(GetGraph()); DialogueTree == nullptr)
|
||||
return Super::GetBackgroundColor();
|
||||
|
||||
return FLinearColor(1.f, 1.f, 1.f, 1.f);
|
||||
return FLinearColor(0.f, 1.f, 0.f, 1.f);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -30,9 +30,7 @@ public:
|
||||
|
||||
#if WITH_EDITOR
|
||||
virtual FText GetNodeTitle() const override;
|
||||
|
||||
virtual void SetNodeTitle(const FText& NewTitle) override;
|
||||
|
||||
virtual FLinearColor GetBackgroundColor() const override;
|
||||
#endif
|
||||
};
|
||||
|
@ -12,9 +12,9 @@ struct FDialogueCharacter
|
||||
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Dialogue")
|
||||
FName CharacterName;
|
||||
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Dialogue")
|
||||
FLinearColor DialogueNodeBgColor;
|
||||
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Dialogue")
|
||||
UTexture2D* DialogueCharacterPortrait;
|
||||
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Node")
|
||||
FLinearColor DialogueNodeBgColor;
|
||||
};
|
||||
|
||||
UCLASS(Blueprintable)
|
||||
|
Loading…
Reference in New Issue
Block a user