From 83350946566de001146ba264e5631e6e411dca44 Mon Sep 17 00:00:00 2001 From: fengjiayi <12821976+ning_xi@user.noreply.gitee.com> Date: Wed, 18 Sep 2024 23:03:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B4=A7=E6=80=A5=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8F=82=E6=95=B0=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NodeFlow/Base/NodeModelBaseFunc.cs | 38 +++++++++++++++++++----------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/NodeFlow/Base/NodeModelBaseFunc.cs b/NodeFlow/Base/NodeModelBaseFunc.cs index 951b3fc..8854ca8 100644 --- a/NodeFlow/Base/NodeModelBaseFunc.cs +++ b/NodeFlow/Base/NodeModelBaseFunc.cs @@ -260,24 +260,34 @@ namespace Serein.NodeFlow.Base for (int i = 0; i < types.Length; i++) { - if (flowData is null) - { - parameters[i] = md.ExplicitDatas[i].DataType switch - { - Type t when t == typeof(IDynamicContext) => context, // 上下文 - Type t when t == typeof(MethodDetails) => md, // 节点方法描述 - Type t when t == typeof(NodeModelBase) => this, // 节点实体类 - _ => null, - }; - continue; // 上一节点数据为空,提前跳过 - } + //if (flowData is null) + //{ + // parameters[i] = md.ExplicitDatas[i].DataType switch + // { + // Type t when t == typeof(IDynamicContext) => context, // 上下文 + // Type t when t == typeof(MethodDetails) => md, // 节点方法描述 + // Type t when t == typeof(NodeModelBase) => this, // 节点实体类 + // _ => null, + // }; + // continue; // 上一节点数据为空,提前跳过 + //} object? inputParameter; // var ed = md.ExplicitDatas[i]; // 方法入参描述 - // 检测是否为表达式 - if (ed.IsExplicitData && ed.DataValue.StartsWith("@get", StringComparison.OrdinalIgnoreCase)) + + if (ed.IsExplicitData) { - inputParameter = SerinExpressionEvaluator.Evaluate(ed.DataValue, flowData, out _); // 执行表达式从上一节点获取对象 + + if (ed.DataValue.StartsWith("@get", StringComparison.OrdinalIgnoreCase)) + { + // 执行表达式从上一节点获取对象 + inputParameter = SerinExpressionEvaluator.Evaluate(ed.DataValue, flowData, out _); + } + else + { + // 使用输入的固定值 + inputParameter = ed.DataValue; + } } else {