daily update on 20240628 by nitload youmu
This commit is contained in:
@@ -262,28 +262,11 @@ namespace StgSharp.Logic
|
||||
|
||||
#endregion
|
||||
|
||||
public static IConvertableToBlueprintNode AsBlueprintNodeMainExecution(this BlueprintNodeMainExecution execution, string name)
|
||||
{
|
||||
if (execution == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(execution));
|
||||
}
|
||||
var attributeArray = execution.Method.GetCustomAttributes(typeof(BpNodeActionAttribute), false);
|
||||
var attri = (BpNodeActionAttribute)attributeArray[0];
|
||||
if ( attributeArray.Length < 0 || attri == null)
|
||||
{
|
||||
throw new InvalidCastException($"Delegate {nameof(execution)} is not marked by {typeof(BpNodeActionAttribute)}");
|
||||
}
|
||||
if (attri.OperationSpan <= 1)
|
||||
{
|
||||
return new DefaultConvertableToBlueprintNode();
|
||||
}
|
||||
return new CrossFrameOperation(
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
}//--------------------------------- end of class -----------------------------------
|
||||
|
||||
|
||||
|
||||
public class BlueprintNodeRunException : Exception
|
||||
{
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace StgSharp.Logic
|
||||
private string[] _output;
|
||||
private int _operationSpan;
|
||||
|
||||
internal string[] InputPort => _input;
|
||||
internal string[] OutputPort => _output;
|
||||
internal int OperationSpan => _operationSpan;
|
||||
public string[] InputPort => _input;
|
||||
public string[] OutputPort => _output;
|
||||
public int OperationSpan => _operationSpan;
|
||||
|
||||
public BpNodeActionAttribute(string[] inputPort, string[] outputPort, int operationSpan)
|
||||
{
|
||||
@@ -30,13 +30,6 @@ namespace StgSharp.Logic
|
||||
this._operationSpan = 1;
|
||||
}
|
||||
|
||||
public BpNodeActionAttribute()
|
||||
{
|
||||
_input = Array.Empty<string>();
|
||||
_output = Array.Empty<string>();
|
||||
_operationSpan = 1;
|
||||
}
|
||||
|
||||
public BpNodeActionAttribute(int operationSpan)
|
||||
{
|
||||
_input = Array.Empty<string>();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace StgSharp.Logic
|
||||
{
|
||||
private string[] _input;
|
||||
private string[] _output;
|
||||
private BlueprintNodeMainExecution _execute;
|
||||
private BlueprintNodeOperation _execution;
|
||||
|
||||
string[] IConvertableToBlueprintNode.InputInterfacesName => _input;
|
||||
|
||||
@@ -33,11 +33,16 @@ namespace StgSharp.Logic
|
||||
|
||||
void IConvertableToBlueprintNode.ExecuteMain(in Dictionary<string, BlueprintPipeline> input, in Dictionary<string, BlueprintPipeline> output)
|
||||
{
|
||||
_execute(in input, in output);
|
||||
_execution(in input, in output);
|
||||
}
|
||||
|
||||
|
||||
public DefaultConvertableToBlueprintNode(BlueprintNodeOperation execution, string[] input, string[] output)
|
||||
{
|
||||
_input = input;
|
||||
_output = output;
|
||||
_execution = execution;
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void BlueprintNodeMainExecution(in Dictionary<string, BlueprintPipeline> input, in Dictionary<string, BlueprintPipeline> output);
|
||||
public delegate void BlueprintNodeOperation(in Dictionary<string, BlueprintPipeline> input, in Dictionary<string, BlueprintPipeline> output);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user