Exemple #1
0
 public abstract void Deconnect(out BasePin connectedPin);
        private void OnGUI()
        {
            m_event         = Event.current;
            m_mousePosition = m_event.mousePosition;


            //Move view
            if (m_event.button == 0 && m_event.type == EventType.MouseDrag)
            {
                if (GetClickedNode() == null)
                {
                    m_offSetView += m_event.delta;
                }
            }

            //Opening a creating node menu
            if (m_event.button == 1 && m_event.type == EventType.MouseUp)
            {
                m_clickedNode = GetClickedNode();
                if (m_clickedNode == null)
                {
                    m_createNodesMenu.ShowAsContext();
                }
                else
                {
                    m_nodeMenu.ShowAsContext();
                }
            }

            //Connect a output/input
            if (m_clickedOutput != null && m_clickedInput != null)
            {
                if (m_clickedOutput.IsCompatiblePin(m_clickedInput.GetPinType()))
                {
                    m_clickedOutput.Connect(m_clickedInput);

                    m_clickedOutput = null;
                    m_clickedInput  = null;
                }
            }

            //Remove de current m_clickedOutput
            if (m_event.button == 0 && m_event.type == EventType.MouseDown)
            {
                if (GetClickedNode() == null && m_clickedOutput != null)
                {
                    m_clickedOutput = null;
                }
            }

            //Deconnect a input/output
            if (m_clickedInput != null)
            {
                m_clickedInput.Deconnect(out m_clickedOutput);
                m_clickedInput = null;
            }

            //Display the current curve
            if (m_clickedOutput != null)
            {
                ((OutputPin)m_clickedOutput).DrawCurve(m_offSetView, m_mousePosition);
            }

            DrawNodes();

            DrawMainMenu();

            Repaint();
        }
Exemple #3
0
 public abstract void Connect(BasePin otherPin);