private void DrawItem(Rect rect, HierarchyEntityGroupGraph item, RowGUIArgs args) { if (null == item) { return; } var indent = GetContentIndent(item); if (!args.selected) { var headerRect = rect; headerRect.width += 1; var topLine = headerRect; topLine.height = 1; UTinyGUI.BackgroundColor(topLine, UTinyColors.Hierarchy.SceneSeparator); headerRect.y += 2; UTinyGUI.BackgroundColor(headerRect, UTinyColors.Hierarchy.SceneItem); var bottomLine = headerRect; bottomLine.y += bottomLine.height - 1; bottomLine.height = 1; UTinyGUI.BackgroundColor(bottomLine, UTinyColors.Hierarchy.SceneSeparator); } rect.y += 2; rect.x = indent; rect.width -= indent; var iconRect = rect; iconRect.width = 20; var image = ActiveScene.Equals(item.Value.EntityGroupRef) ? UTinyIcons.ActiveEntityGroup : UTinyIcons.EntityGroup; EditorGUI.LabelField(iconRect, new GUIContent { image = image }); rect.x += 20; rect.width -= 40; item.displayName = item.Value.EntityGroupRef.Dereference(Registry).Name; var style = ActiveScene.Equals(item.Value.EntityGroupRef) ? EditorStyles.boldLabel : GUI.skin.label; EditorGUI.LabelField(rect, item.displayName, style); rect.x += rect.width; rect.width = 16; rect.y = rect.center.y - 5.5f; rect.height = 11; if (GUI.Button(rect, GUIContent.none, UTinyStyles.PaneOptionStyle)) { HierarchyContextMenus.ShowEntityGroupContextMenu(this, item.Value.EntityGroupRef); } }
protected override TreeViewItem BuildRoot() { var nextId = int.MaxValue; var root = new HierarchyTreeItemBase() { id = nextId--, depth = -1, displayName = "Root" }; if (null == m_EntityGroups || m_EntityGroups.Count == 0) { var item = new TreeViewItem { id = nextId--, depth = 0, displayName = "No group Opened" }; root.AddChild(item); return(root); } foreach (var entityGroupRef in m_EntityGroups) { var graph = UTinyHierarchyWindow.GetSceneGraph(entityGroupRef); if (null == graph) { RemoveEntityGroup(entityGroupRef); continue; } var entityGroup = graph.EntityGroupRef.Dereference(Registry); Assert.IsNotNull(entityGroup); var item = new HierarchyEntityGroupGraph { id = nextId--, depth = 0, displayName = entityGroup.Name, Value = graph }; root.AddChild(item); foreach (var node in graph.Roots) { BuildFromNode(node, item); } if (graph.StaticEntities.Count > 0) { item.AddChild(new HierarchyTreeItemBase { id = nextId--, depth = 1 }); } foreach (var node in graph.StaticEntities) { BuildFromNode(node, item); } } ShouldReload = false; return(root); }