public Color FindPortColor(PortData portData) { //Debug.Log(portData.portType); if (portData != null) { switch (portData.portType) { case "UnityNodeGraph.PortTypeFlow": return(new Color32(63, 127, 191, 232)); case "UnityNodeGraph.PortTypeAction": return(new Color32(191, 63, 63, 232)); default: return((portData.color == Color.clear)?Color.gray:portData.color); } } else { return(Color.gray); } }
// Add Output port to current Node public Port AddOutputPort(string name, System.Type clazz, Port.Capacity portCapacity = Port.Capacity.Single, PortData portData = null) { Port _port = InstantiatePort(Orientation.Horizontal, Direction.Output, portCapacity, clazz); _port.portName = name; _port.portColor = FindPortColor(portData); outputContainer.Add(_port); outputPorts.Add(_port); return(_port); }
public Port AddOutputPortFromPortData(PortData _portData) { Port.Capacity capacity = (_portData.portCapacity == 0) ? Port.Capacity.Single : Port.Capacity.Multi; return(AddOutputPort(_portData.name, GetType(_portData.portType), capacity, _portData)); }