public static void Init() { // Get existing open window or if none, make a new one: ES3Window window = (ES3Window)EditorWindow.GetWindow(typeof(ES3Window)); window.Show(); }
// Shows the Easy Save Home window if it's not been disabled. // This method is called from the Postprocessor. public static void OpenEditorWindowOnStart() { if (EditorPrefs.GetBool("Show ES3 Window on Start", true)) { ES3Window.InitAndShowHome(); } EditorPrefs.SetBool("Show ES3 Window on Start", false); }
public static void InitAndShowAutoSave() { // Get existing open window or if none, make a new one: ES3Window window = (ES3Window)EditorWindow.GetWindow(typeof(ES3Window)); window.Show(); window.SetCurrentWindow(typeof(AutoSaveWindow)); }
public static void InitAndShowHome() { // Get existing open window or if none, make a new one: ES3Window window = (ES3Window)EditorWindow.GetWindow(typeof(ES3Window)); window.Show(); window.currentWindow = new HomeWindow(window); }
public static void InitAndShowTypes(System.Type type) { // Get existing open window or if none, make a new one: ES3Window window = (ES3Window)EditorWindow.GetWindow(typeof(ES3Window)); window.Show(); var typesWindow = (TypesWindow)window.SetCurrentWindow(typeof(TypesWindow)); typesWindow.SelectType(type); }
public static void InitAndShowSettings() { // Get existing open window or if none, make a new one: ES3Window window = (ES3Window)EditorWindow.GetWindow(typeof(ES3Window)); if (window != null) { window.Show(); window.SetCurrentWindow(typeof(SettingsWindow)); } }
public void DrawComponents() { EditorGUI.indentLevel += 3; using (var scope = new EditorGUILayout.VerticalScope()) { foreach (var component in components) { if (component == null) { continue; } using (var horizontalScope = new EditorGUILayout.HorizontalScope()) { bool saveComponent = false; if (autoSave != null) { saveComponent = autoSave.componentsToSave.Contains(component); } var newValue = EditorGUILayout.ToggleLeft(EditorGUIUtility.ObjectContent(component, component.GetType()), saveComponent); // If the checkbox has changed, we want to save or not save a Component if (newValue != saveComponent) { if (autoSave == null) { autoSave = t.gameObject.AddComponent <ES3AutoSave>(); autoSave.saveChildren = false; } // If we've unchecked the box, remove the Component from the array. if (newValue == false) { autoSave.componentsToSave.Remove(component); } // Else, add it to the array. else { autoSave.componentsToSave.Add(component); } } if (GUILayout.Button(EditorGUIUtility.IconContent("_Popup"), new GUIStyle("Label"))) { ES3Window.InitAndShowTypes(component.GetType()); } } } } EditorGUI.indentLevel -= 3; }
public void DrawComponents() { EditorGUI.indentLevel += 3; using (var scope = new EditorGUILayout.VerticalScope()) { bool toggle; toggle = EditorGUILayout.ToggleLeft("active", autoSave != null ? autoSave.saveActive : false); if ((autoSave = (toggle && autoSave == null) ? t.gameObject.AddComponent <ES3AutoSave>() : autoSave) != null) { autoSave.saveActive = toggle; } toggle = EditorGUILayout.ToggleLeft("hideFlags", autoSave != null ? autoSave.saveHideFlags : false); if ((autoSave = (toggle && autoSave == null) ? t.gameObject.AddComponent <ES3AutoSave>() : autoSave) != null) { autoSave.saveHideFlags = toggle; } toggle = EditorGUILayout.ToggleLeft("layer", autoSave != null ? autoSave.saveLayer : false); if ((autoSave = (toggle && autoSave == null) ? t.gameObject.AddComponent <ES3AutoSave>() : autoSave) != null) { autoSave.saveLayer = toggle; } toggle = EditorGUILayout.ToggleLeft("name", autoSave != null ? autoSave.saveName : false); if ((autoSave = (toggle && autoSave == null) ? t.gameObject.AddComponent <ES3AutoSave>() : autoSave) != null) { autoSave.saveName = toggle; } toggle = EditorGUILayout.ToggleLeft("tag", autoSave != null ? autoSave.saveTag : false); if ((autoSave = (toggle && autoSave == null) ? t.gameObject.AddComponent <ES3AutoSave>() : autoSave) != null) { autoSave.saveTag = toggle; } foreach (var component in components) { if (component == null) { continue; } using (var horizontalScope = new EditorGUILayout.HorizontalScope()) { bool saveComponent = false; if (autoSave != null) { saveComponent = autoSave.componentsToSave.Contains(component); } var newValue = EditorGUILayout.ToggleLeft(EditorGUIUtility.ObjectContent(component, component.GetType()), saveComponent); // If the checkbox has changed, we want to save or not save a Component if (newValue != saveComponent) { if (autoSave == null) { autoSave = t.gameObject.AddComponent <ES3AutoSave>(); autoSave.saveChildren = false; } // If we've unchecked the box, remove the Component from the array. if (newValue == false) { autoSave.componentsToSave.Remove(component); } // Else, add it to the array. else { autoSave.componentsToSave.Add(component); } } if (GUILayout.Button(EditorGUIUtility.IconContent("_Popup"), new GUIStyle("Label"))) { ES3Window.InitAndShowTypes(component.GetType()); } } } } if (autoSave != null && (autoSave.componentsToSave == null || autoSave.componentsToSave.Count == 0) && !autoSave.saveActive && !autoSave.saveChildren && !autoSave.saveHideFlags && !autoSave.saveLayer && !autoSave.saveName && !autoSave.saveTag) { Undo.DestroyObjectImmediate(autoSave); autoSave = null; } EditorGUI.indentLevel -= 3; }