Ejemplo n.º 1
0
 private void DeleteConnections()
 {
     if (m_connectedTo != null)
     {
         m_connectedTo.m_isOccupied  = false;
         m_connectedTo.m_connectedTo = null;
         m_isOccupied  = false;
         m_connectedTo = null;
     }
 }
Ejemplo n.º 2
0
        public virtual void UpdateGUI(BaseNode _node, NodeEditorWindow _curWindow)
        {
            if (GUI.Button(m_IORect, new GUIContent("")))
            {
                NodeGraph graph = _curWindow.GetCurrentGraph();
                Event     e     = Event.current;
                if (e.button == 1)
                {
                    graph.SetIsMakingConnection(false);
                    graph.m_connectionFrom = null;
                    ProcessContextMenu(e, graph);
                    return;
                }

                if (graph.GetIsMakingConnection() && graph.GetConnectionType() != m_type)
                {
                    if (m_connectedTo != null)
                    {
                        m_connectedTo.m_isOccupied  = false;
                        m_connectedTo.m_connectedTo = null;
                    }

                    Debug.Log("Connection made");
                    m_isOccupied  = true;
                    m_connectedTo = graph.m_connectionFrom;
                    m_connectedTo.m_isOccupied = true;

                    m_connectedTo.m_isOccupied  = true;
                    m_connectedTo.m_connectedTo = this;

                    graph.SetIsMakingConnection(false);
                    graph.m_connectionFrom = null;
                }
                else if (!_curWindow.GetCurrentGraph().GetIsMakingConnection())
                {
                    _curWindow.GetCurrentGraph().SetIsMakingConnection(true);
                    _curWindow.GetCurrentGraph().SetConnectionType(m_type);
                    _curWindow.GetCurrentGraph().SetConnectionStart(m_IORect.center);
                    _curWindow.GetCurrentGraph().m_connectionFrom = this;
                }

                AssetDatabase.AddObjectToAsset(this, m_holderNode);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
        }