Пример #1
0
        public static IEnumerator GetRequestToken(string consumerKey, string consumerSecret, RequestTokenCallback callback)
        {
            WWW web = WWWRequestToken(consumerKey, consumerSecret);

            yield return(web);

            if (!string.IsNullOrEmpty(web.error))
            {
                Debug.Log(string.Format("GetRequestToken - failed. error : {0}", web.error));
                callback(false, null);
            }
            else
            {
                RequestTokenResponse response = new RequestTokenResponse
                {
                    Token       = Regex.Match(web.text, @"oauth_token=([^&]+)").Groups[1].Value,
                    TokenSecret = Regex.Match(web.text, @"oauth_token_secret=([^&]+)").Groups[1].Value,
                };

                if (!string.IsNullOrEmpty(response.Token) &&
                    !string.IsNullOrEmpty(response.TokenSecret))
                {
                    callback(true, response);
                }
                else
                {
                    Debug.Log(string.Format("GetRequestToken - failed. response : {0}", web.text));

                    callback(false, null);
                }
            }
        }
Пример #2
0
        public static IEnumerator GetRequestToken(string consumerKey, string consumerSecret, RequestTokenCallback callback)
        {

            WWW web = WWWRequestToken(consumerKey, consumerSecret);

            yield return web;

            if (!string.IsNullOrEmpty(web.error))
            {
                Debug.Log(string.Format("GetRequestToken - failed. error : {0}", web.error));
                callback(false, null);
            }
            else
            {
                RequestTokenResponse response = new RequestTokenResponse
                {
                    Token = Regex.Match(web.text, @"oauth_token=([^&]+)").Groups[1].Value,
                    TokenSecret = Regex.Match(web.text, @"oauth_token_secret=([^&]+)").Groups[1].Value,
                };

                if (!string.IsNullOrEmpty(response.Token) &&
                    !string.IsNullOrEmpty(response.TokenSecret))
                {
                    callback(true, response);
                }
                else
                {
                    Debug.Log(string.Format("GetRequestToken - failed. response : {0}", web.text));

                    callback(false, null);
                }
            }
        }
Пример #3
0
 void OnRequestTokenCallback(bool success, Twitter.RequestTokenResponse response)
 {
     if (success)
     {
         // 認証要求
         Request = response;
         API.OpenAuthorizationPage(response.Token);
     }
 }
Пример #4
0
 public void OnSuccess_GetTwitterPIN(bool success, Twitter.RequestTokenResponse response)
 {
     if (success)
     {
         m_RequestTokenResponse = response;
         Twitter.API.OpenAuthorizationPage(response.Token);
     }
     else
     {
         Debug.Log("OnRequestTokenCallback - failed.");
     }
 }
Пример #5
0
    //以下、コールバック。各処理が成功したかを返します(編集不可)
    void OnRequestTokenCallback(bool success, Twitter.RequestTokenResponse response)
    {
        if (success)
        {
            Debug.Log("認証コード発行画面を開きました。PIN入力欄に認証コードを書き、送信してください");
            m_RequestTokenResponse = response;

            Twitter.API.OpenAuthorizationPage(response.Token);
        }
        else
        {
            Debug.Log("認証コード発行画面を開けませんでした。時間をおいてもう一度お試しください");
        }
    }
Пример #6
0
    void OnRequestTokenCallback(bool success, Twitter.RequestTokenResponse response)
    {
//		if (success)
//		{
//			string log = "OnRequestTokenCallback - succeeded";
//			log += "\n    Token : " + response.Token;
//			log += "\n    TokenSecret : " + response.TokenSecret;
//			print(log);
//
//			m_RequestTokenResponse = response;
//
//			Twitter.API.OpenAuthorizationPage(response.Token);
//		}
//		else
//		{
//			print("OnRequestTokenCallback - failed.");
//		}
    }
Пример #7
0
    void OnRequestTokenCallback(bool success, Twitter.RequestTokenResponse response)
    {
        if (success)
        {
            string log = "OnRequestTokenCallback - succeeded";
            log += "\n    Token : " + response.Token;
            log += "\n    TokenSecret : " + response.TokenSecret;
            print(log);

            m_RequestTokenResponse = response;

            Twitter.API.OpenAuthorizationPage(response.Token);
        }
        else
        {
            print("OnRequestTokenCallback - failed.");
        }
    }
Пример #8
0
    void OnRequestTokenCallback(bool success, Twitter.RequestTokenResponse response)
    {
        if (success)
        {
            string log = "OnRequestTokenCallback - succeeded";
            log += "\n    Token : " + response.Token;
            log += "\n    TokenSecret : " + response.TokenSecret;
            Debug.Log(log);

            requestTokenResponse = response;

            Twitter.API.OpenAuthorizationPage(response.Token);
            this.connectTwitterMenu.SetActive(false);
            this.enterPinMenu.SetActive(true);
        }
        else
        {
            Debug.Log("OnRequestTokenCallback - failed.");
        }
    }
Пример #9
0
    void OnRequestTokenCallback(bool success, Twitter.RequestTokenResponse response)
    {
        if (success)
        {
            string log = "OnRequestTokenCallback - succeeded";
            log += "\n    Token : " + response.Token;
            log += "\n    TokenSecret : " + response.TokenSecret;
            print(log);

            m_RequestTokenResponse = response;

            Twitter.API.OpenAuthorizationPage(response.Token);
        }
        else
        {
            print("OnRequestTokenCallback - failed.");
        }
    }
Пример #10
0
 public void OnSuccess_GetTwitterPIN(bool success, Twitter.RequestTokenResponse response)
 {
     if (success)
     {
         m_RequestTokenResponse = response;
         Twitter.API.OpenAuthorizationPage(response.Token);
     }
     else
     {
         Debug.Log("OnRequestTokenCallback - failed.");
     }
 }
Пример #11
0
        public static IEnumerator GetRequestToken(string consumerKey, string consumerSecret, twitterButton caller)
        {
            WWW web = WWWRequestToken(consumerKey, consumerSecret);

            yield return web;

            if (!string.IsNullOrEmpty(web.error))
            {
                Debug.Log(string.Format("GetRequestToken - failed. error : {0}", web.error));
            }
            else
            {
                RequestTokenResponse response = new RequestTokenResponse
                {
                    Token = Regex.Match(web.text, @"oauth_token=([^&]+)").Groups[1].Value,
                    TokenSecret = Regex.Match(web.text, @"oauth_token_secret=([^&]+)").Groups[1].Value,
                };

                if (!string.IsNullOrEmpty(response.Token) &&
                    !string.IsNullOrEmpty(response.TokenSecret))
                {
                    Twitter.API.OpenAuthorizationPage(response.Token);
                    caller.m_RequestTokenResponse = response;
                }
                else
                {
                    Debug.Log(string.Format("GetRequestToken - failed. response : {0}", web.text));
                }
            }
        }