// Use this for initialization
        void OnEnable()
        {
            var sampleGraphView = new SampleGraphView();

            m_GraphView = sampleGraphView;

            m_GraphView.name           = "theView";
            m_GraphView.persistenceKey = "theView";
            m_GraphView.StretchToParentSize();

            m_NoSelectLabel = new Label("Select a Dialogue Asset in order to view");
            m_NoSelectLabel.style.textAlignment = TextAnchor.MiddleCenter;
            m_NoSelectLabel.StretchToParentSize();
            m_NoSelectLabel.visible = false;

            this.GetRootVisualContainer().Add(m_GraphView);
            this.GetRootVisualContainer().Add(m_NoSelectLabel);
            OnSelectionChanged();

            if (!LoadGraphData())
            {
                DialogueNode node = CreateStartNode();
                node.addOutput();
                m_GraphView.AddElement(node);
            }
            m_GraphView.graphViewChanged    += OnGraphViewChanged;
            m_GraphView.nodeCreationRequest += OnRequestNodeCreation;
            Selection.selectionChanged      += OnSelectionChanged;
        }
예제 #2
0
    // Use this for initialization
    void OnEnable()
    {
        var sampleGraphView = new SampleGraphView();

        m_GraphView = sampleGraphView;

        m_GraphView.name           = "theView";
        m_GraphView.persistenceKey = "theView";
        m_GraphView.StretchToParentSize();

        this.GetRootVisualContainer().Add(m_GraphView);

        if (!LoadGraphData(k_TestGraphDataPath))
        {
            Node node = CreateRootNode();
            m_GraphView.AddElement(node);
        }

        m_GraphView.graphViewChanged    += OnGraphViewChanged;
        m_GraphView.nodeCreationRequest += OnRequestNodeCreation;
    }