コード例 #1
0
        /// <inheritdoc />
        public NodeSocketView GetSocketByName(string realName, NodeSocketType nodeSocketType)
        {
            if (nodeSocketType == NodeSocketType.SignalIn)
            {
                foreach (NodeSocketView nodeSocket in inSockets)
                {
                    if (nodeSocket.NodeSocket.NodeSocketData.RealName == realName)
                    {
                        return(nodeSocket);
                    }
                }
            }
            else if (nodeSocketType == NodeSocketType.SignalOut)
            {
                foreach (NodeSocketView nodeSocket in outSockets)
                {
                    if (nodeSocket.NodeSocket.NodeSocketData.RealName == realName)
                    {
                        return(nodeSocket);
                    }
                }
            }
            else
            {
                foreach (NodeSocketView nodeSocket in variableSockets)
                {
                    if (nodeSocket.NodeSocket.NodeSocketData.RealName == realName)
                    {
                        return(nodeSocket);
                    }
                }
            }

            return(null);
        }
コード例 #2
0
 public NodeSocket(Rect socketRect, NodeSocketType type, BaseNodeView node)
 {
     _socketRect = socketRect;
     SocketType  = type;
     Node        = node;
     IsHooked    = false;
 }
コード例 #3
0
        /// <summary>
        /// Deserialize object.
        /// </summary>
        /// <param name="info">The <see cref="System.Runtime.Serialization.SerializationInfo"/> to retrieve data.</param>
        /// <param name="ctxt">The source (see <see cref="System.Runtime.Serialization.StreamingContext"/>) for this deserialization.</param>
        protected NodeSocket(SerializationInfo info, StreamingContext ctxt)
        {
            _node = (Node)info.GetValue("Node", typeof(Node));

            string         nodeSocketDataRealName = info.GetString("NodeSocketDataRealName");
            NodeSocketType nodeSocketDataType     = (NodeSocketType)info.GetValue("NodeSocketDataType", typeof(NodeSocketType));

            foreach (NodeSocketData nodeSocketData in Node.NodeData.Sockets)
            {
                if (nodeSocketData.RealName == nodeSocketDataRealName && nodeSocketData.Type == nodeSocketDataType)
                {
                    _nodeSocketData = nodeSocketData;
                    break;
                }
            }

            Debug.Assert(_nodeSocketData != null, "Cannot find correct node socket data.");
        }