public static void Draw(Rect rect, Transform transform) { IHierarchyProNote note = HierarchyProNotesLibrary.Find(transform); bool clicked = HierarchyProEditorNotes.Draw(rect, note); if (clicked) { if (note == null) { note = HierarchyProNotesLibrary.Create(transform); note.Icon = HierarchyProEditorIcons.Note; } HierarchyProEditorNoteWindow content = new HierarchyProEditorNoteWindow(note); PopupWindow.Show(rect, content); } }
public void Draw(Rect rect) { int labelWidth = 140; int widthRequiredForLayers = 250; bool selected = Selection.gameObjects.Contains(this.gameObject); this.Update(); //Color backgroundColor = EditorGUIUtility.isProSkin //? new Color32(56, 56, 56, 255) //: new Color32(194, 194, 194, 255); //EditorGUI.DrawRect(rect, backgroundColor); //EditorGUI.DrawRect(new Rect(rect) {x = 0, width = 16}, backgroundColor); //Rect label = new Rect(rect) {x = rect.x - 2, y = rect.y}; //GUI.Label(label, this.gameObject.name); bool collapseLayers = (HierarchyProEditorWindow.Width < widthRequiredForLayers) || !HierarchyProPreferences.ShowLayersTags; Rect rectGizmo = new Rect(rect) { x = 0, width = 16 }; Rect rectActive = new Rect(rect) { xMin = rect.xMax - 16, width = 16 }; Rect rectLocked = new Rect(rectActive) { x = rectActive.x - 16, width = 16 }; Rect rectNotes = new Rect(rectLocked) { x = rectLocked.x - 12, width = 16 }; Rect rectPrefab = new Rect(rectNotes) { x = rectNotes.x - 16, width = 16 }; Rect rectStatic = new Rect(rectPrefab) { x = rectPrefab.x - 23, width = 21 }; Rect rectLayers = new Rect(rectStatic) { x = rectStatic.x - 64, width = 64 }; Rect rectDivider = new Rect(rectLayers) { x = (collapseLayers ? rectStatic : rectLayers).x - 4, width = 1, y = rect.y + 2 }; Rect rectControls = new Rect(rect) { xMin = rectDivider.xMin, xMax = rectActive.xMax }; EditorGUI.DrawRect(rectControls, HierarchyProEditorColors.Background); if (HierarchyProPreferences.ShowGizmos) { this.DrawGizmo(rectGizmo); } this.DrawActive(rectActive); this.DrawLocked(rectLocked); HierarchyProEditorNotes.Draw(rectNotes, this.GameObject); this.prefabs.Draw(rectPrefab); this.staticFlags.Draw(rectStatic); if (!collapseLayers) { this.layersTags.Draw(rectLayers); } EditorGUI.DrawRect(rectDivider, EditorGUIUtility.isProSkin ? new Color(0.1f, 0.1f, 0.1f) : new Color(0.6f, 0.6f, 0.6f)); if (HierarchyProPreferences.ShowComponents) { int componentCount = this.components.Count; componentCount = Mathf.Clamp(componentCount, 0, 16); float size = componentCount * 16; Rect rectComponent = new Rect(rectDivider) { x = rectDivider.x - (size + 2), width = size }; Rect rectBlanker = new Rect(rectComponent) { x = rectComponent.x - 2, y = rectComponent.y - 2, width = rectComponent.width + 4, height = rectComponent.height }; rectComponent.y -= 2; EditorGUI.DrawRect(rectBlanker, HierarchyProEditorColors.Background); this.components.MaximumComponents = componentCount; this.components.Draw(rectComponent); } }
public static void Draw(Rect rect, GameObject gameObject) { HierarchyProEditorNotes.Draw(rect, gameObject.transform); }
public void Draw(bool hasScrollbar, bool dragOver) { Rect lineRect = this.Rect; if (hasScrollbar) { lineRect.width -= 18; } if (HierarchyProEditorGroupWindow.Renaming == this.Group) { HierarchyProEditorGroupWindow.RenamingName = GUI.TextField(new Rect(lineRect) { x = lineRect.x + 16, width = lineRect.width - 16 }, HierarchyProEditorGroupWindow.RenamingName); if ((Event.current.keyCode == KeyCode.Return) || (Event.current.keyCode == KeyCode.KeypadEnter)) { this.Group.Name = HierarchyProEditorGroupWindow.RenamingName; HierarchyProEditorGroupWindow.Renaming = null; HierarchyProEditorGroupWindow.Redraw(); } if (Event.current.keyCode == KeyCode.Escape) { HierarchyProEditorGroupWindow.Renaming = null; HierarchyProEditorGroupWindow.Redraw(); } return; } if (lineRect.Contains(Event.current.mousePosition)) { if (Event.current.keyCode == KeyCode.Delete) { HierarchyProGroupLibrary.Delete(this.Group); Event.current.Use(); } } if (HierarchyProEditorGroupWindow.Selected == this.Group) { EditorGUI.DrawRect(lineRect, GUI.skin.settings.selectionColor); } Rect labelRect = new Rect(lineRect) { x = 16 + (this.Indent * 16) }; if (this.group.HasChildren) { this.group.ShowChildren = EditorGUI.Foldout(new Rect(labelRect) { x = labelRect.x - 16, width = 16 }, this.group.ShowChildren, GUIContent.none); } GUI.Label(labelRect, this.Name); bool collapseCount = HierarchyProEditorGroupWindow.Width <= 225; Rect rectActive = new Rect(lineRect) { x = lineRect.xMax - 16, width = 16 }; Rect rectLocked = new Rect(rectActive) { x = rectActive.x - 16 }; Rect rectNotes = new Rect(rectLocked) { x = rectLocked.x - 12 }; Rect rectDivider1 = new Rect(rectNotes) { x = rectNotes.x - 2, width = 1 }; Rect rectCount = new Rect(lineRect) { x = rectDivider1.x - 56, width = 56 }; Rect rectDivider2 = new Rect(rectCount) { x = rectCount.x - 4, width = 1 }; Rect rectSelect = new Rect(lineRect) { x = (collapseCount ? rectDivider1 : rectDivider2).x - 12, width = 12 }; Rect rectAddRemove = new Rect(rectActive) { x = rectSelect.x - 24, width = 24 }; Rect rectControlArea = new Rect(lineRect) { xMin = rectAddRemove.x, xMax = rectActive.xMax }; EditorGUI.DrawRect(rectControlArea, HierarchyProEditorColors.Background); this.DrawActive(rectActive); this.DrawLocked(rectLocked); HierarchyProEditorNotes.Draw(rectNotes, this.group); EditorGUI.DrawRect(rectDivider1, EditorGUIUtility.isProSkin ? new Color(0.1f, 0.1f, 0.1f) : new Color(0.6f, 0.6f, 0.6f)); if (!collapseCount) { this.DrawCount(rectCount); EditorGUI.DrawRect(rectDivider2, EditorGUIUtility.isProSkin ? new Color(0.1f, 0.1f, 0.1f) : new Color(0.6f, 0.6f, 0.6f)); } this.DrawSelect(rectSelect); this.DrawAddRemove(rectAddRemove); if (GUI.Button(new Rect(labelRect) { width = rectSelect.x - labelRect.x }, GUIContent.none, GUIStyle.none)) { HierarchyProEditorGroupWindow.Selected = this.Group; if (Event.current.button == 1) { this.ShowContextMenu(); } } if (dragOver) { if (HierarchyProEditorGroupWindow.Dragging == this.group) { GUI.Label(new Rect(lineRect) { width = 16 }, GUIContent.none, HierarchyProEditorStyles.DropHighlight); } else { GUI.Label(lineRect, GUIContent.none, HierarchyProEditorStyles.DropHighlight); } } }