daily update on 20240628 by nitload youmu

This commit is contained in:
Nitload
2024-06-28 07:07:09 +08:00
parent 8f9f1c4012
commit 924fe6eef7
30 changed files with 272 additions and 699 deletions
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Logic
{
public static class BpNodeConverter
{
public static IConvertableToBlueprintNode AsBlueprintNodeMainExecution(this BlueprintNodeOperation startUp)
{
if (startUp == null)
{
throw new ArgumentNullException(nameof(startUp));
}
var attributeArray = startUp.Method.GetCustomAttributes(typeof(BpNodeActionAttribute), false);
var attri = (BpNodeActionAttribute)attributeArray[0];
if (attributeArray.Length < 0 || attri == null)
{
throw new InvalidCastException($"Delegate {nameof(startUp)} is not marked by {typeof(BpNodeActionAttribute)}");
}
return new DefaultConvertableToBlueprintNode(startUp,attri.InputPort, attri.OutputPort);
}
public static IConvertableToBlueprintNode AsBlueprintNodeMainExecution(this Action startUp)
{
if (startUp == null)
{
throw new ArgumentNullException(nameof(startUp));
}
var attributeArray = startUp.Method.GetCustomAttributes(typeof(BpNodeActionAttribute), false);
var attri = (BpNodeActionAttribute)attributeArray[0];
if (attributeArray.Length < 0 || attri == null)
{
throw new InvalidCastException($"Delegate {nameof(startUp)} is not marked by {typeof(BpNodeActionAttribute)}");
}
return new CrossFrameOperation(startUp,attri.OperationSpan);
}
}
}