public static void DrawModuleSettingsGUI(IWindowFlowAddon addon, string caption, GenericMenu settingsMenu, System.Action onGUI) { CustomGUI.Splitter(new Color(0.7f, 0.7f, 0.7f, 0.2f)); GUILayout.BeginHorizontal(); { GUILayout.Label(caption.ToSentenceCase().UppercaseWords(), EditorStyles.boldLabel); if (settingsMenu != null) { var settingsStyle = new GUIStyle("PaneOptions"); if (GUILayout.Button(string.Empty, settingsStyle) == true) { settingsMenu.ShowAsContext(); } } } GUILayout.EndHorizontal(); CustomGUI.Splitter(new Color(0.7f, 0.7f, 0.7f, 0.2f)); GUILayout.BeginVertical(FlowSystemEditorWindow.defaultSkin.box); { if (addon != null && addon.InstallationNeeded() == true) { GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); if (GUILayoutExt.LargeButton("Install", 40f, 200f) == true) { addon.Install(); } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); } else { onGUI(); } } GUILayout.EndVertical(); }
public static void DrawModuleSettingsGUI(IWindowFlowAddon addon, string caption, GenericMenu settingsMenu, System.Action onGUI) { CustomGUI.Splitter(new Color(0.7f, 0.7f, 0.7f, 0.2f)); GUILayout.BeginHorizontal(); { GUILayout.Label(caption.ToSentenceCase().UppercaseWords(), EditorStyles.boldLabel); if (settingsMenu != null) { var settingsStyle = new GUIStyle("PaneOptions"); if (GUILayout.Button(string.Empty, settingsStyle) == true) { settingsMenu.ShowAsContext(); } } } GUILayout.EndHorizontal(); CustomGUI.Splitter(new Color(0.7f, 0.7f, 0.7f, 0.2f)); GUILayout.BeginVertical(FlowSystemEditorWindow.defaultSkin.box); { if (addon != null && addon.InstallationNeeded() == true) { if (GUILayoutExt.LargeButton("Install", 40f, 200f) == true) { addon.Install(); } } else { onGUI(); } } GUILayout.EndVertical(); }
public static void DrawModuleSettingsGUI(IWindowFlowAddon addon, string caption, GenericMenu settingsMenu, System.Action onGUI) { //CustomGUI.Splitter(new Color(0.7f, 0.7f, 0.7f, 0.2f)); var key = "UI.Windows.Addons." + caption + ":foldout"; var show = EditorPrefs.GetBool(key, true); GUILayout.BeginHorizontal(); { var style = ME.Utilities.CacheStyle("UI.Windows.Settings.AddonToggle", "Toggle", (name) => { return FlowSystemEditorWindow.defaultSkin.FindStyle("SettingsAddonToggle"); }); var styleSelected = ME.Utilities.CacheStyle("UI.Windows.Settings.AddonToggle", "ToggleSelected", (name) => { return FlowSystemEditorWindow.defaultSkin.FindStyle("SettingsAddonToggleSelected"); }); var newShow = GUILayout.Toggle(show, caption.ToSentenceCase().UppercaseWords(), show == true ? styleSelected : style); var rect = GUILayoutUtility.GetLastRect(); if (GUI.enabled == true) EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link); if (rect.Contains(Event.current.mousePosition) == true) FlowSystemEditorWindow.GetWindow<FlowSystemEditorWindow>().Repaint(); if (newShow != show) { show = newShow; EditorPrefs.SetBool(key, show); } if (settingsMenu != null) { var settingsStyle = new GUIStyle("PaneOptions"); if (GUILayout.Button(string.Empty, settingsStyle) == true) { settingsMenu.ShowAsContext(); } } } GUILayout.EndHorizontal(); //CustomGUI.Splitter(new Color(0.7f, 0.7f, 0.7f, 0.2f)); if (show == true) { GUILayout.BeginVertical(FlowSystemEditorWindow.defaultSkin.box); { if (addon != null && addon.InstallationNeeded() == true) { GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); if (GUILayoutExt.LargeButton("Install", 40f, 200f) == true) { addon.Install(); } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); } else { onGUI(); } } GUILayout.EndVertical(); } }
public static void DrawModuleSettingsGUI(IWindowFlowAddon addon, string caption, GenericMenu settingsMenu, System.Action onGUI) { //CustomGUI.Splitter(new Color(0.7f, 0.7f, 0.7f, 0.2f)); var key = "UI.Windows.Addons." + caption + ":foldout"; var show = EditorPrefs.GetBool(key, false); GUILayout.BeginHorizontal(); { var style = ME.Utilities.CacheStyle("UI.Windows.Settings.AddonToggle", "Toggle", (name) => { return(FlowSystemEditorWindow.defaultSkin.FindStyle("SettingsAddonToggle")); }); var styleSelected = ME.Utilities.CacheStyle("UI.Windows.Settings.AddonToggle", "ToggleSelected", (name) => { return(FlowSystemEditorWindow.defaultSkin.FindStyle("SettingsAddonToggleSelected")); }); var newShow = GUILayout.Toggle(show, caption.ToSentenceCase().UppercaseWords(), show == true ? styleSelected : style); var rect = GUILayoutUtility.GetLastRect(); if (GUI.enabled == true) { EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link); } //if (rect.Contains(Event.current.mousePosition) == true) FlowSystemEditorWindow.GetWindow<FlowSystemEditorWindow>().Repaint(); if (newShow != show) { show = newShow; EditorPrefs.SetBool(key, show); } if (settingsMenu != null) { var settingsStyle = new GUIStyle("PaneOptions"); if (GUILayout.Button(string.Empty, settingsStyle) == true) { settingsMenu.ShowAsContext(); } } } GUILayout.EndHorizontal(); //CustomGUI.Splitter(new Color(0.7f, 0.7f, 0.7f, 0.2f)); if (show == true) { GUILayout.BeginVertical(FlowSystemEditorWindow.defaultSkin.box); { if (addon != null && addon.InstallationNeeded() == true) { GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); if (GUILayoutExt.LargeButton("Install", 40f, 200f) == true) { addon.Install(); } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); } else { onGUI(); } } GUILayout.EndVertical(); } }