1. 新增了脚本节点之间连接时,入参类型伴随来源节点的返回类型改变而改变。

2. 重新优化了Script项目脚本生成代码的缩进排版
3. 修复了Script中对于Double字面量错误的使用了Float解析的bug
This commit is contained in:
fengjiayi
2025-07-31 15:45:02 +08:00
parent 827a9242ae
commit 5f6a58168a
10 changed files with 273 additions and 183 deletions

View File

@@ -69,6 +69,7 @@ namespace Serein.NodeFlow.Model.Nodes
};
this.MethodDetails.ParameterDetailss = [.. pd];
this.MethodDetails.ReturnType = typeof(object);
}
/// <summary>
@@ -103,14 +104,12 @@ namespace Serein.NodeFlow.Model.Nodes
{
if(token.IsCancellationRequested) return FlowResult.Fail(this.Guid, context, "流程已通过token取消");
object? parameter = null;// context.TransmissionData(this); // 表达式节点使用上一节点数据
object? parameter = null;// 表达式节点使用上一节点数据
var pd = MethodDetails.ParameterDetailss[0];
var hasNode = context.Env.TryGetNodeModel(pd.ArgDataSourceNodeGuid, out var argSourceNode);
if (!hasNode)
{
/*context.NextOrientation = ConnectionInvokeType.IsError;
return new FlowResult(this.Guid, context);*/
parameter = null;
}
else
@@ -130,14 +129,6 @@ namespace Serein.NodeFlow.Model.Nodes
parameter = result.Value;
}
}
/*
else
{
// 条件节点透传上一节点的数据
parameter = context.TransmissionData(this.Guid);
}
*/
try
{
var result = await GetValueExpressionAsync(context, parameter, Expression);
@@ -179,17 +170,18 @@ namespace Serein.NodeFlow.Model.Nodes
// 表达式默认包含 “.”
expression = $"return {expression};";
}
var resultType = getValueScript .ParserScript(expression, new Dictionary<string, Type>
var resultType = getValueScript.ParserScript(expression, new Dictionary<string, Type>
{
{ dataName, dataType},
});
}
IScriptInvokeContext scriptContext = new ScriptInvokeContext(flowContext);
scriptContext.SetVarValue(dataName, data);
var result = await getValueScript .InterpreterAsync(scriptContext);
var result = await getValueScript.InterpreterAsync(scriptContext);
return result;
}