private bool VersionControlSystemHasGUI()
 {
     if (!Collab.instance.GetCollabInfo().whitelisted || !CollabAccess.Instance.IsServiceEnabled())
     {
         ExternalVersionControl d = EditorSettings.externalVersionControl;
         return(d != ExternalVersionControl.Disabled && d != ExternalVersionControl.AutoDetect && d != ExternalVersionControl.AssetServer && d != ExternalVersionControl.Generic);
     }
     return(false);
 }
示例#2
0
        private bool VersionControlSystemHasGUI()
        {
            ExternalVersionControl externalVersionControl = (ExternalVersionControl)EditorSettings.externalVersionControl;

            if ((string)externalVersionControl != ExternalVersionControl.Disabled && (string)externalVersionControl != ExternalVersionControl.AutoDetect && (string)externalVersionControl != ExternalVersionControl.AssetServer)
            {
                return((string)externalVersionControl != ExternalVersionControl.Generic);
            }
            return(false);
        }
        private bool VersionControlSystemHasGUI()
        {
            bool collabEnabled = Collab.instance.IsCollabEnabledForCurrentProject();
            if (!collabEnabled)
            {
            ExternalVersionControl system = EditorSettings.externalVersionControl;
            return
                system != ExternalVersionControl.Disabled &&
                system != ExternalVersionControl.AutoDetect &&
                system != ExternalVersionControl.Generic;
        }

        return false;
        }
示例#4
0
        private bool VersionControlSystemHasGUI()
        {
            bool result;

            if (!CollabAccess.Instance.IsServiceEnabled())
            {
                ExternalVersionControl d = EditorSettings.externalVersionControl;
                result = (d != ExternalVersionControl.Disabled && d != ExternalVersionControl.AutoDetect && d != ExternalVersionControl.AssetServer && d != ExternalVersionControl.Generic);
            }
            else
            {
                result = false;
            }
            return(result);
        }
        private bool VersionControlSystemHasGUI()
        {
            bool result;

            if (!Collab.instance.IsCollabEnabledForCurrentProject())
            {
                ExternalVersionControl d = EditorSettings.externalVersionControl;
                result = (d != ExternalVersionControl.Disabled && d != ExternalVersionControl.AutoDetect && d != ExternalVersionControl.Generic);
            }
            else
            {
                result = false;
            }
            return(result);
        }
        public override void OnInspectorGUI()
        {
            bool enabled = GUI.enabled;

            this.ShowUnityRemoteGUI(enabled);
            GUILayout.Space(10f);
            bool flag = Collab.instance.GetCollabInfo().whitelisted&& CollabAccess.Instance.IsServiceEnabled();

            using (new EditorGUI.DisabledScope(!flag))
            {
                GUI.enabled = !flag;
                GUILayout.Label("Version Control", EditorStyles.boldLabel, new GUILayoutOption[0]);
                GUI.enabled = (enabled && !flag);
                ExternalVersionControl d = EditorSettings.externalVersionControl;
                this.CreatePopupMenu("Mode", this.vcPopupList, d, new GenericMenu.MenuFunction2(this.SetVersionControlSystem));
            }
            if (flag)
            {
                EditorGUILayout.HelpBox("Version Control not available when using Collaboration feature.", MessageType.Warning);
            }
            if (this.VersionControlSystemHasGUI())
            {
                GUI.enabled = true;
                bool flag2 = false;
                if (EditorSettings.externalVersionControl == ExternalVersionControl.AssetServer)
                {
                    EditorUserSettings.SetConfigValue("vcUsername", EditorGUILayout.TextField("User", EditorUserSettings.GetConfigValue("vcUsername"), new GUILayoutOption[0]));
                    EditorUserSettings.SetConfigValue("vcPassword", EditorGUILayout.PasswordField("Password", EditorUserSettings.GetConfigValue("vcPassword"), new GUILayoutOption[0]));
                }
                else if (!(EditorSettings.externalVersionControl == ExternalVersionControl.Generic))
                {
                    if (!(EditorSettings.externalVersionControl == ExternalVersionControl.Disabled))
                    {
                        ConfigField[] activeConfigFields = Provider.GetActiveConfigFields();
                        flag2 = true;
                        ConfigField[] array = activeConfigFields;
                        for (int i = 0; i < array.Length; i++)
                        {
                            ConfigField configField = array[i];
                            string      configValue = EditorUserSettings.GetConfigValue(configField.name);
                            string      text;
                            if (configField.isPassword)
                            {
                                text = EditorGUILayout.PasswordField(configField.label, configValue, new GUILayoutOption[0]);
                            }
                            else
                            {
                                text = EditorGUILayout.TextField(configField.label, configValue, new GUILayoutOption[0]);
                            }
                            if (text != configValue)
                            {
                                EditorUserSettings.SetConfigValue(configField.name, text);
                            }
                            if (configField.isRequired && string.IsNullOrEmpty(text))
                            {
                                flag2 = false;
                            }
                        }
                    }
                }
                string logLevel = EditorUserSettings.GetConfigValue("vcSharedLogLevel");
                int    num      = Array.FindIndex <string>(this.logLevelPopupList, (string item) => item.ToLower() == logLevel);
                if (num == -1)
                {
                    logLevel = "info";
                }
                int num2 = EditorGUILayout.Popup("Log Level", Math.Abs(num), this.logLevelPopupList, new GUILayoutOption[0]);
                if (num2 != num)
                {
                    EditorUserSettings.SetConfigValue("vcSharedLogLevel", this.logLevelPopupList[num2].ToLower());
                }
                GUI.enabled = enabled;
                string label = "Connected";
                if (Provider.onlineState == OnlineState.Updating)
                {
                    label = "Connecting...";
                }
                else if (Provider.onlineState == OnlineState.Offline)
                {
                    label = "Disconnected";
                }
                EditorGUILayout.LabelField("Status", label, new GUILayoutOption[0]);
                if (Provider.onlineState != OnlineState.Online && !string.IsNullOrEmpty(Provider.offlineReason))
                {
                    GUI.enabled = false;
                    GUILayout.TextArea(Provider.offlineReason, new GUILayoutOption[0]);
                    GUI.enabled = enabled;
                }
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUI.enabled = (flag2 && Provider.onlineState != OnlineState.Updating);
                if (GUILayout.Button("Connect", EditorStyles.miniButton, new GUILayoutOption[0]))
                {
                    Provider.UpdateSettings();
                }
                GUILayout.EndHorizontal();
                EditorUserSettings.AutomaticAdd = EditorGUILayout.Toggle("Automatic add", EditorUserSettings.AutomaticAdd, new GUILayoutOption[0]);
                if (Provider.requiresNetwork)
                {
                    bool flag3 = EditorGUILayout.Toggle("Work Offline", EditorUserSettings.WorkOffline, new GUILayoutOption[0]);
                    if (flag3 != EditorUserSettings.WorkOffline)
                    {
                        if (flag3 && !EditorUtility.DisplayDialog("Confirm working offline", "Working offline and making changes to your assets means that you will have to manually integrate changes back into version control using your standard version control client before you stop working offline in Unity. Make sure you know what you are doing.", "Work offline", "Cancel"))
                        {
                            flag3 = false;
                        }
                        EditorUserSettings.WorkOffline = flag3;
                        EditorApplication.RequestRepaintAllViews();
                    }
                }
                if (Provider.hasCheckoutSupport)
                {
                    EditorUserSettings.showFailedCheckout = EditorGUILayout.Toggle("Show failed checkouts", EditorUserSettings.showFailedCheckout, new GUILayoutOption[0]);
                }
                GUI.enabled = enabled;
                EditorUserSettings.semanticMergeMode = (SemanticMergeMode)EditorGUILayout.Popup("Smart merge", (int)EditorUserSettings.semanticMergeMode, this.semanticMergePopupList, new GUILayoutOption[0]);
                this.DrawOverlayDescriptions();
            }
            GUILayout.Space(10f);
            GUILayout.Label("WWW Security Emulation", EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorSettings.webSecurityEmulationEnabled = EditorGUILayout.Toggle("Enable Webplayer Security Emulation", EditorSettings.webSecurityEmulationEnabled, new GUILayoutOption[0]);
            string text2 = EditorGUILayout.TextField("Host URL", EditorSettings.webSecurityEmulationHostUrl, new GUILayoutOption[0]);

            if (text2 != EditorSettings.webSecurityEmulationHostUrl)
            {
                EditorSettings.webSecurityEmulationHostUrl = text2;
            }
            GUILayout.Space(10f);
            int selectedIndex = (int)EditorSettings.serializationMode;

            using (new EditorGUI.DisabledScope(!flag))
            {
                GUI.enabled = !flag;
                GUILayout.Label("Asset Serialization", EditorStyles.boldLabel, new GUILayoutOption[0]);
                GUI.enabled = (enabled && !flag);
                this.CreatePopupMenu("Mode", this.serializationPopupList, selectedIndex, new GenericMenu.MenuFunction2(this.SetAssetSerializationMode));
            }
            if (flag)
            {
                EditorGUILayout.HelpBox("Asset Serialization is forced to Text when using Collaboration feature.", MessageType.Warning);
            }
            GUILayout.Space(10f);
            GUI.enabled = true;
            GUILayout.Label("Default Behavior Mode", EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUI.enabled   = enabled;
            selectedIndex = Mathf.Clamp((int)EditorSettings.defaultBehaviorMode, 0, this.behaviorPopupList.Length - 1);
            this.CreatePopupMenu("Mode", this.behaviorPopupList, selectedIndex, new GenericMenu.MenuFunction2(this.SetDefaultBehaviorMode));
            GUILayout.Space(10f);
            GUI.enabled = true;
            GUILayout.Label("Sprite Packer", EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUI.enabled   = enabled;
            selectedIndex = Mathf.Clamp((int)EditorSettings.spritePackerMode, 0, this.spritePackerPopupList.Length - 1);
            this.CreatePopupMenu("Mode", this.spritePackerPopupList, selectedIndex, new GenericMenu.MenuFunction2(this.SetSpritePackerMode));
            selectedIndex = Mathf.Clamp(EditorSettings.spritePackerPaddingPower - 1, 0, 2);
            this.CreatePopupMenu("Padding Power", this.spritePackerPaddingPowerPopupList, selectedIndex, new GenericMenu.MenuFunction2(this.SetSpritePackerPaddingPower));
            this.DoProjectGenerationSettings();
        }
示例#7
0
        public override void OnInspectorGUI()
        {
            // GUI.enabled hack because we don't want some controls to be disabled if the EditorSettings.asset is locked
            // since some of the controls are not dependent on the Editor Settings asset. Unfortunately, this assumes
            // that the editor will only be disabled because of version control locking which may change in the future.
            var editorEnabled = GUI.enabled;

            ShowUnityRemoteGUI(editorEnabled);

            GUILayout.Space(10);
            bool collabEnabled = Collab.instance.IsCollabEnabledForCurrentProject();

            using (new EditorGUI.DisabledScope(!collabEnabled))
            {
                GUI.enabled = !collabEnabled;
                GUILayout.Label("Version Control", EditorStyles.boldLabel);

                ExternalVersionControl selvc = EditorSettings.externalVersionControl;
                CreatePopupMenuVersionControl("Mode", vcPopupList, selvc, SetVersionControlSystem);
                GUI.enabled = editorEnabled && !collabEnabled;
            }
            if (collabEnabled)
            {
                EditorGUILayout.HelpBox("Version Control not available when using Collaboration feature.", MessageType.Warning);
            }

            if (VersionControlSystemHasGUI())
            {
                GUI.enabled = true;
                bool hasRequiredFields = false;

                if (EditorSettings.externalVersionControl == ExternalVersionControl.Generic ||
                    EditorSettings.externalVersionControl == ExternalVersionControl.Disabled)
                {
                    // no specific UI for these VCS types
                }
                else
                {
                    ConfigField[] configFields = Provider.GetActiveConfigFields();

                    hasRequiredFields = true;

                    foreach (ConfigField field in configFields)
                    {
                        string newVal;
                        string oldVal = EditorUserSettings.GetConfigValue(field.name);
                        if (field.isPassword)
                        {
                            newVal = EditorGUILayout.PasswordField(field.label, oldVal);
                            if (newVal != oldVal)
                            {
                                EditorUserSettings.SetPrivateConfigValue(field.name, newVal);
                            }
                        }
                        else
                        {
                            newVal = EditorGUILayout.TextField(field.label, oldVal);
                            if (newVal != oldVal)
                            {
                                EditorUserSettings.SetConfigValue(field.name, newVal);
                            }
                        }

                        if (field.isRequired && string.IsNullOrEmpty(newVal))
                        {
                            hasRequiredFields = false;
                        }
                    }
                }

                // Log level popup
                string logLevel = EditorUserSettings.GetConfigValue("vcSharedLogLevel");
                int    idx      = System.Array.FindIndex(logLevelPopupList, (item) => item.ToLower() == logLevel);
                if (idx == -1)
                {
                    logLevel = "notice";
                    idx      = System.Array.FindIndex(logLevelPopupList, (item) => item.ToLower() == logLevel);
                    if (idx == -1)
                    {
                        idx = 0;
                    }
                    logLevel = logLevelPopupList[idx];
                    EditorUserSettings.SetConfigValue("vcSharedLogLevel", logLevel);
                }
                int newIdx = EditorGUILayout.Popup("Log Level", idx, logLevelPopupList);
                if (newIdx != idx)
                {
                    EditorUserSettings.SetConfigValue("vcSharedLogLevel", logLevelPopupList[newIdx].ToLower());
                }

                GUI.enabled = editorEnabled;

                string osState = "Connected";
                if (Provider.onlineState == OnlineState.Updating)
                {
                    osState = "Connecting...";
                }
                else if (Provider.onlineState == OnlineState.Offline)
                {
                    osState = "Disconnected";
                }

                EditorGUILayout.LabelField("Status", osState);

                if (Provider.onlineState != OnlineState.Online && !string.IsNullOrEmpty(Provider.offlineReason))
                {
                    GUI.enabled = false;
                    GUILayout.TextArea(Provider.offlineReason);
                    GUI.enabled = editorEnabled;
                }

                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUI.enabled = hasRequiredFields && Provider.onlineState != OnlineState.Updating;
                if (GUILayout.Button("Connect", EditorStyles.miniButton))
                {
                    Provider.UpdateSettings();
                }
                GUILayout.EndHorizontal();

                EditorUserSettings.AutomaticAdd = EditorGUILayout.Toggle("Automatic add", EditorUserSettings.AutomaticAdd);

                if (Provider.requiresNetwork)
                {
                    bool workOfflineNew = EditorGUILayout.Toggle("Work Offline", EditorUserSettings.WorkOffline); // Enabled has a slightly different behaviour
                    if (workOfflineNew != EditorUserSettings.WorkOffline)
                    {
                        // On toggling on show a warning
                        if (workOfflineNew && !EditorUtility.DisplayDialog("Confirm working offline", "Working offline and making changes to your assets means that you will have to manually integrate changes back into version control using your standard version control client before you stop working offline in Unity. Make sure you know what you are doing.", "Work offline", "Cancel"))
                        {
                            workOfflineNew = false; // User cancelled working offline
                        }
                        EditorUserSettings.WorkOffline = workOfflineNew;
                        EditorApplication.RequestRepaintAllViews();
                    }

                    EditorUserSettings.allowAsyncStatusUpdate = EditorGUILayout.Toggle("Allow Async Update", EditorUserSettings.allowAsyncStatusUpdate);
                }

                if (Provider.hasCheckoutSupport)
                {
                    EditorUserSettings.showFailedCheckout = EditorGUILayout.Toggle("Show failed checkouts", EditorUserSettings.showFailedCheckout);
                }

                GUI.enabled = editorEnabled;

                // Semantic merge popup
                EditorUserSettings.semanticMergeMode = (SemanticMergeMode)EditorGUILayout.Popup("Smart merge", (int)EditorUserSettings.semanticMergeMode, semanticMergePopupList);

                DrawOverlayDescriptions();
            }

            GUILayout.Space(10);

            int index = (int)EditorSettings.serializationMode;

            using (new EditorGUI.DisabledScope(!collabEnabled))
            {
                GUI.enabled = !collabEnabled;
                GUILayout.Label("Asset Serialization", EditorStyles.boldLabel);
                GUI.enabled = editorEnabled && !collabEnabled;


                CreatePopupMenu("Mode", serializationPopupList, index, SetAssetSerializationMode);
            }
            if (collabEnabled)
            {
                EditorGUILayout.HelpBox("Asset Serialization is forced to Text when using Collaboration feature.", MessageType.Warning);
            }

            GUILayout.Space(10);

            GUI.enabled = true;
            GUILayout.Label("Default Behavior Mode", EditorStyles.boldLabel);
            GUI.enabled = editorEnabled;

            index = Mathf.Clamp((int)EditorSettings.defaultBehaviorMode, 0, behaviorPopupList.Length - 1);
            CreatePopupMenu("Mode", behaviorPopupList, index, SetDefaultBehaviorMode);

            GUILayout.Space(10);

            GUI.enabled = true;
            GUILayout.Label("Sprite Packer", EditorStyles.boldLabel);
            GUI.enabled = editorEnabled;

            index = Mathf.Clamp((int)EditorSettings.spritePackerMode, 0, spritePackerPopupList.Length - 1);
            CreatePopupMenu("Mode", spritePackerPopupList, index, SetSpritePackerMode);

            if (EditorSettings.spritePackerMode == SpritePackerMode.AlwaysOn ||
                EditorSettings.spritePackerMode == SpritePackerMode.BuildTimeOnly)
            {
                index = Mathf.Clamp((int)(EditorSettings.spritePackerPaddingPower - 1), 0, 2);
                CreatePopupMenu("Padding Power (Legacy Sprite Packer)", spritePackerPaddingPowerPopupList, index, SetSpritePackerPaddingPower);
            }

            DoProjectGenerationSettings();
            DoEtcTextureCompressionSettings();
            DoInternalSettings();
            DoLineEndingsSettings();
        }
        private bool VersionControlSystemHasGUI()
        {
            ExternalVersionControl d = EditorSettings.externalVersionControl;

            return(d != ExternalVersionControl.Disabled && d != ExternalVersionControl.AutoDetect && d != ExternalVersionControl.AssetServer && d != ExternalVersionControl.Generic);
        }
        public override void OnInspectorGUI()
        {
            bool enabled = GUI.enabled;

            this.ShowUnityRemoteGUI(enabled);
            GUILayout.Space(10f);
            GUI.enabled = true;
            GUILayout.Label("Version Control", EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUI.enabled = enabled;
            ExternalVersionControl selvc = EditorSettings.externalVersionControl;
            int num = Array.FindIndex <EditorSettingsInspector.PopupElement>(this.vcPopupList, (EditorSettingsInspector.PopupElement cand) => cand.content.text == selvc);

            if (num < 0)
            {
                num = 0;
            }
            GUIContent content = new GUIContent(this.vcPopupList[num].content);
            Rect       rect    = GUILayoutUtility.GetRect(content, EditorStyles.popup);

            rect = EditorGUI.PrefixLabel(rect, 0, new GUIContent("Mode"));
            if (EditorGUI.ButtonMouseDown(rect, content, FocusType.Passive, EditorStyles.popup))
            {
                this.DoPopup(rect, this.vcPopupList, num, new GenericMenu.MenuFunction2(this.SetVersionControlSystem));
            }
            if (this.VersionControlSystemHasGUI())
            {
                GUI.enabled = true;
                bool enabled2 = false;
                if (EditorSettings.externalVersionControl == ExternalVersionControl.AssetServer)
                {
                    EditorUserSettings.SetConfigValue("vcUsername", EditorGUILayout.TextField("User", EditorUserSettings.GetConfigValue("vcUsername"), new GUILayoutOption[0]));
                    EditorUserSettings.SetConfigValue("vcPassword", EditorGUILayout.PasswordField("Password", EditorUserSettings.GetConfigValue("vcPassword"), new GUILayoutOption[0]));
                }
                else if (!(EditorSettings.externalVersionControl == ExternalVersionControl.Generic))
                {
                    if (!(EditorSettings.externalVersionControl == ExternalVersionControl.Disabled))
                    {
                        ConfigField[] activeConfigFields = Provider.GetActiveConfigFields();
                        enabled2 = true;
                        ConfigField[] array = activeConfigFields;
                        for (int i = 0; i < array.Length; i++)
                        {
                            ConfigField configField = array[i];
                            string      configValue = EditorUserSettings.GetConfigValue(configField.name);
                            string      text;
                            if (configField.isPassword)
                            {
                                text = EditorGUILayout.PasswordField(configField.label, configValue, new GUILayoutOption[0]);
                            }
                            else
                            {
                                text = EditorGUILayout.TextField(configField.label, configValue, new GUILayoutOption[0]);
                            }
                            if (text != configValue)
                            {
                                EditorUserSettings.SetConfigValue(configField.name, text);
                            }
                            if (configField.isRequired && string.IsNullOrEmpty(text))
                            {
                                enabled2 = false;
                            }
                        }
                    }
                }
                string logLevel = EditorUserSettings.GetConfigValue("vcSharedLogLevel");
                int    num2     = Array.FindIndex <string>(this.logLevelPopupList, (string item) => item.ToLower() == logLevel);
                if (num2 == -1)
                {
                    logLevel = "info";
                }
                int num3 = EditorGUILayout.Popup("Log Level", Math.Abs(num2), this.logLevelPopupList, new GUILayoutOption[0]);
                if (num3 != num2)
                {
                    EditorUserSettings.SetConfigValue("vcSharedLogLevel", this.logLevelPopupList[num3].ToLower());
                }
                GUI.enabled = enabled;
                string label = "Connected";
                if (Provider.onlineState == OnlineState.Updating)
                {
                    label = "Connecting...";
                }
                else if (Provider.onlineState == OnlineState.Offline)
                {
                    label = "Disconnected";
                }
                EditorGUILayout.LabelField("Status", label, new GUILayoutOption[0]);
                if (Provider.onlineState != OnlineState.Online && !string.IsNullOrEmpty(Provider.offlineReason))
                {
                    GUI.enabled = false;
                    GUILayout.TextArea(Provider.offlineReason, new GUILayoutOption[0]);
                    GUI.enabled = enabled;
                }
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUI.enabled = enabled2;
                if (GUILayout.Button("Connect", EditorStyles.miniButton, new GUILayoutOption[0]))
                {
                    Provider.UpdateSettings();
                }
                GUILayout.EndHorizontal();
                EditorUserSettings.AutomaticAdd = EditorGUILayout.Toggle("Automatic add", EditorUserSettings.AutomaticAdd, new GUILayoutOption[0]);
                if (Provider.requiresNetwork)
                {
                    bool flag = EditorGUILayout.Toggle("Work Offline", EditorUserSettings.WorkOffline, new GUILayoutOption[0]);
                    if (flag != EditorUserSettings.WorkOffline)
                    {
                        if (flag && !EditorUtility.DisplayDialog("Confirm working offline", "Working offline and making changes to your assets means that you will have to manually integrate changes back into version control using your standard version control client before you stop working offline in Unity. Make sure you know what you are doing.", "Work offline", "Cancel"))
                        {
                            flag = false;
                        }
                        EditorUserSettings.WorkOffline = flag;
                        EditorApplication.RequestRepaintAllViews();
                    }
                }
                if (Provider.hasCheckoutSupport)
                {
                    EditorUserSettings.showFailedCheckout = EditorGUILayout.Toggle("Show failed checkouts", EditorUserSettings.showFailedCheckout, new GUILayoutOption[0]);
                }
                GUI.enabled = enabled;
                EditorUserSettings.semanticMergeMode = (SemanticMergeMode)EditorGUILayout.Popup("Smart merge", (int)EditorUserSettings.semanticMergeMode, this.semanticMergePopupList, new GUILayoutOption[0]);
                this.DrawOverlayDescriptions();
            }
            GUILayout.Space(10f);
            GUILayout.Label("WWW Security Emulation", EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorSettings.webSecurityEmulationEnabled = EditorGUILayout.Toggle("Enable Webplayer Security Emulation", EditorSettings.webSecurityEmulationEnabled, new GUILayoutOption[0]);
            string text2 = EditorGUILayout.TextField("Host URL", EditorSettings.webSecurityEmulationHostUrl, new GUILayoutOption[0]);

            if (text2 != EditorSettings.webSecurityEmulationHostUrl)
            {
                EditorSettings.webSecurityEmulationHostUrl = text2;
            }
            GUILayout.Space(10f);
            GUI.enabled = true;
            GUILayout.Label("Asset Serialization", EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUI.enabled = enabled;
            content     = new GUIContent(this.serializationPopupList[(int)EditorSettings.serializationMode].content);
            rect        = GUILayoutUtility.GetRect(content, EditorStyles.popup);
            rect        = EditorGUI.PrefixLabel(rect, 0, new GUIContent("Mode"));
            if (EditorGUI.ButtonMouseDown(rect, content, FocusType.Passive, EditorStyles.popup))
            {
                this.DoPopup(rect, this.serializationPopupList, (int)EditorSettings.serializationMode, new GenericMenu.MenuFunction2(this.SetAssetSerializationMode));
            }
            GUILayout.Space(10f);
            GUI.enabled = true;
            GUILayout.Label("Default Behavior Mode", EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUI.enabled = enabled;
            int num4 = Mathf.Clamp((int)EditorSettings.defaultBehaviorMode, 0, this.behaviorPopupList.Length - 1);

            content = new GUIContent(this.behaviorPopupList[num4].content);
            rect    = GUILayoutUtility.GetRect(content, EditorStyles.popup);
            rect    = EditorGUI.PrefixLabel(rect, 0, new GUIContent("Mode"));
            if (EditorGUI.ButtonMouseDown(rect, content, FocusType.Passive, EditorStyles.popup))
            {
                this.DoPopup(rect, this.behaviorPopupList, num4, new GenericMenu.MenuFunction2(this.SetDefaultBehaviorMode));
            }
            GUILayout.Space(10f);
            GUI.enabled = true;
            GUILayout.Label("Sprite Packer", EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUI.enabled = enabled;
            num4        = Mathf.Clamp((int)EditorSettings.spritePackerMode, 0, this.spritePackerPopupList.Length - 1);
            content     = new GUIContent(this.spritePackerPopupList[num4].content);
            rect        = GUILayoutUtility.GetRect(content, EditorStyles.popup);
            rect        = EditorGUI.PrefixLabel(rect, 0, new GUIContent("Mode"));
            if (EditorGUI.ButtonMouseDown(rect, content, FocusType.Passive, EditorStyles.popup))
            {
                this.DoPopup(rect, this.spritePackerPopupList, num4, new GenericMenu.MenuFunction2(this.SetSpritePackerMode));
            }
            num4    = Mathf.Clamp(EditorSettings.spritePackerPaddingPower - 1, 0, 2);
            content = new GUIContent(this.spritePackerPaddingPowerPopupList[num4].content);
            rect    = GUILayoutUtility.GetRect(content, EditorStyles.popup);
            rect    = EditorGUI.PrefixLabel(rect, 0, new GUIContent("Padding Power"));
            if (EditorGUI.ButtonMouseDown(rect, content, FocusType.Passive, EditorStyles.popup))
            {
                this.DoPopup(rect, this.spritePackerPaddingPowerPopupList, num4, new GenericMenu.MenuFunction2(this.SetSpritePackerPaddingPower));
            }
            this.DoProjectGenerationSettings();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GUILayout.Space(10);
            GUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins);

            bool collabEnabled = Collab.instance.IsCollabEnabledForCurrentProject();

            using (new EditorGUI.DisabledScope(!collabEnabled))
            {
                GUI.enabled = !collabEnabled;

                ExternalVersionControl selvc = VersionControlSettings.mode;
                CreatePopupMenuVersionControl(Styles.mode.text, vcPopupList, selvc, SetVersionControlSystem);
                GUI.enabled = !collabEnabled;
            }

            if (collabEnabled)
            {
                EditorGUILayout.HelpBox("Version Control not available when using Collaboration feature.",
                                        MessageType.Warning);
            }

            GUI.enabled = true;
            ConfigField[] configFields = null;

            var versionControlSystemHasGUI = VersionControlSystemHasGUI();
            var vco = versionControlSystemHasGUI ? VersionControlManager.activeVersionControlObject : null;

            if (vco != null)
            {
                vco.GetExtension <ISettingsInspectorExtension>()?.OnInspectorGUI();
            }
            else if (versionControlSystemHasGUI)
            {
                bool hasRequiredFields = false;

                if (VersionControlSettings.mode == ExternalVersionControl.Generic ||
                    VersionControlSettings.mode == ExternalVersionControl.Disabled)
                {
                    // no specific UI for these VCS types
                }
                else
                {
                    configFields = Provider.GetActiveConfigFields();

                    hasRequiredFields = true;

                    foreach (ConfigField field in configFields)
                    {
                        string newVal;
                        string oldVal = EditorUserSettings.GetConfigValue(field.name);
                        if (field.isPassword)
                        {
                            newVal = EditorGUILayout.PasswordField(GUIContent.Temp(field.label, field.description),
                                                                   oldVal);
                            if (newVal != oldVal)
                            {
                                EditorUserSettings.SetPrivateConfigValue(field.name, newVal);
                            }
                        }
                        else
                        {
                            var recentValues = GetVCConfigFieldRecentValues(field.name);
                            newVal = EditorGUILayout.TextFieldDropDown(GUIContent.Temp(field.label, field.description),
                                                                       oldVal, recentValues);
                            if (newVal != oldVal)
                            {
                                EditorUserSettings.SetConfigValue(field.name, newVal);
                            }
                        }

                        if (field.isRequired && string.IsNullOrEmpty(newVal))
                        {
                            hasRequiredFields = false;
                        }
                    }
                }

                // Log level popup
                string logLevel = EditorUserSettings.GetConfigValue("vcSharedLogLevel");
                int    idx      = System.Array.FindIndex(logLevelPopupList, (item) => item.ToLower() == logLevel);
                if (idx == -1)
                {
                    logLevel = "notice";
                    idx      = System.Array.FindIndex(logLevelPopupList, (item) => item.ToLower() == logLevel);
                    if (idx == -1)
                    {
                        idx = 0;
                    }

                    logLevel = logLevelPopupList[idx];
                    EditorUserSettings.SetConfigValue("vcSharedLogLevel", logLevel);
                }

                int newIdx = EditorGUILayout.Popup(Styles.logLevel, idx, logLevelPopupList);
                if (newIdx != idx)
                {
                    EditorUserSettings.SetConfigValue("vcSharedLogLevel", logLevelPopupList[newIdx].ToLower());
                }

                if (Provider.onlineState == OnlineState.Offline)
                {
                    var text = "Not Connected. " + (Provider.offlineReason ?? "");
                    EditorGUILayout.HelpBox(text, MessageType.Error);
                }
                else if (Provider.onlineState == OnlineState.Updating)
                {
                    var text = "Connecting...";
                    EditorGUILayout.HelpBox(text, MessageType.Info);
                }
                else if (EditorUserSettings.WorkOffline)
                {
                    var text =
                        "Working Offline. Manually integrate your changes using a version control client, and uncheck 'Work Offline' setting below to get back to regular state.";
                    EditorGUILayout.HelpBox(text, MessageType.Warning);
                }
                else if (Provider.onlineState == OnlineState.Online)
                {
                    var text = "Connected";
                    EditorGUILayout.HelpBox(text, MessageType.Info);
                }

                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUI.enabled = hasRequiredFields && Provider.onlineState != OnlineState.Updating;
                if (GUILayout.Button(
                        Provider.onlineState != OnlineState.Offline ? Styles.vcsReconnect : Styles.vcsConnect,
                        EditorStyles.miniButton))
                {
                    m_NeedToSaveValuesOnConnect = true;
                    Provider.UpdateSettings();
                }

                GUILayout.EndHorizontal();

                if (m_NeedToSaveValuesOnConnect && Provider.onlineState == OnlineState.Online)
                {
                    // save connection field settings if we got online with them successfully
                    m_NeedToSaveValuesOnConnect = false;
                    UpdateVCConfigFieldRecentValues(configFields);
                }

                if (Provider.requiresNetwork)
                {
                    bool workOfflineNew =
                        EditorGUILayout.Toggle(Styles.workOffline,
                                               EditorUserSettings.WorkOffline); // Enabled has a slightly different behaviour
                    if (workOfflineNew != EditorUserSettings.WorkOffline)
                    {
                        // On toggling on show a warning
                        if (workOfflineNew && !EditorUtility.DisplayDialog("Confirm working offline",
                                                                           "Working offline and making changes to your assets means that you will have to manually integrate changes back into version control using your standard version control client before you stop working offline in Unity. Make sure you know what you are doing.",
                                                                           "Work offline", "Cancel"))
                        {
                            workOfflineNew = false; // User cancelled working offline
                        }

                        EditorUserSettings.WorkOffline = workOfflineNew;
                        EditorApplication.RequestRepaintAllViews();
                    }
                }

                EditorUserSettings.AutomaticAdd =
                    EditorGUILayout.Toggle(Styles.automaticAdd, EditorUserSettings.AutomaticAdd);

                if (Provider.requiresNetwork)
                {
                    EditorUserSettings.allowAsyncStatusUpdate = EditorGUILayout.Toggle(Styles.allowAsyncUpdate,
                                                                                       EditorUserSettings.allowAsyncStatusUpdate);
                }

                if (Provider.hasCheckoutSupport)
                {
                    EditorUserSettings.showFailedCheckout = EditorGUILayout.Toggle(Styles.showFailedCheckouts,
                                                                                   EditorUserSettings.showFailedCheckout);
                    EditorUserSettings.overwriteFailedCheckoutAssets = EditorGUILayout.Toggle(
                        Styles.overwriteFailedCheckoutAssets, EditorUserSettings.overwriteFailedCheckoutAssets);
                }

                EditorUserSettings.semanticMergeMode = (SemanticMergeMode)EditorGUILayout.Popup(Styles.smartMerge,
                                                                                                (int)EditorUserSettings.semanticMergeMode, semanticMergePopupList);

                GUILayout.Space(10);
                GUILayout.Label(Styles.overlayIcons);

                EditorGUI.indentLevel++;
                var newProjectOverlayIcons = EditorGUILayout.Toggle(Styles.projectOverlayIcons, EditorUserSettings.overlayIcons);
                if (newProjectOverlayIcons != EditorUserSettings.overlayIcons)
                {
                    EditorUserSettings.overlayIcons = newProjectOverlayIcons;
                    EditorApplication.RequestRepaintAllViews();
                }

                var newHierarchyOverlayIcons = EditorGUILayout.Toggle(Styles.hierarchyOverlayIcons, EditorUserSettings.hierarchyOverlayIcons);
                if (newHierarchyOverlayIcons != EditorUserSettings.hierarchyOverlayIcons)
                {
                    EditorUserSettings.hierarchyOverlayIcons = newHierarchyOverlayIcons;
                    EditorApplication.RequestRepaintAllViews();
                }

                var newOtherOverlayIcons = EditorGUILayout.Toggle(Styles.otherOverlayIcons, EditorUserSettings.otherOverlayIcons);
                if (newOtherOverlayIcons != EditorUserSettings.otherOverlayIcons)
                {
                    EditorUserSettings.otherOverlayIcons = newOtherOverlayIcons;
                    EditorApplication.RequestRepaintAllViews();
                }
                EditorGUI.indentLevel--;
                GUILayout.Space(10);

                GUI.enabled = true;
                if (newProjectOverlayIcons || newHierarchyOverlayIcons || newOtherOverlayIcons)
                {
                    DrawOverlayDescriptions();
                }
            }
            GUILayout.EndVertical();
        }