1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-03-26 22:49:02 +08:00

!W(Node) output动态端口永远在最后

This commit is contained in:
Icarus 2019-12-08 21:00:06 +08:00
parent 17eb6cdae1
commit ec7133d862

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace XNode {
@ -168,7 +169,9 @@ namespace XNode {
return ports[fieldName];
}
NodePort port = new NodePort(fieldName, type, direction, connectionType, typeConstraint,baseType, this);
ports.Add(fieldName, port);
return port;
}
@ -394,6 +397,19 @@ namespace XNode {
keys.Clear();
values.Clear();
foreach (KeyValuePair<string, NodePort> pair in this) {
if (pair.Value.direction == NodePort.IO.Input)
{
var firstOutIndex = values.FindIndex(x => x.direction == NodePort.IO.Output);
if (firstOutIndex > -1)
{
keys.Insert(firstOutIndex,pair.Key);
values.Insert(firstOutIndex,pair.Value);
continue;
}
}
keys.Add(pair.Key);
values.Add(pair.Value);
}