Files
serein-flow/Library/FlowNode/NodeDebugSetting.cs
fengjiayi 49603bb58f 重新优化了NodeModel类;从硬编码类型改为“注册/获取”的方式,为下一步解耦Workbench与节点UI做准备。
新增了“全局数据节点”;保存项目文件时,不同节点可以使用自定义数据保存自身独特的数据,不再借用“方法参数”。
重新设计了运行时的环境输出;增量式生成器现在可以选择在属性变更的前后时间点插入自定义代码;重写了加载项目、保存项目的方法。
2024-12-12 20:31:50 +08:00

86 lines
2.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using static Serein.Library.Utils.ChannelFlowInterrupt;
namespace Serein.Library
{
/// <summary>
/// 节点调试设置,用于中断节点的运行
/// </summary>
[NodeProperty(ValuePath = NodeValuePath.DebugSetting)]
public partial class NodeDebugSetting
{
/// <summary>
/// 创建属于某个节点的调试设置
/// </summary>
/// <param name="nodeModel"></param>
public NodeDebugSetting(NodeModelBase nodeModel)
{
NodeModel = nodeModel;
}
/// <summary>
/// 对应的节点
/// </summary>
[PropertyInfo(IsProtection = true)]
private NodeModelBase _nodeModel;
/// <summary>
/// 是否使能
/// </summary>
[PropertyInfo(IsNotification = true)]
private bool _isEnable = true;
/// <summary>
/// 中断级别,暂时停止继续执行后继分支。
/// </summary>
//[PropertyInfo]
//private InterruptClass _interruptClass = InterruptClass.None;
/// <summary>
/// 中断级别,暂时停止继续执行后继分支。
/// </summary>
[PropertyInfo(IsNotification = true, CustomCodeAtEnd = "NodeModel?.Env?.SetNodeInterruptAsync(NodeModel?.Guid, value);")] // CustomCode = "NodeModel?.Env?.SetNodeInterruptAsync(NodeModel?.Guid, value);"
private bool _isInterrupt = false;
/// <summary>
/// 取消中断的回调函数
/// </summary>
[PropertyInfo]
private Action _cancelInterruptCallback;
/// <summary>
/// 中断Task用来中断
/// </summary>
[PropertyInfo]
private Func<Task<CancelType>> _getInterruptTask;
}
/// <summary>
/// 中断级别,暂时停止继续执行后继分支。
/// </summary>
//public enum InterruptClass
//{
// /// <summary>
// /// 不中断
// /// </summary>
// None,
// /// <summary>
// /// 分支中断,中断进入当前节点的分支。
// /// </summary>
// Branch,
// /// <summary>
// /// 全局中断,中断全局所有节点的运行。(暂未实现相关)
// /// </summary>
// Global,
//}
}