Exemple #1
0
        public static bool drawGUI(string _strAssetPath, bool _bVertical = true)
        {
            VCUtility.RequestStatus(_strAssetPath, VCSettings.HierarchyReflectionMode);
            var vcStatus = VCCommands.Instance.GetAssetStatus(_strAssetPath);

            buttonStyle = new GUIStyle(EditorStyles.miniButton)
            {
                margin = new RectOffset(0, 0, 0, 0), fixedWidth = 80
            };

            backgroundGuiStyle           = VCGUIControls.GetVCBox(vcStatus);
            backgroundGuiStyle.padding   = new RectOffset(4, 8, 1, 1);
            backgroundGuiStyle.margin    = new RectOffset(1, 1, 1, 1);
            backgroundGuiStyle.border    = new RectOffset(1, 1, 1, 1);
            backgroundGuiStyle.alignment = TextAnchor.MiddleCenter;

            GUILayout.TextField(AssetStatusUtils.GetLockStatusMessage(vcStatus), backgroundGuiStyle);

            if (_bVertical)
            {
                using (GUILayoutHelper.Vertical())
                {
                    return(drawButtons(_strAssetPath));
                }
            }
            else
            {
                using (GUILayoutHelper.Horizontal())
                {
                    return(drawButtons(_strAssetPath));
                }
            }
        }
Exemple #2
0
        private void OnGUI()
        {
            using (GUILayoutHelper.Vertical())
            {
                username = EditorGUILayout.TextField("Username", username);
                Color passwordColor = Color.grey;
                if (hasVerified && !success)
                {
                    passwordColor = Color.red;
                }
                if (hasVerified && success)
                {
                    passwordColor = Color.green;
                }
                using (GUILayoutHelper.BackgroundColor(passwordColor))
                {
                    password = EditorGUILayout.TextField("Password", password);
                }

                allowCacheCredentials = GUILayout.Toggle(allowCacheCredentials, new GUIContent("Allow Credentials to be cached"));

                using (GUILayoutHelper.Horizontal())
                {
                    if (GUILayout.Button("Cancel"))
                    {
                        Close();
                    }
                    if (!success)
                    {
                        if (GUILayout.Button("Verify"))
                        {
                            hasVerified = true;
                            success     = VCCommands.Instance.SetUserCredentials(username, password, allowCacheCredentials);
                        }
                    }
                    else
                    {
                        if (GUILayout.Button("Close"))
                        {
                            Close();
                        }
                    }
                }
            }
        }
Exemple #3
0
        public void DrawGUI()
        {
            scrollViewVector = EditorGUILayout.BeginScrollView(scrollViewVector, false, false);
            using (GUILayoutHelper.Horizontal())
            {
                GUILayout.Label("GUI Settings", EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();
                GUILayout.Label(new GUIContent("Inspector Lock", "Version Control allowed to lock Inspector GUI for items not " + Terminology.getlock), EditorStyles.boldLabel);
                GUILayout.Space(92);
            }
            using (GUILayoutHelper.VerticalIdented(14))
            {
                using (GUILayoutHelper.Horizontal())
                {
                    VCSettings.SceneviewGUI = GUILayout.Toggle(VCSettings.SceneviewGUI, new GUIContent("Scene GUI", "Show Version Control GUI in Scene view\nDefault: On"));
                    using (GUILayoutHelper.Enabled(VCSettings.SceneviewGUI, true))
                    {
                        VCSettings.LockScenes = GUILayout.Toggle(VCSettings.SceneviewGUI && VCSettings.LockScenes, new GUIContent("GUI Lock", "Version Control allowed to lock Inspector GUI for scenes which are not " + Terminology.getlock + "\nDefault: On"), GUILayout.ExpandWidth(true), GUILayout.Width(300));
                    }
                }
                using (GUILayoutHelper.Horizontal())
                {
                    VCSettings.PrefabGUI = GUILayout.Toggle(VCSettings.PrefabGUI, new GUIContent("Prefab GUI", "Show Version Control GUI for prefabs in hierarchy view\nDefault: On"));
                    using (GUILayoutHelper.Enabled(VCSettings.PrefabGUI, true))
                    {
                        VCSettings.LockPrefabs = GUILayout.Toggle(VCSettings.LockPrefabs && VCSettings.PrefabGUI, new GUIContent("GUI Lock", "Version Control allowed to lock Inspector GUI for prefabs which are not " + Terminology.getlock + "\nDefault: Off"), GUILayout.ExpandWidth(true), GUILayout.Width(300));
                    }
                }
                using (GUILayoutHelper.Horizontal())
                {
                    VCSettings.MaterialGUI = GUILayout.Toggle(VCSettings.MaterialGUI, new GUIContent("Material GUI", "Show Version Control GUI for material interaction on the Renderer inspector\nDefault: On"));
                    using (GUILayoutHelper.Enabled(VCSettings.MaterialGUI, true))
                    {
                        VCSettings.LockMaterials = GUILayout.Toggle(VCSettings.MaterialGUI && VCSettings.LockMaterials, new GUIContent("GUI Lock", "Version Control allowed to lock Inspector GUI for materials which are not " + Terminology.getlock + "\nDefault: On"), GUILayout.ExpandWidth(true), GUILayout.Width(300));
                    }
                }
            }

            using (GUILayoutHelper.VerticalIdented(14))
            {
                using (GUILayoutHelper.Horizontal())
                {
                    filterSettingsOpen = GUILayout.Toggle(filterSettingsOpen, new GUIContent("Path Filters", "The Inspector GUI locks will only be active on assetpaths that contains the filter below"), EditorStyles.foldout);
                }
                if (filterSettingsOpen)
                {
                    using (GUILayoutHelper.VerticalIdented(14))
                    {
                        using (GUILayoutHelper.Horizontal())
                        {
                            GUILayout.Label(new GUIContent("Scenes", "The Inspector GUI locks will only be active on assetpaths that contains the following filter.\neg. assets/scenes/"));
                            VCSettings.LockScenesFilter = EditorGUILayout.TextField(VCSettings.LockScenesFilter, GUILayout.ExpandWidth(true), GUILayout.Width(300));
                        }
                        using (GUILayoutHelper.Horizontal())
                        {
                            GUILayout.Label(new GUIContent("Prefabs", "The Inspector GUI locks will only be active on assetpaths that contains the following filter.\neg. assets/prefabs/"));
                            VCSettings.LockPrefabsFilter = EditorGUILayout.TextField(VCSettings.LockPrefabsFilter, GUILayout.ExpandWidth(true), GUILayout.Width(300));
                        }
                        using (GUILayoutHelper.Horizontal())
                        {
                            GUILayout.Label(new GUIContent("Materials", "The Inspector GUI locks will only be active on assetpaths that contains the following filter.\neg. assets/materials/"));
                            VCSettings.LockMaterialsFilter = EditorGUILayout.TextField(VCSettings.LockMaterialsFilter, GUILayout.ExpandWidth(true), GUILayout.Width(300));
                        }
                    }
                }
            }

            using (GUILayoutHelper.Horizontal())
            {
                GUILayout.Label("Reflection Level", EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();
                GUILayout.Label(new GUIContent("Reflection Level", "Select Remote to retrieve extra information from the server in an exchange for speed."), EditorStyles.boldLabel);
                GUILayout.Space(85);
            }
            using (GUILayoutHelper.VerticalIdented(14))
            {
                using (GUILayoutHelper.Horizontal())
                {
                    VCSettings.HierarchyIcons          = GUILayout.Toggle(VCSettings.HierarchyIcons, new GUIContent("Hierachy Icons", "Show Version Control controls in hierachy view\nDefault: On"));
                    VCSettings.HierarchyReflectionMode = (VCSettings.EReflectionLevel)EditorGUILayout.EnumPopup(VCSettings.HierarchyReflectionMode, GUILayout.ExpandWidth(true), GUILayout.Width(300));
                }
                using (GUILayoutHelper.Horizontal())
                {
                    VCSettings.ProjectIcons          = GUILayout.Toggle(VCSettings.ProjectIcons, new GUIContent("Project Icons", "Show Version Control controls in project view\nDefault: On"));
                    VCSettings.ProjectReflectionMode = (VCSettings.EReflectionLevel)EditorGUILayout.EnumPopup(VCSettings.ProjectReflectionMode, GUILayout.ExpandWidth(true), GUILayout.Width(300));
                }
            }

            GUILayout.Label("Commit Window", EditorStyles.boldLabel);
            using (GUILayoutHelper.VerticalIdented(14))
            {
                VCSettings.AutoCloseAfterSuccess       = GUILayout.Toggle(VCSettings.AutoCloseAfterSuccess, new GUIContent("Auto Close", "Auto close commit window on successful commit\nDefault: Off"));
                VCSettings.IncludeDepedenciesAsDefault = GUILayout.Toggle(VCSettings.IncludeDepedenciesAsDefault, new GUIContent("Select Dependencies", "Should dependencies automatically be selected when opening the commit window\nDefault: On"));
                VCSettings.SelectiveCommit             = GUILayout.Toggle(VCSettings.SelectiveCommit, new GUIContent("Selective Commit", "Add an additional selection column which is used to more explicitly select which files to commit\nDefault: Off"));
                VCSettings.NonRecursiveAdd             = GUILayout.Toggle(VCSettings.NonRecursiveAdd, new GUIContent("Non-Recursive Add", "Add an additional selection column which is used to more explicitly select which files to commit\nDefault: Off"));
                VCSettings.RequireLockBeforeCommit     = GUILayout.Toggle(VCSettings.RequireLockBeforeCommit, new GUIContent("Require " + Terminology.getlock + " on commit", "It will be enforced that all non-mergable files are " + Terminology.getlock + " before commit\nDefault: Off"));
            }
            GUILayout.Label("Debug", EditorStyles.boldLabel);
            using (GUILayoutHelper.VerticalIdented(14))
            {
                using (GUILayoutHelper.Horizontal())
                {
                    VCSettings.BugReport     = GUILayout.Toggle(VCSettings.BugReport, new GUIContent("Bug Reports", "Send a bug report to Fogbugz when an error occurs\nDefault: On"));
                    VCSettings.BugReportMode = (VCSettings.EBugReportMode)EditorGUILayout.EnumPopup(VCSettings.BugReportMode, GUILayout.ExpandWidth(true), GUILayout.Width(300));
                }
                VCSettings.Analytics = GUILayout.Toggle(VCSettings.Analytics, new GUIContent("Analytics", "Allow UVC to send anonymous analytics data with the purpose of improving the quality of UVC\nDefault: On"));
                VCSettings.Logging   = GUILayout.Toggle(VCSettings.Logging, new GUIContent("Logging", "Output logs from Version Control to Unity console\nDefault: Off"));
            }
            GUILayout.Label("Advanced", EditorStyles.boldLabel);
            using (GUILayoutHelper.VerticalIdented(14))
            {
                using (GUILayoutHelper.Horizontal())
                {
                    GUILayout.Label(new GUIContent("How to Move and Rename", "How should file move and renames in project be handled\nDefault: Simple"));
                    VCSettings.HandleFileMove = (VCSettings.EHandleFileMove)EditorGUILayout.EnumPopup(VCSettings.HandleFileMove, GUILayout.ExpandWidth(true), GUILayout.Width(300));
                }
                using (GUILayoutHelper.Horizontal())
                {
                    GUILayout.Label(new GUIContent(string.Format("Who Controls Asset Saves", Terminology.getlock), string.Format("Select {0} to only let Unity save files that are either {1} or {2} \nDefault: {3}", VCSettings.ESaveAssetsStrategy.VersionControl.ToString(), Terminology.allowLocalEdit, Terminology.getlock, VCSettings.ESaveAssetsStrategy.Unity.ToString())));
                    VCSettings.SaveStrategy = (VCSettings.ESaveAssetsStrategy)EditorGUILayout.EnumPopup(VCSettings.SaveStrategy, GUILayout.ExpandWidth(true), GUILayout.Width(300));
                }
                if (clientPath == null)
                {
                    clientPath = VCSettings.ClientPath;
                }
                var textColor = ValidCommandLineClient(clientPath) ? new Color(0.0f, 0.6f, 0.0f) : new Color(0.6f, 0.0f, 0.0f);
                var textStyle = new GUIStyle(EditorStyles.textField)
                {
                    normal = { textColor = textColor }
                };
                using (GUILayoutHelper.Horizontal())
                {
                    GUILayout.Label(new GUIContent("Environment Path", "Specify the path to a command line client. eg MacPorts SVN : /opt/local/bin/\nDefault: <Empty>"));
                    clientPath = EditorGUILayout.TextField(clientPath, textStyle, GUILayout.ExpandWidth(true), GUILayout.Width(300)).Trim(new[] { ' ' }).Replace('\\', '/');
                }
                if (ValidCommandLineClient(clientPath))
                {
                    VCSettings.ClientPath = clientPath;
                }
                using (GUILayoutHelper.Horizontal())
                {
                    GUILayout.Label(new GUIContent("Version Control System", "The selected Version Control will be used if a valid local copy can be found"));
                    VCSettings.VersionControlBackend = (VCSettings.EVersionControlBackend)EditorGUILayout.EnumPopup(VCSettings.VersionControlBackend, GUILayout.ExpandWidth(true), GUILayout.Width(300));
                }
            }
            GUILayout.Label("Other", EditorStyles.boldLabel);
            using (GUILayoutHelper.VerticalIdented(14))
            {
                using (GUILayoutHelper.Horizontal())
                {
                    var textColor = bValidHiddenPathsString(VCSettings.strHiddenFilePaths) ? new Color(0.0f, 0.6f, 0.0f) : new Color(0.6f, 0.0f, 0.0f);
                    var textStyle = new GUIStyle(EditorStyles.textField)
                    {
                        normal = { textColor = textColor }
                    };
                    GUILayout.Label(new GUIContent("Hidden paths", "Specify the paths to a hide items from the overview. Seperate paths with a semicolon."));
                    VCSettings.strHiddenFilePaths = EditorGUILayout.TextField(VCSettings.strHiddenFilePaths, textStyle, GUILayout.ExpandWidth(true), GUILayout.Width(300)).Trim(new[] { ' ' }).Replace('\\', '/');
                }

                using (GUILayoutHelper.Horizontal())
                {
                    var textColor = bValidAutocompleteString(VCSettings.strCommitAutoComplete) ? new Color(0.0f, 0.6f, 0.0f) : new Color(0.6f, 0.0f, 0.0f);
                    var textStyle = new GUIStyle(EditorStyles.textField)
                    {
                        normal = { textColor = textColor }
                    };
                    GUILayout.Label(new GUIContent("Commit autocompletes", "Specify autocomplete suggestions for commit message. Format text->suggestion. Seperate suggestions with a semicolon."));
                    VCSettings.strCommitAutoComplete = EditorGUILayout.TextField(VCSettings.strCommitAutoComplete, textStyle, GUILayout.ExpandWidth(true), GUILayout.Width(300)).Trim(new[] { ' ' }).Replace('\\', '/');
                }
            }
            EditorGUILayout.EndScrollView();
        }