コード例 #1
0
 public static void OpenWindow()
 {
     _window = GetWindow <GraphEditorWindow>();
     _window.titleContent = new GUIContent("Graph editor", BuiltInResources.FindIcon("d_PreTextureMipMapLow"));
     _window.minSize      = new Vector2(500, 500);
     _window.Show();
 }
コード例 #2
0
        private void DrawTab(Rect rect, int index, string name, bool showCloseButton)
        {
            GUILayout.BeginArea(new Rect(rect.x + 2, rect.y, rect.width - 2, rect.height - 2));
            var bColor = GUI.backgroundColor;

            if (index == SelectionIndex)
            {
                GUI.backgroundColor = new Color(0.8f, 0.8f, 0.8f);
            }
            else
            {
                GUI.backgroundColor = BuiltInResources.GetDefaultSkinColor(EditorGUIUtility.isProSkin);
            }

            GUILayout.BeginHorizontal("box");
            GUI.backgroundColor = bColor;

            GUILayout.Label(name, GUILayout.Width(TabWidth - 40));
            if (showCloseButton && GUILayout.Button("X", GUILayout.Width(20)))
            {
                RemoveTab(index);
            }
            GUILayout.EndHorizontal();

            GUILayout.EndArea();

            var evt = Event.current;

            if (evt.type != EventType.MouseUp || !rect.Contains(evt.mousePosition))
            {
                return;
            }

            SelectionIndex = index;
        }
コード例 #3
0
        private void DrawTabs()
        {
            var mainRect          = new Rect(0, TopPanelHeightConst, position.width, TopTabsPanelHeightConst);
            var backgroundTexture = new Texture2D(1, 1);

            BuiltInResources.FillUsingDefaultColor(backgroundTexture, EditorGUIUtility.isProSkin);
            GUI.DrawTexture(mainRect, backgroundTexture);

            _graphTabs.DoLayout(mainRect, _openedGraphs.Select(g => g.Name).ToList());
        }