private void OnGUI()
        {
            using (GUILayoutHelper.Vertical())
            {
                email        = EditorGUILayout.TextField("E-Mail", email);
                bugTitle     = EditorGUILayout.TextField("Title", bugTitle);
                statusScroll = EditorGUILayout.BeginScrollView(statusScroll, false, false);
                description  = GUILayout.TextArea(description, GUILayout.ExpandHeight(true));
                EditorGUILayout.EndScrollView();

                if (GUILayout.Button("Send"))
                {
                    bool sendBug = true;
                    if (string.IsNullOrEmpty(email))
                    {
                        email = "no@email";
                    }
                    if (sendBug && string.IsNullOrEmpty(bugTitle))
                    {
                        EditorUtility.DisplayDialog("Need Title", "You need to give the bug a title", "OK");
                        sendBug = false;
                    }
                    if (sendBug && (string.IsNullOrEmpty(description) || description == defaultDescription))
                    {
                        EditorUtility.DisplayDialog("Need Description", "You need to give the bug a description", "OK");
                        sendBug = false;
                    }
                    if (sendBug)
                    {
                        FogbugzUtilities.SubmitUserBug(bugTitle, description, email);
                        Close();
                    }
                }
            }
        }
Beispiel #2
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));
                }
            }
        }
Beispiel #3
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();
                        }
                    }
                }
            }
        }
Beispiel #4
0
        static void SceneViewUpdate(SceneView sceneView)
        {
            if (!shouldDraw)
            {
                return;
            }

            string assetPath = SceneManagerUtilities.GetCurrentScenePath();

            VCUtility.RequestStatus(assetPath, VCSettings.HierarchyReflectionMode);

            var vcSceneStatus = VCCommands.Instance.GetAssetStatus(assetPath);

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

            backgroundGuiStyle           = VCGUIControls.GetVCBox(vcSceneStatus);
            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;

            var rect = new Rect(5, 5, 200, 100);

            Handles.BeginGUI();
            GUILayout.BeginArea(new Rect(0, 0, rect.width, rect.height));
            GUILayout.TextField(AssetStatusUtils.GetLockStatusMessage(vcSceneStatus), backgroundGuiStyle);

            int       numberOfButtons = 0;
            const int maxButtons      = 4;

            var validActions = VCGUIControls.GetValidActions(assetPath);

            using (GUILayoutHelper.Vertical())
            {
                using (new PushState <bool>(GUI.enabled, VCCommands.Instance.Ready, v => GUI.enabled = v))
                {
                    if (validActions.showAdd)
                    {
                        numberOfButtons++;
                        if (GUILayout.Button(Terminology.add, buttonStyle))
                        {
                            SceneManagerUtilities.SaveActiveScene();
                            OnNextUpdate.Do(() => VCCommands.Instance.CommitDialog(new[] { SceneManagerUtilities.GetCurrentScenePath() }));
                        }
                    }
                    if (validActions.showOpen)
                    {
                        numberOfButtons++;
                        if (GUILayout.Button(Terminology.getlock, buttonStyle))
                        {
                            VCCommands.Instance.GetLockTask(new[] { SceneManagerUtilities.GetCurrentScenePath() });
                        }
                    }
                    if (validActions.showCommit)
                    {
                        numberOfButtons++;
                        if (GUILayout.Button(Terminology.commit, buttonStyle))
                        {
                            OnNextUpdate.Do(() => VCCommands.Instance.CommitDialog(new[] { SceneManagerUtilities.GetCurrentScenePath() }));
                        }
                    }
                    if (validActions.showRevert)
                    {
                        numberOfButtons++;
                        if (GUILayout.Button(new GUIContent(Terminology.revert, "Shift-click to " + Terminology.revert + " without confirmation"), buttonStyle))
                        {
                            var sceneAssetPath = new[] { SceneManagerUtilities.GetCurrentScenePath() };
                            if (Event.current.shift || VCUtility.VCDialog(Terminology.revert, sceneAssetPath))
                            {
                                SceneManagerUtilities.SaveActiveScene();
                                VCCommands.Instance.Revert(sceneAssetPath);
                                OnNextUpdate.Do(AssetDatabase.Refresh);
                            }
                        }
                    }
                    if (validActions.showOpenLocal)
                    {
                        numberOfButtons++;
                        if (GUILayout.Button(Terminology.allowLocalEdit, buttonStyle))
                        {
                            VCCommands.Instance.AllowLocalEdit(new[] { SceneManagerUtilities.GetCurrentScenePath() });
                        }
                    }
                    if (validActions.showUnlock)
                    {
                        numberOfButtons++;
                        if (GUILayout.Button(Terminology.unlock, buttonStyle))
                        {
                            OnNextUpdate.Do(() => VCCommands.Instance.ReleaseLock(new[] { SceneManagerUtilities.GetCurrentScenePath() }));
                        }
                    }
                    if (validActions.showForceOpen)
                    {
                        numberOfButtons++;
                        if (GUILayout.Button("Force Open", buttonStyle))
                        {
                            OnNextUpdate.Do(() => VCUtility.GetLock(SceneManagerUtilities.GetCurrentScenePath(), OperationMode.Force));
                        }
                    }

                    // bug: Workaround for a bug in Unity to avoid Tools getting stuck when number of GUI elements change while right mouse is down.
                    using (GUILayoutHelper.Enabled(false))
                    {
                        for (int i = numberOfButtons; i <= maxButtons; ++i)
                        {
                            GUI.Button(new Rect(0, 0, 0, 0), "", EditorStyles.label);
                        }
                    }
                }
            }


            GUILayout.EndArea();
            Handles.EndGUI();
        }