예제 #1
0
 private void SetData()
 {
     if (isDone)
     {
         if (string.IsNullOrEmpty(www.error) && error.IsNull())
         {
             data = new JSONObject(www.text);
             CheckCode(data);
         }
         else
         {
             if (error.IsNull())
             {
                 error = new ErrorServerRequest(API_Code.ERROR_CODE, www.error);
             }
         }
     }
     else
     {
         if (error.IsNull())
         {
             SetUnknownError();
         }
     }
 }
예제 #2
0
    protected void CheckCode(JSONObject data)
    {
        int code = API_Helper.GetCode(data);

        if (!API_Code.CodeIsNormalSuccess(code))
        {
            string errorMessage = API_Helper.GetMessage(data);
            error = new ErrorServerRequest(code, errorMessage);
        }
    }
예제 #3
0
    public virtual IEnumerator RequestData()
    {
        ValidateTimeOutRunner();
        timeOutRunner.StartCountTimeOut(timeOut);

        var isNotConnectTheInternet = !IsNetworkConnected();

        if (isNotConnectTheInternet)
        {
            timeOutRunner.StopCountTimeOut();
            error  = new ErrorServerRequest(API_Code.NO_INTERNET_CONNECTION_CODE);
            isDone = true;
            yield break;
        }
    }
예제 #4
0
    protected IEnumerator WaitCheckTimeOut(Func <bool> isDone)
    {
        timeOutRunner.ResumeCountTimeOut();

        while (!timeOutRunner.isTimeOut && !isDone())
        {
            yield return(null);
        }

        if (timeOutRunner.isTimeOut)
        {
            error = new ErrorServerRequest(API_Code.TIME_OUT_CODE);
        }

        timeOutRunner.StopCountTimeOut();
    }
예제 #5
0
 protected void SetUnknownError()
 {
     error  = new ErrorServerRequest(API_Code.ERROR_CODE);
     isDone = true;
 }