public override void Render() { EditorGUILayout.BeginHorizontal(StyleCache.Instance.Toolbar); if (null != Adapter && null != Selection.activeGameObject) { Adapter.EventMap.Enabled = GUILayout.Toggle( Adapter.EventMap.Enabled, new GUIContent(string.Empty, Adapter.EventMap.Enabled ? TextureCache.Instance.EventsEnabled : TextureCache.Instance.EventsDisabled), StyleCache.Instance.BigButton, GUILayout.ExpandWidth(false), GUILayout.Height(30) ); ShowEventPhases = GUILayout.Toggle( ShowEventPhases, new GUIContent(string.Empty, ShowEventPhases ? TextureCache.Instance.EventPhasesOn: TextureCache.Instance.EventPhases), StyleCache.Instance.BigButton, GUILayout.ExpandWidth(false), GUILayout.Height(30) ); } else { GUI.enabled = false; GUILayout.Toggle( true, new GUIContent(string.Empty, TextureCache.Instance.EventsEnabled), StyleCache.Instance.BigButton, GUILayout.ExpandWidth(false), GUILayout.Height(30) ); GUILayout.Toggle( true, new GUIContent(string.Empty, TextureCache.Instance.EventPhasesOn), StyleCache.Instance.BigButton, GUILayout.ExpandWidth(false), GUILayout.Height(30) ); GUI.enabled = true; } EditorSettings.MouseDoubleClickEnabled = GUILayout.Toggle( EditorSettings.MouseDoubleClickEnabled, new GUIContent(string.Empty, EditorSettings.MouseDoubleClickEnabled ? TextureCache.Instance.EventDoubleClickSelected : TextureCache.Instance.EventDoubleClick), StyleCache.Instance.BigButton, GUILayout.ExpandWidth(false), GUILayout.Height(30) ); GUILayout.FlexibleSpace(); if (null == Adapter) { GUI.enabled = false; } if (GUILayout.Button(GuiContentCache.Instance.AddEventHandlerButton, StyleCache.Instance.BigButton, GUILayout.Height(30))) { var dialog = AddEventHandlerDialog.Instance; dialog.Reset(); dialog.Adapter = Adapter; dialog.ShowUtility(); } if (GUILayout.Button(new GUIContent("Remove all handlers", TextureCache.Instance.RemoveAllHandlers), StyleCache.Instance.Button, GUILayout.Height(30))) { if (EditorUtility.DisplayDialog("Remove all?", "Are you sure you want to remove all event handlers?", "OK", "Cancel")) { if (null != Adapter) { _eventMappingList.Clear(); DisplayData(); Adapter.EventMap.Reset(); } } } if (null == Adapter) { GUI.enabled = true; } EditorGUILayout.EndHorizontal(); if (!CheckSelection(false)) { return; } _rect = GUILayoutUtility.GetLastRect(); if (_rect.width != 1 && _rect != _lastRect) { _lastRect = _rect; //_displayRect = new Rect(Padding, _lastRect.yMax + Padding, Bounds.width - Padding*2, Bounds.height - _lastRect.yMax); _displayRect = new Rect(_lastRect.x + 1, _lastRect.yMax + 1, _lastRect.width - 2, Bounds.height - _lastRect.yMax); _list.UpdateLayout(_displayRect.width, _displayRect.height); } GUILayout.BeginArea(_displayRect); _list.Render(); GUILayout.EndArea(); }
public override void Render() { // mode switch EditorGUILayout.BeginHorizontal(StyleCache.Instance.Toolbar); _oldEnabled = GUI.enabled; GUI.enabled = null != Adapter; _clicked = GUILayout.Toggle(!_depthMode, new GUIContent("Order", TextureCache.Instance.OrderSelected), StyleCache.Instance.Toggle, GUILayout.Height(30), GUILayout.ExpandWidth(false)); if (_clicked && _depthMode) { _depthMode = false; } GUI.enabled = _oldEnabled; _oldEnabled = GUI.enabled; GUI.enabled = false; _clicked = GUILayout.Toggle(_depthMode, new GUIContent("Depth", TextureCache.Instance.Depth), StyleCache.Instance.Toggle, GUILayout.Height(30), GUILayout.ExpandWidth(false)); if (_clicked && !_depthMode) { _depthMode = true; } GUI.enabled = _oldEnabled; GUILayout.FlexibleSpace(); // Note: we need to always allow the addition of a Stage if (GUILayout.Button(GuiContentCache.Instance.AddChildControlContent, StyleCache.Instance.Toggle, GUILayout.Height(30), GUILayout.ExpandWidth(false))) { ToolboxDialog.Instance.ShowUtility(); } _oldEnabled = GUI.enabled; GUI.enabled = null != GroupAdapter; if (GUILayout.Button(GuiContentCache.Instance.RemoveAllChildrenButton, StyleCache.Instance.Button, GUILayout.Height(30))) { if (EditorUtility.DisplayDialog("Remove all?", "Are you sure you want to remove all children?", "OK", "Cancel")) { if (null != GroupAdapter) { //Debug.Log("Removing all children..."); GroupAdapter.RemoveAllChildren(); } } } GUI.enabled = _oldEnabled; EditorGUILayout.EndHorizontal(); if (null == _list.Data) { GUILayout.Label(GuiContentCache.Instance.NotAContainerContent, StyleCache.Instance.CenteredLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); return; } int count = _list.Data.RenderingItemsCount; if (0 == count) { GUILayout.Label(GuiContentCache.Instance.NoComponentsInTheContainer, StyleCache.Instance.CenteredLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); return; } _rect = GUILayoutUtility.GetLastRect(); // ReSharper disable once CompareOfFloatsByEqualityOperator if (_rect.width != 1 && _rect != _lastRect) { _lastRect = _rect; //_displayRect = new Rect(Padding, _lastRect.yMax + Padding, Bounds.width - Padding * 2, Bounds.height - _lastRect.yMax); _displayRect = new Rect(_lastRect.x + 1, _lastRect.yMax + 1, _lastRect.width - 2, Bounds.height - _lastRect.yMax); _list.UpdateLayout(_displayRect.width, _displayRect.height); } // wrap list inside area because it is not using GUILayout GUILayout.BeginArea(_displayRect); _list.Render(); GUILayout.EndArea(); }