Ejemplo n.º 1
0
        internal void DrawWorkspace(ref BehaviourTreeEditorPresenter.Model model)
        {
            GUILayout.BeginVertical();
            {
                DrawToolbar(ref model);

                GUILayout.BeginHorizontal();
                {
                    DrawNodeGraph();

                    if (bShowParameters)
                    {
                        EditorGUILayout.BeginVertical(GUILayout.Width(300));
                        {
                            DrawParameters();
                        }
                        EditorGUILayout.EndVertical();
                    }
                }
                GUILayout.EndHorizontal();

                Nodes.HandleEvents(this);

                DrawFooter(ref model);
            }
            EditorGUILayout.EndVertical();

            if (Nodes.WantsRepaint)
            {
                Repaint();
            }
        }
        void OnGUI()
        {
            if (instance == null)
            {
                instance = this;
            }

            editorSize = new Vector2(position.width, position.height);

            if (TreeAsset != null)
            {
                GUILayout.BeginVertical();
                {
                    DrawToolbar();

                    GUILayout.BeginHorizontal();
                    {
                        DrawNodeGraph();

                        if (showParameters)
                        {
                            EditorGUILayout.BeginVertical(GUILayout.Width(300));
                            {
                                DrawParameterList();
                            }
                            EditorGUILayout.EndVertical();
                        }
                    }
                    GUILayout.EndHorizontal();

                    Nodes.HandleEvents(this);

                    DrawFooter();
                }
                EditorGUILayout.EndVertical();
            }
            else
            {
                GUI.Label(new Rect(editorSize.x * 0.5f - 175, editorSize.y * 0.5f - 15, 350, 30), "Select Behaviour Tree in project tab to edit, or create new ");
                if (GUI.Button(new Rect(editorSize.x * 0.5f - 50, editorSize.y * 0.5f + 15, 100, 20), "Create"))
                {
                    CreateNewBehaviourTree();
                }
            }
        }