protected override void OnPrepare() { EditorGUI.indentLevel = 0; s_Depth = 0; s_Bindings.Clear(); UTinyGUI.BackgroundColor(new Rect(0, 0, Screen.width, Screen.height), UTinyColors.Inspector.Background); }
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); } }
private void DrawItem(Rect rect, HierarchyTreeItemBase item, RowGUIArgs args) { var indent = GetContentIndent(item); rect.width -= indent + 8.0f; rect.x += indent; rect.height = 1; rect.y += 3; UTinyGUI.BackgroundColor(rect, Color.gray); }
public override void Header() { var entities = Targets.Cast <UTinyEntity>(); var firstEntity = entities.FirstOrDefault(); if (null == firstEntity) { return; } UTinyGUI.BackgroundColor(new Rect(0, 0, Screen.width, 15 + 2 * UTinyGUIUtility.SingleLineAndSpaceHeight), UTinyColors.Inspector.HeaderBackground); GUILayout.Space(10); var name = firstEntity.Name; name = entities.All(entity => entity.Name == name) ? name : "-"; var enabled = firstEntity.Enabled; var sameEnabled = entities.All(tiny => tiny.Enabled == enabled); using (new EditorGUILayout.HorizontalScope()) { EditorGUI.BeginChangeCheck(); var mixed = EditorGUI.showMixedValue; EditorGUI.showMixedValue = !sameEnabled; enabled = EditorGUILayout.ToggleLeft(GUIContent.none, enabled, GUILayout.Width(EditorGUIUtility.singleLineHeight)); EditorGUI.showMixedValue = mixed; if (EditorGUI.EndChangeCheck()) { foreach (var entity in entities) { entity.Enabled = enabled; entity.View.gameObject.SetActive(enabled); } UTinyHierarchyWindow.InvalidateDataModel(); UTinyEditorUtility.RepaintAllWindows(); } EditorGUI.BeginChangeCheck(); name = EditorGUILayout.DelayedTextField(name, UTinyStyles.ComponentHeaderStyle); if (EditorGUI.EndChangeCheck()) { foreach (var entity in entities) { entity.Name = name; } UTinyHierarchyWindow.InvalidateDataModel(); UTinyEditorUtility.RepaintAllWindows(); } GUILayout.Space(EditorGUIUtility.singleLineHeight); } var layer = firstEntity.Layer; var sameLayer = entities.All(tiny => tiny.Layer == layer); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Space(50); EditorGUILayout.LabelField("Layer", GUILayout.Width(50)); EditorGUI.BeginChangeCheck(); var mixed = EditorGUI.showMixedValue; EditorGUI.showMixedValue = !sameLayer; layer = EditorGUILayout.LayerField(layer); if (EditorGUI.EndChangeCheck()) { foreach (var entity in entities) { entity.Layer = layer; entity.View.gameObject.layer = layer; } UTinyHierarchyWindow.InvalidateDataModel(); UTinyEditorUtility.RepaintAllWindows(); } GUILayout.Space(EditorGUIUtility.singleLineHeight); EditorGUI.showMixedValue = mixed; } GUILayout.Space(5); UTinyGUILayout.Separator(UTinyColors.Inspector.Separator, UTinyGUIUtility.ComponentHeaderSeperatorHeight); }
public static void Separator(Color color, float height) { var rect = GUILayoutUtility.GetRect(0, height); UTinyGUI.BackgroundColor(rect, color); }