public override void DrawStyle() { var window = StateWindow.Get(); var row = this.row.target.As <StateRow>(); var script = row.target; bool darkSkin = EditorGUIUtility.isProSkin || EditorPref.Get <bool>("Zios.Theme.Dark", false); string name = this.target is string?(string)this.target : script.alias; string background = darkSkin ? "BoxBlackA30" : "BoxWhiteBWarm"; Color textColor = darkSkin? Colors.Get("Silver") : Colors.Get("Black"); GUIStyle style = new GUIStyle(GUI.skin.label); GUIStyle expand = Style.Get("buttonExpand", true); bool fieldHovered = window.row == this.row.order; if (fieldHovered) { textColor = darkSkin ? Colors.Get("ZestyBlue") : Colors.Get("White"); background = darkSkin ? "BoxBlackHighlightBlueAWarm" : "BoxBlackHighlightBlueDWarm"; } if (this.row.selected) { textColor = darkSkin ? Colors.Get("White") : Colors.Get("White"); background = darkSkin ? "BoxBlackHighlightCyanA" : "BoxBlackHighlightCyanCWarm"; } style.fixedWidth -= 28; style.margin.left = 0; style.normal.textColor = textColor; style.normal.background = File.GetAsset <Texture2D>(background); if (this.row.selected) { expand.normal.background = style.normal.background; expand.normal.textColor = textColor; expand.hover = expand.normal; style.hover = style.normal; } bool open = EditorPref.Get <bool>("StateWindow-GroupRow-" + row.section, false); string symbol = open ? "-" : "+"; StateWindow.Clip(symbol, expand, -1, window.headerSize); if (GUILayoutUtility.GetLastRect().AddX(window.scroll.x).Clicked()) { EditorPref.Toggle("StateWindow-GroupRow-" + row.section); foreach (var groupRow in this.groupRows) { groupRow.disabled = !groupRow.disabled; } Event.current.Use(); window.tableGUI.ShowAll(); window.Repaint(); } StateWindow.Clip(name, style, -1, window.headerSize); }
public void DrawMenu() { GenericMenu menu = new GenericMenu(); MenuFunction toggleAdvanced = () => EditorPref.Toggle("MonoBehaviourEditor-Advanced"); MenuFunction toggleInternal = () => EditorPref.Toggle("MonoBehaviourEditor-Internal"); MenuFunction toggleDictionary = () => EditorPref.Toggle("MonoBehaviourEditor-Dictionary"); MenuFunction hideAllDefaults = () => EditorPref.Toggle("MonoBehaviourEditor-HideAllDefault"); MenuFunction hideLocalDefaults = () => { this.hideDefault = !this.hideDefault; EditorPref.Set <bool>("MonoBehaviourEditor-" + this.target.GetInstanceID() + "HideDefault", this.hideDefault); }; menu.AddItem(new GUIContent("Advanced"), EditorPref.Get <bool>("MonoBehaviourEditor-Advanced"), toggleAdvanced); menu.AddItem(new GUIContent("Internal"), EditorPref.Get <bool>("MonoBehaviourEditor-Internal"), toggleInternal); menu.AddItem(new GUIContent("Dictionary"), EditorPref.Get <bool>("MonoBehaviourEditor-Dictionary"), toggleDictionary); menu.AddSeparator(""); menu.AddItem(new GUIContent("Defaults/Hide All"), EditorPref.Get <bool>("MonoBehaviourEditor-HideAllDefault"), hideAllDefaults); menu.AddItem(new GUIContent("Defaults/Hide Local"), this.hideDefault, hideLocalDefaults); if (this.hidden.Count > 0) { MenuFunction unhideAll = () => { foreach (var property in this.hidden) { string path = "MonoBehaviourEditor-PropertyHide-" + this.target.GetInstanceID() + "-" + property.propertyPath; EditorPref.Set <bool>(path, false); } this.hidden.Clear(); }; menu.AddSeparator(""); menu.AddItem(new GUIContent("Unhide/All"), false, unhideAll); foreach (var property in this.hidden) { SerializedProperty target = property; MenuFunction unhide = () => { string path = "MonoBehaviourEditor-PropertyHide-" + this.target.GetInstanceID() + "-" + property.propertyPath; EditorPref.Set <bool>(path, false); this.hidden.Remove(target); }; menu.AddItem(new GUIContent("Unhide/" + property.displayName), false, unhide); } } menu.ShowAsContext(); Event.current.Use(); }