2024-09-20 10:50:32 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Text;
|
2024-09-22 17:37:32 +08:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using static Serein.Library.Utils.ChannelFlowInterrupt;
|
2024-09-20 10:50:32 +08:00
|
|
|
|
|
2024-10-20 12:10:57 +08:00
|
|
|
|
namespace Serein.Library
|
2024-09-20 10:50:32 +08:00
|
|
|
|
{
|
2024-10-11 19:31:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点调试设置,用于中断节点的运行
|
|
|
|
|
|
/// </summary>
|
2024-10-22 00:13:13 +08:00
|
|
|
|
[NodeProperty(ValuePath = NodeValuePath.DebugSetting)]
|
2024-10-20 21:59:42 +08:00
|
|
|
|
public partial class NodeDebugSetting
|
2024-09-20 10:50:32 +08:00
|
|
|
|
{
|
2024-10-20 21:59:42 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 创建属于某个节点的调试设置
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="nodeModel"></param>
|
|
|
|
|
|
public NodeDebugSetting(NodeModelBase nodeModel)
|
|
|
|
|
|
{
|
2024-10-23 19:22:27 +08:00
|
|
|
|
NodeModel = nodeModel;
|
2024-10-20 21:59:42 +08:00
|
|
|
|
}
|
2024-10-28 15:21:08 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 对应的节点
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[PropertyInfo(IsProtection = true)]
|
|
|
|
|
|
private NodeModelBase _nodeModel;
|
|
|
|
|
|
|
2024-09-20 10:50:32 +08:00
|
|
|
|
/// <summary>
|
2024-10-20 12:10:57 +08:00
|
|
|
|
/// 是否使能
|
2024-09-20 10:50:32 +08:00
|
|
|
|
/// </summary>
|
2024-10-20 21:59:42 +08:00
|
|
|
|
[PropertyInfo(IsNotification = true)]
|
|
|
|
|
|
private bool _isEnable = true;
|
2024-09-20 10:50:32 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 中断级别,暂时停止继续执行后继分支。
|
|
|
|
|
|
/// </summary>
|
2024-10-27 00:54:10 +08:00
|
|
|
|
//[PropertyInfo]
|
|
|
|
|
|
//private InterruptClass _interruptClass = InterruptClass.None;
|
2024-09-22 14:10:13 +08:00
|
|
|
|
|
2024-10-22 00:13:13 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 中断级别,暂时停止继续执行后继分支。
|
|
|
|
|
|
/// </summary>
|
2024-12-12 20:31:50 +08:00
|
|
|
|
[PropertyInfo(IsNotification = true, CustomCodeAtEnd = "NodeModel?.Env?.SetNodeInterruptAsync(NodeModel?.Guid, value);")] // CustomCode = "NodeModel?.Env?.SetNodeInterruptAsync(NodeModel?.Guid, value);"
|
2024-10-22 00:13:13 +08:00
|
|
|
|
private bool _isInterrupt = false;
|
|
|
|
|
|
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 取消中断的回调函数
|
|
|
|
|
|
/// </summary>
|
2024-10-20 21:59:42 +08:00
|
|
|
|
[PropertyInfo]
|
|
|
|
|
|
private Action _cancelInterruptCallback;
|
2024-09-22 14:10:13 +08:00
|
|
|
|
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// <summary>
|
2024-10-20 21:59:42 +08:00
|
|
|
|
/// 中断Task(用来中断)
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// </summary>
|
2024-10-20 21:59:42 +08:00
|
|
|
|
[PropertyInfo]
|
|
|
|
|
|
private Func<Task<CancelType>> _getInterruptTask;
|
2024-09-20 10:50:32 +08:00
|
|
|
|
|
2024-10-27 00:54:10 +08:00
|
|
|
|
}
|
2024-10-11 19:31:34 +08:00
|
|
|
|
|
2024-10-27 00:54:10 +08:00
|
|
|
|
|
2024-10-11 19:31:34 +08:00
|
|
|
|
|
2024-09-20 10:50:32 +08:00
|
|
|
|
/// <summary>
|
2024-10-27 00:54:10 +08:00
|
|
|
|
/// 中断级别,暂时停止继续执行后继分支。
|
2024-09-20 10:50:32 +08:00
|
|
|
|
/// </summary>
|
2024-10-27 00:54:10 +08:00
|
|
|
|
//public enum InterruptClass
|
|
|
|
|
|
//{
|
|
|
|
|
|
// /// <summary>
|
|
|
|
|
|
// /// 不中断
|
|
|
|
|
|
// /// </summary>
|
|
|
|
|
|
// None,
|
|
|
|
|
|
// /// <summary>
|
|
|
|
|
|
// /// 分支中断,中断进入当前节点的分支。
|
|
|
|
|
|
// /// </summary>
|
|
|
|
|
|
// Branch,
|
|
|
|
|
|
// /// <summary>
|
|
|
|
|
|
// /// 全局中断,中断全局所有节点的运行。(暂未实现相关)
|
|
|
|
|
|
// /// </summary>
|
|
|
|
|
|
// Global,
|
|
|
|
|
|
//}
|
2024-09-20 10:50:32 +08:00
|
|
|
|
}
|
2024-10-20 21:59:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|