Пример #1
0
 private void mouseClick()
 {
     if (Event.current.type == EventType.mouseUp && Event.current.modifiers != EventModifiers.Shift)
     {
         {
             link = null;
             if (connection != null)
             {
                 connection.Break();
                 connection = null;
             }
         }
     }
 }
Пример #2
0
        public CConnection Click(CConnection c)
        {
            // First, what if completely blank: Create new link

            if (c == null && pointer == null)
            {
                c = this;
                CLink l = new CLink();
                l.from = c;
                l.to   = null;
                //Debug.Log ("Created new link from empty");
                CNodeManager.link = l;
                //PropagateChange();
                return(c);
            }
            // Attatch existing string to connection
            if (c != null && pointer == null)
            {
                // is this valid?
                if (!verifyConnection(c))
                {
                    return(c);
                }

                Link(c);
//								PropagateChange();

                //Debug.Log ("Attatched link to empty");
                CNodeManager.link = null;

                return(null);
            }

            // if clicked on existing link
            if (c == null && pointer != null)
            {
                c = pointer;
                CLink l = new CLink();
                l.from = c;
                l.to   = null;
                //Debug.Log ("Created new link from existing");
                CNodeManager.link = l;
                //PropagateChange();

                Break();
                return(c);
            }

            // SWAP!
            if (c != null && pointer != null)
            {
                if (!verifyConnection(c))
                {
                    return(c);
                }
                // Basically: Swap connections
                CConnection old = pointer;
                old.Break();
                //Break();
                Link(c);
                CLink l = new CLink();
                l.from            = old;
                l.to              = null;
                CNodeManager.link = l;
//								PropagateChange();


                return(old);
            }

            CNodeManager.link = null;
            return(null);
        }