예제 #1
0
 public void onPostCaptchaSolutionFailed(PostCaptchaSolutionOperation operation, HttpResponse httpResponse)
 {
     Debug.LogWarningFormat("onPostCaptchaSolutionFailed. httpResponse.Text = {0}", httpResponse.Text);
     if (!httpResponse.Is2XX)
     {
         if (!string.IsNullOrEmpty(httpResponse.Text))
         {
             CaptchaErrorResponse captchaErrorResponse = new CaptchaErrorResponse();
             try
             {
                 captchaErrorResponse = Service.Get <JsonService>().Deserialize <CaptchaErrorResponse>(httpResponse.Text);
                 if (captchaErrorResponse.code == 1023)
                 {
                     string      captcha        = captchaErrorResponse.captcha;
                     CaptchaData newCaptchaData = Service.Get <JsonService>().Deserialize <CaptchaData>(captcha);
                     Service.Get <EventDispatcher>().DispatchEvent(new CaptchaServiceEvents.CaptchaSolutionDeclined(newCaptchaData));
                 }
                 else
                 {
                     handleCPResponseError(httpResponse);
                 }
             }
             catch (Exception)
             {
                 handleCPResponseError(httpResponse);
             }
         }
         else
         {
             handleCPResponseError(httpResponse);
         }
     }
 }
예제 #2
0
    private void onPostCaptchaSolutionSuccess(PostCaptchaSolutionOperation operation, HttpResponse httpResponse)
    {
        string id = operation.CaptchaSolution.id;

        Service.Get <EventDispatcher>().DispatchEvent(new CaptchaServiceEvents.CaptchaSolutionAccepted(id));
    }
예제 #3
0
    public APICall <PostCaptchaSolutionOperation> PostCaptchaSolution(CaptchaType type, CaptchaSolution captchaSolution)
    {
        PostCaptchaSolutionOperation operation = new PostCaptchaSolutionOperation(type, captchaSolution);

        return(new APICall <PostCaptchaSolutionOperation>(clubPenguinClient, operation));
    }