public override Rect OnGUI() { GUILayout.BeginHorizontal(EditorStyles.toolbar); { if (GUILayout.Button("Show active scene", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))) { api.ResetTargets(GetSceneTargets()); } GUILayout.Space(20); EditorGUI.BeginChangeCheck(); EditorGUIUtility.labelWidth = 40; EditorGUIUtility.fieldWidth = 120; includeEvents = (PrefabEventType)EditorGUILayout.EnumMaskField(new GUIContent("Filter"), includeEvents); if (EditorGUI.EndChangeCheck()) { api.Rebuild(); } GUILayout.FlexibleSpace(); showLegend = GUILayout.Toggle(showLegend, "Legend", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)); if (showLegend) { string title = "Prefab events"; var boxSize = ColorLegendBox.GetSize(title, colorLegend); float boxPosX = EditorGUIUtility.currentViewWidth - boxSize.x - 10; float boxPosY = 42; ColorLegendBox.Draw(new Rect(boxPosX, boxPosY, boxSize.x, boxSize.y), title, colorLegend); } } GUILayout.EndHorizontal(); return(base.OnGUI()); }
public override Rect OnGUI() { GUILayout.BeginHorizontal(EditorStyles.toolbar); { GUILayout.FlexibleSpace(); showLegend = GUILayout.Toggle(showLegend, "Legend", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)); if (showLegend) { string title = "Node colors"; var colorLegend = new ColorLegendEntry[] { new ColorLegendEntry() { text = "Target Object", color = api.GetSkin().entityWidget.targetBackgroundColor }, new ColorLegendEntry() { text = "Asset", color = api.GetSkin().entityWidget.backgroundColor }, new ColorLegendEntry() { text = "Scene Object", color = sceneNodeColor } }; var boxSize = ColorLegendBox.GetSize(title, colorLegend); float boxPosX = EditorGUIUtility.currentViewWidth - boxSize.x - 10; float boxPosY = 42; ColorLegendBox.Draw(new Rect(boxPosX, boxPosY, boxSize.x, boxSize.y), title, colorLegend); } } GUILayout.EndHorizontal(); return(BackendUtil.GetMaxRect()); }