Compare commits

..

2 Commits

Author SHA1 Message Date
cb5ac1cd58 调整对话ui点击判断位置 2025-11-27 15:38:20 +08:00
7e5a54d08f 修改对话编辑器,支持ui类的配置 2025-11-27 14:36:10 +08:00
9 changed files with 26 additions and 2 deletions

View File

@ -40,6 +40,7 @@ public class Dialogue : ModuleRules
"Slate",
"SlateCore",
// ... add private dependencies that you statically link with here ...
"UMG"
}
);

View File

@ -2,7 +2,7 @@
#include "DialogueAsset.h"
#include "Runtime/UMG/Public/Blueprint/UserWidget.h"
#include "UObject/ObjectSaveContext.h"
@ -11,6 +11,12 @@ bool UDialogueConditions::IsConditionMet_Implementation()
return true;
}
UDialogueAsset::UDialogueAsset()
{
UClass* WidgetClass = LoadClass<UUserWidget>(this, TEXT("/Game/UI/Dialogue/UMG_DialogueWindow.UMG_DialogueWindow_C"));
DialogueWidget = WidgetClass;
}
void UDialogueAsset::BeginDialogue()
{
CurrentNode = NodeDatas[0];

View File

@ -102,6 +102,7 @@ class DIALOGUE_API UDialogueAsset : public UDataAsset
{
GENERATED_BODY()
public:
UDialogueAsset();
UFUNCTION(BlueprintCallable, Category = Dialogue)
void BeginDialogue();
UFUNCTION(BlueprintPure, Category = Dialogue)
@ -119,7 +120,10 @@ public:
UPROPERTY(BlueprintAssignable, Category=Dialogue)
FOnDialogueComplete OnDialogueComplete;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Dialogue)
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = DialogueAsset)
TSubclassOf<UUserWidget> DialogueWidget;
UPROPERTY(BlueprintReadOnly, Category = Dialogue)
TArray<UDialogueRuntimeNode*> NodeDatas;
private:
UDialogueRuntimeNode* CurrentNode = nullptr;

View File

@ -34,11 +34,23 @@ TSharedRef<SWidget> FDialogueDetailsTabSummoner::CreateTabBody(const FWorkflowTa
DetailsViewArgs.bShowModifiedPropertiesOption = false;
DetailsViewArgs.bShowScrollBar = false;
//node节点详情面板
TSharedPtr<IDetailsView> DetailsView = PropertyEditorModule.CreateDetailView(DetailsViewArgs);
DetailsView->SetObject(nullptr);
Editor->SetDetailsView(DetailsView);
//资源的详情面板
TSharedPtr<IDetailsView> DialogueAssetDetailView = PropertyEditorModule.CreateDetailView(DetailsViewArgs);
DialogueAssetDetailView->SetObject(Editor->GetDialogueBeingEdited());
return SNew(SVerticalBox)
+ SVerticalBox::Slot()
.AutoHeight()
.HAlign(HAlign_Fill)
[
DialogueAssetDetailView.ToSharedRef()
]
+ SVerticalBox::Slot()
.FillHeight(1.0f)
.HAlign(HAlign_Fill)

View File

@ -44,6 +44,7 @@ public:
// 图表选择改变回调,传递属性页需要显示的内容
void OnGraphSelectionChanged(const FGraphPanelSelectionSet& Selection);
TObjectPtr<UDialogueAsset> GetDialogueBeingEdited() {return DialogueBeingEdited;}
protected:
void SaveGraphData();
void LoadGraphData();