流程返回值改为FlowResult,记录节点信息、上下文信息,为以后的流程调用回溯做准备

This commit is contained in:
fengjiayi
2025-03-21 18:26:01 +08:00
parent 9941f24c5d
commit f99aff3c2c
30 changed files with 916 additions and 752 deletions

View File

@@ -36,7 +36,7 @@ namespace Serein.NodeFlow.Model
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override async Task<object?> ExecutingAsync(IDynamicContext context, CancellationToken token)
public override async Task<FlowResult> ExecutingAsync(IDynamicContext context, CancellationToken token)
{
try
{
@@ -45,7 +45,7 @@ namespace Serein.NodeFlow.Model
{
if (token.IsCancellationRequested)
{
return null;
return new FlowResult(this, context);
}
var state = await node.ExecutingAsync(context, token);
if (context.NextOrientation != ConnectionInvokeType.IsSucceed)
@@ -56,7 +56,8 @@ namespace Serein.NodeFlow.Model
}
//var previousNode = context.GetPreviousNode()
return context.TransmissionData(this); // 条件区域透传上一节点的数据
var result = context.TransmissionData(this); // 条件区域透传上一节点的数据
return new FlowResult(this,context, result);
}
catch (Exception ex)
{