コード例 #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;
        }
コード例 #2
0
		public IEnumerator Exceution(WebAPI webApi, WebAPI.RequestStatus requestStatus)
		{
			this.param.requestStatus = (int)requestStatus;
			string sendJson = WebAPIJsonParse.CreateJsonData(this.apiId, this.param);
			WWWResponse response = new WWWResponse();
			yield return webApi.StartCoroutine(webApi.StartAPIRequest(this.apiId, sendJson, response));
			try
			{
				string responseJson = webApi.GetResponseJson(response);
				this.ToObject(responseJson, true);
			}
			catch (WebAPIException ex)
			{
				if (ex != null)
				{
					ex.apiId = this.apiId;
				}
				throw ex;
			}
			yield break;
		}