Пример #1
0
        private static SettingsProvider Create()
        {
            var provider = new BacklogAPISettings(Path, SettingsScope.Project)
            {
                // 検索対象のキーワード登録(SerializedObjectから自動で取得)
                keywords = GetSearchKeywordsFromSerializedObject(BacklogAPIData.GetSerializedObject())
            };

            return(provider);
        }
Пример #2
0
        /// <summary>
        /// プロジェクト情報の取得
        /// </summary>
        public async void LoadProjectInfo(Action onSuccess = null)
        {
            APIData = BacklogAPIData.Load();

            // エディタが再生中かつ一時停止中だと認証時にawaitで止まってしまうので、キャッシュがない時は一時停止を解除する
            bool isPaused = EditorApplication.isPaused;

            if (EditorApplication.isPlaying)
            {
                bool isCached = File.Exists($"{Application.dataPath}/../{APIData.CacheFileName}");
                if (!isCached)
                {
                    EditorApplication.isPaused = false;
                }
            }

            // 認証
            var client = new BacklogClient(APIData.SpaceKey, APIData.Domain);
            await client.AuthorizeAsync(new OAuth2App()
            {
                ClientId             = APIData.ClientId,
                ClientSecret         = APIData.ClientSecretId,
                RedirectUri          = APIData.RedirectURI,
                CredentialsCachePath = APIData.CacheFileName,
            });

            EditorApplication.isPaused = isPaused;

            // 各種データ取得
            Space            = client.GetSpaceAsync().Result.Content;
            Project          = client.GetProjectAsync(APIData.ProjectKey).Result.Content;
            Data.TicketTypes = Project.GetTicketTypesAsync().Result.Content;
            Data.Priorities  = client.GetPriorityTypesAsync().Result.Content;
            Data.Categories  = Project.GetCategoriesAsync().Result.Content;
            Data.Milestones  = Project.GetMilestonesAsync().Result.Content;
            Data.Users       = Project.GetUsersAsync().Result.Content;

            onSuccess?.Invoke();
        }
Пример #3
0
        public override void OnGUI(string searchContext)
        {
            using (new GUIScope())
            {
                // プロパティの表示
                var iterator = so.GetIterator();
                EditorGUI.BeginChangeCheck();
                while (iterator.NextVisible(true))
                {
                    bool isScript = iterator.name.Equals("m_Script");
                    if (isScript)
                    {
                        GUI.enabled = false;
                    }

                    EditorGUILayout.PropertyField(iterator);

                    if (isScript)
                    {
                        GUI.enabled = true;
                    }
                }
                if (EditorGUI.EndChangeCheck())
                {
                    so.ApplyModifiedProperties();
                }

                EditorGUILayout.Space();

                // Backlog Developerサイトを開く
                if (GUILayout.Button("Backlogアプリケーション登録ページ"))
                {
                    Application.OpenURL("https://backlog.com/developer/applications/");
                }

                // データ検証用ボタン
                using (new EditorGUILayout.HorizontalScope())
                {
                    if (GUILayout.Button("スペースを開く"))
                    {
                        var data = BacklogAPIData.Load();
                        Application.OpenURL($"https://{data.SpaceKey}.{data.Domain}/projects/{data.ProjectKey}");
                    }
                    if (GUILayout.Button("認証テスト"))
                    {
                        var backlogAPI = new BacklogAPI();
                        try
                        {
                            backlogAPI.LoadProjectInfo(() =>
                            {
                                EditorUtility.DisplayDialog("認証成功", "BacklogAPIの認証に成功しました。", "OK");
                            });
                        }
                        catch (System.Exception e)
                        {
                            Debug.LogException(e);
                        }
                    }
                }
            }
        }
Пример #4
0
 public override void OnActivate(string searchContext, VisualElement rootElement)
 {
     // 設定ファイル取得
     so = BacklogAPIData.GetSerializedObject();
 }