Ejemplo n.º 1
0
        public IEnumerator Exceution(WebAPI webApi)
        {
            string      sendJson = WebAPIJsonParse.CreateJsonData(this.requestList);
            WWWResponse response = new WWWResponse();

            yield return(webApi.StartCoroutine(GameWebAPI.Instance().StartAPIRequest("API List", sendJson, response)));

            try
            {
                string responseJson = GameWebAPI.Instance().GetResponseJson(response);
                try
                {
                    Dictionary <string, string> responseList = WebAPIJsonParse.GetResponseList(this.requestList, responseJson);
                    for (int i = 0; i < this.requestList.Count; i++)
                    {
                        if (responseList.ContainsKey(this.requestList[i].apiId))
                        {
                            this.requestList[i].ToObject(responseList[this.requestList[i].apiId], false);
                        }
                    }
                }
                catch (JsonException ex)
                {
                    throw new WebAPIException(WWWResponse.LocalErrorStatus.LOCAL_ERROR_JSONPARSE, ex.Message);
                }
            }
            catch (WebAPIException ex2)
            {
                throw ex2;
            }
            yield break;
        }
Ejemplo n.º 2
0
 public override IEnumerator Execution()
 {
     if (this.request != null)
     {
         this.request.SetParam();
         return(this.request.Exceution(GameWebAPI.Instance(), this.requestStatus));
     }
     if (this.requestList != null && !this.requestList.IsEmpty())
     {
         this.requestList.SetParam();
         return(this.requestList.Exceution(GameWebAPI.Instance()));
     }
     return(null);
 }
Ejemplo n.º 3
0
    private IEnumerator RequestMasterData(List <MasterId> updateInfoList)
    {
        for (int i = 0; i < updateInfoList.Count; i++)
        {
            MasterBase  master  = this.GetMaster(updateInfoList[i]);
            RequestBase request = master.CreateRequest();
            GameWebAPI.Instance().AddDisableVersionCheckApiId(request.apiId);
            yield return(base.StartCoroutine(request.Run(null, null, null)));

            GameWebAPI.Instance().RemoveDisableVersionCheckApiId(request.apiId);
            this.downloadedMasterDataCount++;
        }
        yield break;
    }
Ejemplo n.º 4
0
        public IEnumerator UpdateData()
        {
            MasterDataMng.Instance().ClearCache();
            MasterDataMng.Instance().InitialFileIO();
            List <MasterId> updateInfoList = new List <MasterId>();

            yield return(AppCoroutine.Start(this.GetOldMasterDataIdList(updateInfoList), false));

            yield return(AppCoroutine.Start(MasterDataMng.Instance().GetMasterDataUpdateInfo(updateInfoList), false));

            yield return(AppCoroutine.Start(this.UpgradeMasterData(updateInfoList), false));

            MasterDataMng.Instance().ReleaseFileIO();
            if (MasterDataMng.Instance().MasterDataVersion.versionManagerMaster != null)
            {
                GameWebAPI.Instance().SetMasterDataVersion(MasterDataMng.Instance().MasterDataVersion.versionManagerMaster.version);
            }
            this.CreateMasterDataCache();
            yield break;
        }
Ejemplo n.º 5
0
    private void AuthStart(Action onSuccess, Action <WebAPIException> onFailed)
    {
        float timeout = GameWebAPI.Instance().GetTimeout();

        NpOAuth.Instance.X_AppVer        = WebAPIPlatformValue.GetAppVersion();
        NpOAuth.Instance.initURL         = WebAPIPlatformValue.GetHttpAddressAuth();
        NpOAuth.Instance.counsumerKey    = WebAPIPlatformValue.GetCounsumerKey();
        NpOAuth.Instance.counsumerSecret = WebAPIPlatformValue.GetCounsumerSecret();
        NpOAuth.Instance.TimeOut         = timeout;
        NpOAuth.Instance.type            = NpOAuthType.Json;
        Action <NpOAuthErrData> faildAction = delegate(NpOAuthErrData errData)
        {
            if (errData.FailedCode != NpOatuhFailedCodeE.ServerFailed)
            {
                onFailed(null);
            }
            else
            {
                WWWResponse request_result = new WWWResponse
                {
                    responseJson = errData.VenusRespones_.ResJson,
                    errorText    = errData.VenusRespones_.Message,
                    errorStatus  = WWWResponse.LocalErrorStatus.NONE
                };
                try
                {
                    GameWebAPI.Instance().GetResponseJson(request_result);
                }
                catch (WebAPIException obj)
                {
                    onFailed(obj);
                }
            }
        };
        NpAes aes = new NpAes();

        NpOAuth.Instance.Init(this, onSuccess, faildAction, aes);
    }
    public IEnumerator FraudCheckCallApi(FraudDataLog[] fraudDataLogs)
    {
        if (base.onServerConnect)
        {
            string errorMessage = string.Empty;
            for (int i = 0; i < fraudDataLogs.Length; i++)
            {
                errorMessage += fraudDataLogs[i].ToString();
                if (i < fraudDataLogs.Length - 1)
                {
                    errorMessage += "\n\n";
                }
            }
            yield return(base.StartCoroutine(GameWebAPI.Instance().SendActivityCheatLog("errorType", errorMessage, null)));

            yield return(true);
        }
        else
        {
            yield return(true);
        }
        yield break;
    }