daily update on 20240613 by nitload youmu[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[C[4
This commit is contained in:
@@ -111,72 +111,4 @@ namespace StgSharp.Logic
|
||||
|
||||
}
|
||||
|
||||
|
||||
public sealed class RouteHub : BlueprintNode
|
||||
{
|
||||
|
||||
private Dictionary<string, (BlueprintPipeline pipeline, Func<bool> controllingFunc)> inputDictionary;
|
||||
|
||||
public RouteHub(string name, string[] inputPorts, string[] outputPorts) : base(name, inputPorts, outputPorts)
|
||||
{
|
||||
inputDictionary = new Dictionary<string, (BlueprintPipeline pipeline, Func<bool> controllingFunc)>();
|
||||
}
|
||||
|
||||
|
||||
public new int Level
|
||||
{
|
||||
get
|
||||
{
|
||||
if (levelAvailable)
|
||||
{
|
||||
return _level;
|
||||
}
|
||||
_level = 0;
|
||||
foreach (KeyValuePair<string, BlueprintPipeline> item in _inputInterfaces)
|
||||
{
|
||||
if (item.Value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (_level <= item.Value.Level)
|
||||
{
|
||||
_level = item.Value.Level;
|
||||
}
|
||||
}
|
||||
return _level;
|
||||
}
|
||||
}
|
||||
|
||||
public void PrependNode(BlueprintNode node, string portName, Func<bool> usingRule)
|
||||
{
|
||||
if (node == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(node));
|
||||
}
|
||||
string indexName = $"{node.Name}.{portName}";
|
||||
BlueprintPipeline p = new BlueprintPipeline(this, node);
|
||||
node.InputInterfaces[portName] = p;
|
||||
inputDictionary.Add(indexName, (p, usingRule));
|
||||
}
|
||||
|
||||
public new void Run()
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (KeyValuePair<string, (BlueprintPipeline pipeline, Func<bool> controllingFunc)> item in inputDictionary)
|
||||
{
|
||||
item.Value.pipeline.WaitForStart();
|
||||
if (item.Value.controllingFunc())
|
||||
{
|
||||
_outputInterfaces.First().Value.CompleteAndWriteData(item.Value.pipeline.Args);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user