예제 #1
0
        private void SetOAuthResultData(Dictionary <string, object> ret, string responseJson = "")
        {
            int          num          = Convert.ToInt32(ret["venus_status"]);
            VenusStatusE venusStatusE = (VenusStatusE)num;

            if (venusStatusE == VenusStatusE.RESPONSE_SUCCESS)
            {
                this.tokenKey    = (ret["token_key"] as string);
                this.tokenSecret = (ret["token_secret"] as string);
                this.userId      = Convert.ToInt32(ret["x_user_id"]);
                this.uuid        = (ret["x_uuid"] as string);
            }
            else
            {
                this.mErrData = new NpOAuthErrData(NpOatuhFailedCodeE.ServerFailed, "サーバーエラー", new NpOAuthVenusRespones
                {
                    VenusStatus = venusStatusE,
                    Message     = (ret["message"] as string),
                    Subject     = (ret["subject"] as string),
                    VenusErrLog = (ret["e"] as string),
                    ResJson     = responseJson
                });
                this.isInitializedError = true;
            }
        }
예제 #2
0
 private void OnHttpResponse(WWW www)
 {
     if (www.error == null)
     {
         try
         {
             this.tokenKey    = string.Empty;
             this.tokenSecret = string.Empty;
             this.userId      = -1;
             this.uuid        = string.Empty;
             NpOAuthType npOAuthType = this.type;
             if (npOAuthType != NpOAuthType.Json)
             {
                 if (npOAuthType == NpOAuthType.MessagePack)
                 {
                     this.messagePack(www.bytes);
                 }
             }
             else
             {
                 this.json(www.text);
             }
             if (this.userId != -1)
             {
                 this.isInitialized      = true;
                 this.isInitializedError = false;
                 this.mErrData           = new NpOAuthErrData();
             }
             else if (this.isInitializedError)
             {
                 this.isInitialized = false;
             }
             else
             {
                 this.isInitialized         = false;
                 this.isInitializedError    = true;
                 this.mErrData.FailedCode   = NpOatuhFailedCodeE.NoneUserID;
                 this.mErrData.NativeErrLog = "no user_id";
             }
         }
         catch (Exception ex)
         {
             this.isInitialized         = false;
             this.isInitializedError    = true;
             this.mErrData.FailedCode   = NpOatuhFailedCodeE.OtherException;
             this.mErrData.NativeErrLog = ex.Message;
         }
     }
     else
     {
         this.isInitialized         = false;
         this.isInitializedError    = true;
         this.mErrData.FailedCode   = NpOatuhFailedCodeE.WWWFaield;
         this.mErrData.NativeErrLog = www.error;
     }
 }
예제 #3
0
 private NpOAuth()
 {
     this.initURL            = string.Empty;
     this.counsumerKey       = string.Empty;
     this.counsumerSecret    = string.Empty;
     this.timeOut            = 10f;
     this.type               = NpOAuthType.Json;
     this.X_AppVer           = string.Empty;
     this.tokenKey           = string.Empty;
     this.tokenSecret        = string.Empty;
     this.userId             = -1;
     this.guid               = string.Empty;
     this.countryCode        = string.Empty;
     this.uuid               = string.Empty;
     this.isInitialized      = false;
     this.isInitializedError = false;
     this.mErrData           = new NpOAuthErrData();
 }
예제 #4
0
        private IEnumerator OauthInitialize(string uuid, MonoBehaviour _behaviour)
        {
            this.isInitializedError = false;
            this.mErrData           = new NpOAuthErrData();
            this.guid        = NpDeviceInfo.GetGuid();
            this.adid        = NpDeviceInfo.GetAdid();
            this.countryCode = NpDeviceInfo.GetLocaleLanguageAndCountry();
            string authHeader = this.InitialRequestHeaderString(uuid, "json");
            Dictionary <string, string> headersDic = this.SetHeaderCommon(authHeader);

            headersDic.Add("X-AppVer", this.X_AppVer);
            NpDebugLog.Log(this.X_AppVer);
            Dictionary <string, object> postDic = new Dictionary <string, object>();

            postDic.Add("x_uuid", uuid);
            OAuthConnect oAuthConnect = new OAuthConnect(_behaviour, new Action <WWW>(this.OnHttpResponse), this.timeOut, new Action(this.OnTimeOutErr));

            yield return(_behaviour.StartCoroutine(oAuthConnect.OAuthPostRequest(this.initURL, postDic, headersDic)));

            yield break;
        }