コード例 #1
0
 //...
 void OnEnable()
 {
     current      = this;
     willRepaint  = true;
     titleContent = new GUIContent(StyleSheet.canvasIcon);
     RefreshTitle();
 }
コード例 #2
0
        //...
        void OnEnable()
        {
            current     = this;
            willRepaint = true;
            var canvasIcon = (Texture)Resources.Load("CanvasIcon");

            titleContent = new GUIContent(canvasIcon);
            RefreshTitle();
        }
コード例 #3
0
        //an idea but it's taking up space i dont like
        void ShowConsoleLog()
        {
            var rect = Rect.MinMaxRect(canvasRect.xMin, canvasRect.yMax + 5, canvasRect.xMax, screenHeight - TOOLBAR_HEIGHT);
            var msg  = GraphConsole.GetFirstMessageForGraph(currentGraph);

            if (msg.IsValid())
            {
                rect.xMin += 2;
                GUI.Label(rect, GraphConsole.GetFormatedGUIContentForMessage(msg));
                EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
                if (GUI.Button(rect, string.Empty, GUIStyle.none))
                {
                    GraphConsole.ShowWindow();
                }
            }
        }
コード例 #4
0
 //...
 void OnDisable()
 {
     current = null;
 }
コード例 #5
0
        //This is called outside Begin/End Windows from GraphEditor.
        public static void ShowToolbar(Graph graph)
        {
            var owner = graph.agent != null && graph.agent is GraphOwner && (graph.agent as GraphOwner).graph == graph ? (GraphOwner)graph.agent : null;

            GUILayout.BeginHorizontal(EditorStyles.toolbar);
            GUI.backgroundColor = Color.white.WithAlpha(0.5f);

            ///----------------------------------------------------------------------------------------------
            ///Left side
            ///----------------------------------------------------------------------------------------------

            if (GUILayout.Button("File", EditorStyles.toolbarDropDown, GUILayout.Width(50)))
            {
                GetToolbarMenu_File(graph, owner).ShowAsContext();
            }

            if (GUILayout.Button("Edit", EditorStyles.toolbarDropDown, GUILayout.Width(50)))
            {
                GetToolbarMenu_Edit(graph, owner).ShowAsContext();
            }

            if (GUILayout.Button("Prefs", EditorStyles.toolbarDropDown, GUILayout.Width(50)))
            {
                GetToolbarMenu_Prefs(graph, owner).ShowAsContext();
            }

            // var customMenu = GetToolbarMenu_Custom(graph, owner);
            // if ( customMenu.GetItemCount() > 0 ) {
            //     if ( GUILayout.Button("More", EditorStyles.toolbarDropDown, GUILayout.Width(50)) ) {
            //         customMenu.ShowAsContext();
            //     }
            // }

            GUILayout.Space(10);

            if (owner != null && GUILayout.Button("Select Owner", EditorStyles.toolbarButton, GUILayout.Width(80)))
            {
                Selection.activeObject = owner;
                EditorGUIUtility.PingObject(owner);
            }

            if (EditorUtility.IsPersistent(graph) && GUILayout.Button("Select Graph", EditorStyles.toolbarButton, GUILayout.Width(80)))
            {
                Selection.activeObject = graph;
                EditorGUIUtility.PingObject(graph);
            }

            GUILayout.Space(10);

            if (GUILayout.Button(new GUIContent(StyleSheet.log, "Open Graph Console"), EditorStyles.toolbarButton, GUILayout.MaxHeight(12)))
            {
                GraphConsole.ShowWindow();
            }

            if (GUILayout.Button(new GUIContent(StyleSheet.lens, "Open Graph Finder"), EditorStyles.toolbarButton, GUILayout.MaxHeight(12)))
            {
                GraphFinder.ShowWindow();
            }

            GUILayout.Space(10);

            ///----------------------------------------------------------------------------------------------

            graph.CallbackOnGraphEditorToolbar();

            ///----------------------------------------------------------------------------------------------
            ///Mid
            ///----------------------------------------------------------------------------------------------

            GUILayout.Space(10);
            GUILayout.FlexibleSpace();

            //...

            //...

            GUILayout.FlexibleSpace();
            GUILayout.Space(10);

            ///----------------------------------------------------------------------------------------------
            ///Right side
            ///----------------------------------------------------------------------------------------------

            GUI.backgroundColor = Color.clear;
            GUI.color           = new Color(1, 1, 1, 0.3f);
            GUILayout.Label(string.Format("{0} @NodeCanvas Framework v{1}", graph.GetType().Name, NodeCanvas.Framework.Internal.GraphSerializationData.FRAMEWORK_VERSION), EditorStyles.toolbarButton);
            GUILayout.Space(10);
            GUI.color           = Color.white;
            GUI.backgroundColor = Color.white;

            //GRAPHOWNER JUMP SELECTION
            if (owner != null)
            {
                if (GUILayout.Button(string.Format("[{0}]", owner.gameObject.name), EditorStyles.toolbarDropDown, GUILayout.Width(120)))
                {
                    var menu = new GenericMenu();
                    foreach (var _o in Object.FindObjectsOfType <GraphOwner>().OrderBy(x => x.gameObject != owner.gameObject))
                    {
                        var o = _o;
                        menu.AddItem(new GUIContent(o.gameObject.name + "/" + o.GetType().Name), o == owner, () => { SetReferences(o); });
                    }
                    menu.ShowAsContext();
                }
            }

            Prefs.isEditorLocked = GUILayout.Toggle(Prefs.isEditorLocked, "Lock", EditorStyles.toolbarButton);
            GUILayout.EndHorizontal();
            GUI.backgroundColor = Color.white;
            GUI.color           = Color.white;
        }
コード例 #6
0
ファイル: Commands.cs プロジェクト: EdgyPoint/RuneTime
 public static void OpenConsole()
 {
     GraphConsole.ShowWindow();
 }
コード例 #7
0
 //...
 void OnEnable()
 {
     current = this;
 }
コード例 #8
0
        //This is called outside Begin/End Windows from GraphEditor.
        public static void ShowToolbar(Graph graph)
        {
            var owner = graph.agent as GraphOwner;

            GUILayout.BeginHorizontal(EditorStyles.toolbar);

            //----------------------------------------------------------------------------------------------
            //Left side
            //----------------------------------------------------------------------------------------------

            GUILayout.Space(4);

            if (GUILayout.Button("File", EditorStyles.toolbarDropDown, GUILayout.Width(50)))
            {
                GetToolbarMenu_File(graph, owner).ShowAsContext();
            }

            if (GUILayout.Button("Edit", EditorStyles.toolbarDropDown, GUILayout.Width(50)))
            {
                GetToolbarMenu_Edit(graph, owner).ShowAsContext();
            }

            if (GUILayout.Button("Prefs", EditorStyles.toolbarDropDown, GUILayout.Width(50)))
            {
                GetToolbarMenu_Prefs(graph, owner).ShowAsContext();
            }

            GUILayout.Space(10);

            if (owner != null && GUILayout.Button("Select Owner", EditorStyles.toolbarButton))
            {
                Selection.activeObject = owner;
                EditorGUIUtility.PingObject(owner);
            }

            if (EditorUtility.IsPersistent(graph) && GUILayout.Button("Select Graph", EditorStyles.toolbarButton))
            {
                Selection.activeObject = graph;
                EditorGUIUtility.PingObject(graph);
            }

            GUILayout.Space(10);

            EditorGUIUtility.SetIconSize(new Vector2(15, 15));
            if (GUILayout.Button(new GUIContent(StyleSheet.log, "Open Graph Console"), EditorStyles.toolbarButton))
            {
                GraphConsole.ShowWindow();
            }

            if (GUILayout.Button(new GUIContent(StyleSheet.lens, "Open Graph Explorer"), EditorStyles.toolbarButton))
            {
                GraphExplorer.ShowWindow();
            }

            if (GUILayout.Button(new GUIContent(StyleSheet.refactor, "Open Graph Refactor"), EditorStyles.toolbarButton))
            {
                GraphRefactor.ShowWindow();
            }
            EditorGUIUtility.SetIconSize(Vector2.zero);

            GUILayout.Space(10);

            ///----------------------------------------------------------------------------------------------

            graph.CallbackOnGraphEditorToolbar();

            //----------------------------------------------------------------------------------------------
            //Mid
            //----------------------------------------------------------------------------------------------

            GUILayout.Space(10);
            GUILayout.FlexibleSpace();

            //...



            //...

            GUILayout.FlexibleSpace();
            GUILayout.Space(10);

            //----------------------------------------------------------------------------------------------
            //Right side
            //----------------------------------------------------------------------------------------------

            GUI.backgroundColor = Color.clear;
            GUI.color           = new Color(1, 1, 1, 0.3f);
            GUILayout.Label(string.Format("{0} @NodeCanvas Framework v{1}", graph.GetType().Name, NodeCanvas.Framework.Internal.GraphSource.FRAMEWORK_VERSION.ToString("0.00")), EditorStyles.toolbarButton);
            GUILayout.Space(10);
            GUI.color           = Color.white;
            GUI.backgroundColor = Color.white;

            //GRAPHOWNER JUMP SELECTION
            if (owner != null)
            {
                if (GUILayout.Button(string.Format("[{0}]", owner.gameObject.name), EditorStyles.toolbarDropDown, GUILayout.Width(120)))
                {
                    var menu = new GenericMenu();
                    foreach (var _o in Object.FindObjectsOfType <GraphOwner>().OrderBy(x => x.gameObject != owner.gameObject))
                    {
                        var o = _o;
                        menu.AddItem(new GUIContent(o.gameObject.name + "/" + o.GetType().Name), o == owner, () => { SetReferences(o); });
                    }
                    menu.ShowAsContext();
                }
            }

            Prefs.isEditorLocked = GUILayout.Toggle(Prefs.isEditorLocked, "Lock", EditorStyles.toolbarButton);

            GUILayout.Space(4);

            GUILayout.EndHorizontal();
            GUI.backgroundColor = Color.white;
            GUI.color           = Color.white;
        }