重写了Script的解释器代码,使其更加直观。重写了流程控制的部分代码,分离运行环境IOC与流程IOC。

This commit is contained in:
fengjiayi
2025-07-18 22:45:06 +08:00
parent 88de5a21f5
commit fc05cd662b
38 changed files with 567 additions and 1418 deletions

View File

@@ -15,7 +15,8 @@ namespace Serein.Library
/// <summary>
/// 动态流程上下文
/// </summary>
/// <param name="flowEnvironment"></param>
/// <param name="flowEnvironment">脚本运行时的IOC</param>
/// <param name="ioc">脚本运行时使用的IOC容器</param>
public DynamicContext(IFlowEnvironment flowEnvironment)
{
Env = flowEnvironment;

View File

@@ -372,6 +372,8 @@ namespace Serein.Library
private readonly IFlowEnvironment flowEnvironment;
public static Serein.Library.Utils.ObjectPool<IDynamicContext> FlowContextPool { get; set; }
public ISereinIOC IOC => throw new NotImplementedException();
public LightweightFlowControl(IFlowCallTree flowCallTree, IFlowEnvironment flowEnvironment)
{
this.flowCallTree = flowCallTree;
@@ -478,7 +480,12 @@ namespace Serein.Library
public void UseExternalIOC(ISereinIOC ioc)
{
throw new NotImplementedException();
}
}
public void UseExternalIOC(ISereinIOC ioc, Action<ISereinIOC> setDefultMemberOnReset = null)
{
throw new NotImplementedException();
}
#endregion
}

View File

@@ -3,6 +3,7 @@ using Serein.Library.Api;
using Serein.Library.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
@@ -77,7 +78,8 @@ namespace Serein.Library
partial void OnIsInterruptChanged(bool oldValue, bool newValue)
{
if (newValue && _getInterruptTask is null)
Debug.WriteLine($" {nameof(NodeDebugSetting)}.{nameof(NodeDebugSetting.OnIsInterruptChanged)} 暂未实现,需要重新设计中断逻辑");
/*if (newValue && _getInterruptTask is null)
{
// 设置获取中断的委托
_getInterruptTask = () => NodeModel.Env.IOC.Get<FlowInterruptTool>().WaitTriggerAsync(NodeModel.Guid);
@@ -97,7 +99,7 @@ namespace Serein.Library
_getInterruptTask = null;
}
}
}*/
}

View File

@@ -335,7 +335,7 @@ namespace Serein.Library
#region -
/*#region “枚举-类型”转换器
if (ExplicitType is not null && ExplicitType.IsEnum && DataType != ExplicitType)
{
var resultEnum = Enum.Parse(ExplicitType, DataValue);
@@ -347,7 +347,7 @@ namespace Serein.Library
return value;
}
}
#endregion
#endregion*/
// 需要获取预入参数据
object inputParameter;