コード例 #1
0
        public NodeLink Connect(NodeLinkPort other)
        {
            NodeLink link = GetEmptyLink();

            other.Link.Connect(other.Node, link);
            return(link);
        }
コード例 #2
0
        public void Disconnect(NodeLinkPort other)
        {
            var existing = GetConnections().Find(x => x.to == other.Node || x.from == other.Node);

            if (existing)
            {
                other.Link.Disconnect(other.Node, existing);
            }
        }
コード例 #3
0
        public bool CanConnectTo(NodeLinkPort other)
        {
            List <NodeLink> thisConnections  = GetConnections();
            List <NodeLink> otherConnections = other.GetConnections();

            bool canConnectThis  = Link.IsList || thisConnections.Count < 1;
            bool canConnectOther = other.Link.IsList || otherConnections.Count < 1;

            return(canConnectThis && canConnectOther);
        }
コード例 #4
0
        public bool IsConnectedTo(NodeLinkPort hoveredLink)
        {
            List <NodeLink> thisConnections  = GetConnections();
            List <NodeLink> otherConnections = hoveredLink.GetConnections();

            foreach (var con in thisConnections)
            {
                foreach (var oth in otherConnections)
                {
                    if (con == oth)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #5
0
 public NodeLink GetConnectionTo(NodeLinkPort other)
 {
     return(Item2.GetConnections(Item1).FirstOrDefault(x => IsInput ? (x.from == other.Node && x.fromField == other.Link.FieldName) : (x.to == other.Node && x.toField == other.Link.FieldName)));
 }