// 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;
        }
    void OnEnable()
    {
        var graphView = new SampleGraphView()
        {
            style = { flexGrow = 1 }
        };

        rootVisualElement.Add(graphView);

        rootVisualElement.Add(new Button(graphView.Execute)
        {
            text = "Execute"
        });
    }
Exemplo n.º 3
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;
    }
 public void Initialize(SampleGraphView graphView)
 {
     this.graphView = graphView;
 }