// Fill out your copyright notice in the Description page of Project Settings. #include "Widget/DialogueGraphNode.h" void SDialogueGraphNode::Construct(const FArguments& InArgs, UDialogueGraphNode_Base* InNode) { GraphNode = InNode; UpdateGraphNode(); } FText SDialogueGraphNode::GetDialogueText() const { UDialogueGraphNode_Base* DialogueNode = Cast(GraphNode); return DialogueNode->GetDialogueNodeData()->Text; } TSharedRef SDialogueGraphNode::CreateNodeContentArea() { // NODE CONTENT AREA return SNew(SBorder) .BorderImage( FAppStyle::GetBrush("NoBorder") ) .HAlign(HAlign_Fill) .VAlign(VAlign_Fill) .Padding( FMargin(0,3) ) [ SNew(SVerticalBox) +SVerticalBox::Slot() .HAlign(HAlign_Center) .FillHeight(1.0f) [ // LEFT to Top //SAssignNew(LeftNodeBox, SVerticalBox) SNew(SBox) .RenderTransformPivot(FVector2D(0.5f, 0.5f)) // 设置旋转中心点为中心 .RenderTransform(FSlateRenderTransform(FQuat2D(FMath::DegreesToRadians(90.0f)))) // 旋转90度 [ SAssignNew(LeftNodeBox, SVerticalBox) ] ] +SVerticalBox::Slot() .AutoHeight() .HAlign(HAlign_Center) .Padding(10.0f, 5.0f) [ // SNew(SBorder) // .BorderBackgroundColor(FSlateColor(FLinearColor::Gray)) // .Padding(10.0f) // .Content() // [ // SAssignNew(DialogueText, STextBlock) // .MinDesiredWidth(260.0f) // .Text(this, &SDialogueGraphNode::GetDialogueText) // .WrapTextAt(250.0f) // ] SAssignNew(DialogueText, STextBlock) .AutoWrapText(true) .Text(this, &SDialogueGraphNode::GetDialogueText) .WrapTextAt(250.0f) ] +SVerticalBox::Slot() .FillHeight(1.0f) .HAlign(HAlign_Center) [ // RIGHT to Bottom //SAssignNew(RightNodeBox, SVerticalBox) SNew(SBox) .RenderTransformPivot(FVector2D(0.5f, 0.5f)) // 设置旋转中心点为中心 .RenderTransform(FSlateRenderTransform(FQuat2D(FMath::DegreesToRadians(90.0f)))) // 旋转90度 [ SAssignNew(RightNodeBox, SVerticalBox) ] ] ]; }