private Dictionary <string, string> SetHeaderCommon(string authorization) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("Authorization", authorization); if (this.guid != null || this.guid.Length != 0) { dictionary.Add("x-guid", this.guid); } if (this.uuid != null || this.uuid.Length != 0) { dictionary["x-uuid"] = this.uuid; } if (this.adid != null || this.adid.Length != 0) { dictionary["x-adid"] = this.adid; } if (this.countryCode != null || this.countryCode.Length != 0) { dictionary.Add("country-code", this.countryCode); } dictionary.Add("x-device", SystemInfo.deviceModel); dictionary.Add("x-osver", NpDeviceInfo.GetOSVersion()); dictionary.Add("x-ostype", this.OS_TYPE_ANDROID); return(dictionary); }
public Dictionary <string, string> RequestHeaderDic(string requestMethod, string url, Dictionary <string, object> parameters = null) { if (!this.isInitialized) { return(null); } string headerCommon = this.RequestHeaderString(requestMethod, url, parameters); this.guid = NpDeviceInfo.GetGuid(); this.adid = NpDeviceInfo.GetAdid(); this.countryCode = NpDeviceInfo.GetLocaleLanguageAndCountry(); return(this.SetHeaderCommon(headerCommon)); }
public IEnumerator StartGameLogin() { APIUtil.< StartGameLogin > c__AnonStorey9 <StartGameLogin> c__AnonStorey = new APIUtil.< StartGameLogin > c__AnonStorey9(); APIUtil.< StartGameLogin > c__AnonStorey9 <StartGameLogin> c__AnonStorey2 = < StartGameLogin > c__AnonStorey; GameWebAPI.RequestCM_Login requestCM_Login = new GameWebAPI.RequestCM_Login(); requestCM_Login.SetSendData = delegate(GameWebAPI.RequestCM_LoginRequest param) { param.osType = "2"; param.modelName = SystemInfo.deviceModel; param.osVersion = NpDeviceInfo.GetOSVersion(); param.appVersion = WebAPIPlatformValue.GetAppVersion(); }; requestCM_Login.OnReceived = new Action <GameWebAPI.RespDataCM_Login>(this.OnRecievedLogin);
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 void StoreInitCallBackSuccess(string productInfo) { global::Debug.Log("========= PRODUCT LIST JSON = [" + productInfo + "] END"); string json = "{\"storeProductInfoList\":" + productInfo + "}"; this.storeProductData = JsonMapper.ToObject <StoreUtil.StoreProductData>(json); string localeCountryCode = NpDeviceInfo.GetLocaleCountryCode(); for (int i = 0; i < this.storeProductData.storeProductInfoList.Length; i++) { global::Debug.Log("========= PRODUCT LIST SKU = " + this.storeProductData.storeProductInfoList[i].sku); global::Debug.Log("========= PRODUCT LIST PRICE = " + this.storeProductData.storeProductInfoList[i].price); global::Debug.Log("========= PRODUCT LIST PRICEA = " + this.storeProductData.storeProductInfoList[i].priceAmountMicros); this.storeProductData.storeProductInfoList[i].countryCode = localeCountryCode; this.storeProductData.storeProductInfoList[i].currencyCode = this.storeProductData.storeProductInfoList[i].priceCurrencyCode; } this.actCallBack_RequestProducts(string.Empty); }
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; }