public override void OnGUI(string searchContext)
        {
            m_InventorSettings.Update();

            // Auto Update
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(Styles.autoUpdate, new GUILayoutOption[] { GUILayout.MinWidth(160f) });
            m_InventorSettings.FindProperty("m_AutoUpdate").boolValue = !Convert.ToBoolean(GUILayout.Toolbar(Convert.ToInt32(!m_InventorSettings.FindProperty("m_AutoUpdate").boolValue), new string[] { "Yes", "No" }, new GUILayoutOption[] { GUILayout.MinWidth(128f), GUILayout.MaxWidth(384f) }));
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(2);

            // Auto Update
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(Styles.allowInvalid, new GUILayoutOption[] { GUILayout.MinWidth(160f) });
            m_InventorSettings.FindProperty("m_AllowInvalid").boolValue = !Convert.ToBoolean(GUILayout.Toolbar(Convert.ToInt32(!m_InventorSettings.FindProperty("m_AllowInvalid").boolValue), new string[] { "Yes", "No" }, new GUILayoutOption[] { GUILayout.MinWidth(128f), GUILayout.MaxWidth(384f) }));
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(4);

            // Default Path
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(Styles.defaultPath, new GUILayoutOption[] { GUILayout.MinWidth(160f) });
            EditorGUI.BeginChangeCheck();
            m_InventorSettings.FindProperty("m_DefaultPath").stringValue = EditorGUILayout.TextField(m_InventorSettings.FindProperty("m_DefaultPath").stringValue, new GUILayoutOption[] { GUILayout.MinWidth(128f), GUILayout.MaxWidth(384f) });
            if (EditorGUI.EndChangeCheck() && !m_InventorSettings.FindProperty("m_DefaultPath").stringValue.StartsWith("Assets"))
            {
                m_InventorSettings.FindProperty("m_DefaultPath").stringValue = k_InventorSettingsPath.Substring(0, k_InventorSettingsPath.LastIndexOf("Editor") - 1) + Path.DirectorySeparatorChar + "Output";
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            // Upgrade All
            DrawLine(false);
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Space(4f);
            if (GUILayout.Button(Styles.upgradeButton, GUILayout.MaxWidth(512f)))
            {
                InventoryPresetUtility.UpgradeAll(true);
            }
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            m_InventorSettings.ApplyModifiedProperties();
        }
Пример #2
0
        private static void OnScriptsReloaded()
        {
            if (InventorSettings.GetSerializedSettings().FindProperty("m_Updating").boolValue)
            {
                // Get Main Path
                string mainPath = GetSettingsPath().Substring(0, GetSettingsPath().LastIndexOf("Editor") - 1);

                // Upgrade Presets
                InventoryPresetUtility.UpgradeAll(false);

                // Display Changes
                if (File.Exists(mainPath + "/CHANGES.md"))
                {
                    EditorApplication.update += OnUpdatedUpdate;
                }

                // Disable Updating Flag
                var settings = InventorSettings.GetSerializedSettings();
                settings.FindProperty("m_Updating").boolValue = false;
                settings.ApplyModifiedProperties();
            }
        }