private IEnumerator LoadOAuth(MonoBehaviour _behaviour, Action successAction, Action <NpOAuthErrData> faildAction, NpAes aes) { bool isNew = false; string baseUUIDData = PlayerPrefs.GetString("uuid"); if (baseUUIDData.Equals(string.Empty)) { isNew = true; this.uuid = NpDeviceInfo.GenerateUUID(); NpDebugLog.Log("create uuid " + this.uuid); } else { this.uuid = aes.DecryptString(baseUUIDData); NpDebugLog.Log("load uuid " + this.uuid); } if (!this.isInitialized) { yield return(_behaviour.StartCoroutine(this.OauthInitialize(this.uuid, _behaviour))); } if (isNew && this.isInitialized) { PlayerPrefs.SetString("uuid", aes.EncryptString(this.uuid)); PlayerPrefs.Save(); } if (this.isInitializedError) { if (faildAction != null) { faildAction(this.mErrData); } } else if (this.isInitialized) { if (successAction != null) { successAction(); } } else if (faildAction != null) { this.mErrData.FailedCode = NpOatuhFailedCodeE.OtherException; this.mErrData.NativeErrLog = "No isInitialized"; faildAction(this.mErrData); } yield break; }
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; }