bool CanCreateLink(AG_NodeLinkPoint beginningPoint, AG_NodeLinkPoint endingPoint)
        {
            int beginningPointLinkNumber = beginningPoint.maxLinks;
            int endingPointLinkNumber    = endingPoint.maxLinks;

            bool isMaxNumberInBegin = false;

            if (beginningPoint.links != null)
            {
                isMaxNumberInBegin = beginningPoint.links.Count >= beginningPointLinkNumber;
            }

            bool isMaxNumberInEnd = false;

            if (endingPoint.links != null)
            {
                isMaxNumberInEnd = endingPoint.links.Count >= endingPointLinkNumber;
            }

            if (isMaxNumberInBegin || isMaxNumberInEnd || IsThereTheSameLink(beginningPoint, endingPoint))
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        private void ProcessMouseDownOverPoint(Event e)
        {
            bool isLeftClickDown = e.type == EventType.MouseDown && e.button == 0;

            if (isLeftClickDown && currentGraph != null && currentGraph.nodes != null)
            {
                foreach (AG_Node node in currentGraph.nodes)
                {
                    if (node.outputPoints != null)
                    {
                        foreach (AG_NodeLinkPoint point in node.outputPoints)
                        {
                            if (point.clickableRect.Contains(e.mousePosition))
                            {
                                draggingLinkNode   = true;
                                clickedInputNode   = node;
                                clickedOutputPoint = point;

                                e.Use();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
 public AG_NodeLink(AG_Node _inputNode, AG_NodeLinkPoint _beginningPoint, AG_Node _outputNode, AG_NodeLinkPoint _endingPoint)
 {
     inputNode      = _inputNode;
     beginningPoint = _beginningPoint;
     outputNode     = _outputNode;
     endingPoint    = _endingPoint;
 }
Exemplo n.º 4
0
 public AG_NodeLink(AG_Node _inputNode, AG_NodeLinkPoint _beginningPoint, AG_Node _outputNode, AG_NodeLinkPoint _endingPoint, int _duration)
 {
     inputNode      = _inputNode;
     beginningPoint = _beginningPoint;
     outputNode     = _outputNode;
     endingPoint    = _endingPoint;
     duration       = _duration;
 }
Exemplo n.º 5
0
        public void AddOutputPoint(string pointName, bool showName, int maxLinks)
        {
            if (outputPoints == null)
            {
                outputPoints = new List <AG_NodeLinkPoint>();
            }

            AG_NodeLinkPoint pointToAdd = new AG_NodeLinkPoint(pointName, showName, PointType.Output, maxLinks);

            outputPoints.Add(pointToAdd);
        }
 bool IsThereTheSameLink(AG_NodeLinkPoint beginningPoint, AG_NodeLinkPoint endingPoint)
 {
     if (currentGraph != null)
     {
         foreach (AG_NodeLink link in currentGraph.links)
         {
             if (link.beginningPoint == beginningPoint && link.endingPoint == endingPoint)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        private void ProcessGenericMouseUp(Event e)
        {
            bool isLeftClickUp = e.type == EventType.MouseUp && e.button == 0;

            if (isLeftClickUp)
            {
                DeselectAllNodes();

                draggingLinkNode   = false;
                clickedInputNode   = null;
                clickedOutputPoint = null;

                selectedNode = null;

                e.Use();
            }
        }