Beispiel #1
0
 private void OnDisable()
 {
     BugReporterPlugin.SaveSettings();
     SceneView.onSceneGUIDelegate -= SceneGUI;
     SceneView.RepaintAll();
 }
Beispiel #2
0
    private void OnGUI()
    {
        if (BugReporterPlugin.settings.currentBackendType == "")
        {
            string[] backendNames = BugReporterPlugin.GetBackendNameList();
            int      selected     = EditorGUILayout.Popup("Backend", -1, backendNames);
            if (selected != -1)
            {
                BugReporterPlugin.SetupBackend(backendNames[selected]);
                BugReporterPlugin.SaveSettings();
            }
        }
        else
        {
            var backendSetting = BugReporterPlugin.settings.GetBackendSettings(BugReporterPlugin.backend.GetName());

            if (backendSetting.projectPath == "")
            {
                EditorGUI.BeginChangeCheck();
                string newPath =
                    EditorGUILayout.DelayedTextField("Enter project path", backendSetting.projectPath);
                if (EditorGUI.EndChangeCheck())
                {
                    BugReporterPlugin.SetProjectPath(newPath);
                }
            }
            else
            {
                if (GUILayout.Button("Change project path"))
                {
                    backendSetting.projectPath = "";
                }

                EditorGUILayout.PrefixLabel("Filters");

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Assignee");
                if (EditorGUILayout.DropdownButton(new GUIContent(_filter.user != null ? _filter.user.name : "Anyone"), FocusType.Keyboard))
                {
                    GenericMenu menu = new GenericMenu();

                    menu.AddItem(new GUIContent("Anyone"), _filter.user == null, ToggleUserFilter, null);

                    var users = BugReporterPlugin.users;
                    foreach (var user in users)
                    {
                        menu.AddItem(new GUIContent(user.name), _filter.user == user, ToggleUserFilter, user);
                    }

                    menu.ShowAsContext();
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Labels");
                if (EditorGUILayout.DropdownButton(new GUIContent(_filter.labelCommaString), FocusType.Keyboard))
                {
                    GenericMenu menu = new GenericMenu();

                    var labels = BugReporterPlugin.labels;
                    foreach (var label in labels)
                    {
                        menu.AddItem(new GUIContent(label), ArrayUtility.Contains(_filter.labels, label), ToggleLabelFilter, label);
                    }

                    menu.ShowAsContext();
                }
                EditorGUILayout.EndHorizontal();

                if (BugReporterPlugin.backend.CanRequest() && GUILayout.Button("Referesh issues"))
                {
                    BugReporterPlugin.RequestIssues(ReceivedIssues, _filter);
                }

                if (BugReporterPlugin.issueRequestState == BugReporterPlugin.IssueRequestState.Requesting)
                {
                    EditorGUILayout.LabelField("LOADING ISSUES...");
                }

                if (Event.current.type == EventType.Repaint)
                {
                    _lastRect = GUILayoutUtility.GetLastRect();
                }

                float y = _lastRect.y + _lastRect.height;
                Rect  r = new Rect(0, y, position.width, position.height - y);
                _treeView.OnGUI(r);
            }
        }
    }