public NEConnection CreateConnect(NENode beginNode, NENode endNode) { if (beginNode.outPoint != null && endNode.inPoint != null) { NEConnection connection = new NEConnection(endNode.inPoint, beginNode.outPoint); m_lstConnection.Add(connection); return(connection); } return(null); }
private NENode CreateNENode(NEData neData) { if (neData.data == null) { Debug.LogError("neData.data == null"); return(null); } object neNode = CreateNENodeByData(neData.data); NENode parentNode = m_cCanvas.CreateNode(neData.editorPos, neNode); if (neData.lstChild != null) { for (int i = 0; i < neData.lstChild.Count; i++) { NENode childNode = CreateNENode(neData.lstChild[i]); NEConnection connection = m_cCanvas.CreateConnect(parentNode, childNode); } } return(parentNode); }
private NEData GetNodeNEData(NENode node, List <NEConnection> lst, List <NENode> handNodes) { if (handNodes.Contains(node)) { Debug.LogError("树的连线进入死循环,节点=" + node.node.GetType()); return(null); } handNodes.Add(node); INENode neNode = node.node as INENode; NEData neData = new NEData(); neData.data = neNode.data; neData.editorPos = node.rect.center; List <NENode> lstSubNode = new List <NENode>(); for (int i = 0; i < lst.Count; i++) { NEConnection connection = lst[i]; if (connection.outPoint.node == node) { NENode childNode = connection.inPoint.node; lstSubNode.Add(childNode); } } lstSubNode.Sort(NodeSort); for (int i = 0; i < lstSubNode.Count; i++) { NENode childNode = lstSubNode[i]; NEData childNEData = GetNodeNEData(childNode, lst, handNodes); if (neData.lstChild == null) { neData.lstChild = new List <NEData>(); } neData.lstChild.Add(childNEData); } return(neData); }
private void CreateConnection(NENodePoint inPoint, NENodePoint outPoint) { NEConnection connection = new NEConnection(inPoint, outPoint); m_lstConnection.Add(connection); }
private void OnClickConnectRemove(NEConnection connect) { m_lstConnection.Remove(connect); GUI.changed = true; }