From 41cf0064f69f91dc44b12d6b359de87599b17027 Mon Sep 17 00:00:00 2001 From: fengjiayi <12821976+ning_xi@user.noreply.gitee.com> Date: Sat, 15 Mar 2025 16:03:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=96=B9=E6=B3=95=E5=85=A5?= =?UTF-8?q?=E5=8F=82=E5=A6=82=E6=9E=9C=E6=9C=89Description=E7=89=B9?= =?UTF-8?q?=E6=80=A7=EF=BC=8C=E5=88=99=E8=83=BD=E5=A4=9F=E5=9C=A8=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E6=82=AC=E6=B5=AE=E7=AA=97=E5=8F=A3=E4=B8=AD=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/FlowNode/ParameterDetails.cs | 10 ++++++++-- NodeFlow/Model/SingleConditionNode.cs | 1 + NodeFlow/Model/SingleExpOpNode.cs | 2 ++ NodeFlow/Model/SingleScriptNode.cs | 2 ++ NodeFlow/Tool/NodeMethodDetailsHelper.cs | 4 ++++ Workbench/Node/View/ActionNodeControl.xaml | 1 - 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Library/FlowNode/ParameterDetails.cs b/Library/FlowNode/ParameterDetails.cs index 95b7044..85eb887 100644 --- a/Library/FlowNode/ParameterDetails.cs +++ b/Library/FlowNode/ParameterDetails.cs @@ -86,6 +86,12 @@ namespace Serein.Library [PropertyInfo(IsNotification = true)] private string _name ; + /// + /// 入参注释 + /// + [PropertyInfo] + private string _description; + /// /// 自定义的方法入参数据 /// @@ -179,7 +185,7 @@ namespace Serein.Library DataValue = string.IsNullOrEmpty(DataValue) ? string.Empty : DataValue, Items = this.Items?.Select(it => it).ToArray(), IsParams = this.IsParams, - + Description = this.Description, }; return pd; } @@ -326,7 +332,7 @@ namespace Serein.Library public override string ToString() { - return $"[{this.Index}] {this.Name} : {this.DataType?.FullName}"; + return $"[{this.Index}] {(string.IsNullOrWhiteSpace(this.Description) ? string.Empty : $"({this.Description})")}{this.Name} : {this.DataType?.FullName}"; } } diff --git a/NodeFlow/Model/SingleConditionNode.cs b/NodeFlow/Model/SingleConditionNode.cs index ae41a6f..48ee5ab 100644 --- a/NodeFlow/Model/SingleConditionNode.cs +++ b/NodeFlow/Model/SingleConditionNode.cs @@ -73,6 +73,7 @@ namespace Serein.NodeFlow.Model //Convertor = null, InputType = ParameterValueInputType.Input, Items = null, + Description = "条件节点入参控制点" }; this.MethodDetails.ParameterDetailss = [..pd]; } diff --git a/NodeFlow/Model/SingleExpOpNode.cs b/NodeFlow/Model/SingleExpOpNode.cs index 302cd79..c7844e4 100644 --- a/NodeFlow/Model/SingleExpOpNode.cs +++ b/NodeFlow/Model/SingleExpOpNode.cs @@ -62,6 +62,8 @@ namespace Serein.NodeFlow.Model //Convertor = null, InputType = ParameterValueInputType.Input, Items = null, + Description = "表达式节点入参控制点" + }; this.MethodDetails.ParameterDetailss = [.. pd]; } diff --git a/NodeFlow/Model/SingleScriptNode.cs b/NodeFlow/Model/SingleScriptNode.cs index 4af4159..239a6d6 100644 --- a/NodeFlow/Model/SingleScriptNode.cs +++ b/NodeFlow/Model/SingleScriptNode.cs @@ -92,6 +92,8 @@ namespace Serein.NodeFlow.Model InputType = ParameterValueInputType.Input, Items = null, IsParams = true, + Description = "脚本节点入参" + }; } diff --git a/NodeFlow/Tool/NodeMethodDetailsHelper.cs b/NodeFlow/Tool/NodeMethodDetailsHelper.cs index 646d3ac..bd16930 100644 --- a/NodeFlow/Tool/NodeMethodDetailsHelper.cs +++ b/NodeFlow/Tool/NodeMethodDetailsHelper.cs @@ -7,6 +7,7 @@ using Serein.Library.FlowNode; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.ComponentModel.DataAnnotations; +using System.ComponentModel; namespace Serein.NodeFlow.Tool; @@ -309,6 +310,7 @@ public static class NodeMethodDetailsHelper { dataType = parameterInfo.ParameterType; } + var description = parameterInfo.GetCustomAttribute()?.Description ?? ""; var inputType = GetInputType(explicitParemType); var items = GetExplicitItems(explicitParemType, inputType); @@ -325,6 +327,8 @@ public static class NodeMethodDetailsHelper DataValue = parameterInfo.HasDefaultValue ? parameterInfo?.DefaultValue?.ToString() : "", // 如果存在默认值,则使用默认值 Items = items.ToArray(), // 如果是枚举值入参,则获取枚举类型的字面量 IsParams = hasParams, // 判断是否为可变参数 + Description = description // 入参描述 + }; } diff --git a/Workbench/Node/View/ActionNodeControl.xaml b/Workbench/Node/View/ActionNodeControl.xaml index fb71a3f..9b4d134 100644 --- a/Workbench/Node/View/ActionNodeControl.xaml +++ b/Workbench/Node/View/ActionNodeControl.xaml @@ -107,7 +107,6 @@ -