コード例 #1
0
 protected virtual void FetchEventHandler(string type, ServiceEvent inEvent, float inProgress, object inObject, object inUserData)
 {
     if (inEvent == ServiceEvent.COMPLETE)
     {
         a1 = inObject as MockAPIData;
     }
     else
     {
         Debug.LogError("Mock PAI Data fetch");
     }
 }
コード例 #2
0
        protected virtual void FetchEventHandler(string type, ServiceEvent inEvent, float inProgress, object inObject, object inUserData)
        {
            if (inEvent == ServiceEvent.COMPLETE)
            {
                mockData = inObject as MockAPIData;
            }
            else
            {
                Debug.LogError("Mock API Data fetch failed");
            }

            PopulateList();
        }
コード例 #3
0
    IEnumerator Upload()
    {
        WWWForm form = new WWWForm();

        form.AddField("myField", "myData");

        using (UnityWebRequest www = UnityWebRequest.Post(url, form))
        {
            yield return(www.SendWebRequest());

            if (www.isNetworkError || www.isHttpError)
            {
                Debug.Log(www.error);
            }
            else
            {
                response = www.downloadHandler.text;
                a1       = Newtonsoft.Json.JsonConvert.DeserializeObject <MockAPIData>(response);
            }
        }
    }
コード例 #4
0
    public MockAPIData MakeMockAPICall()
    {
        currentRequest = new RequestHelper
        {
            Uri    = basePathMockAPI + "/demo/math/data",
            Params = new Dictionary <string, string>
            {
                { "param1", "value 1" },
                { "param2", "value 2" }
            },
            EnableDebug = true
        };

        RestClient.Post(currentRequest)
        .Then(res =>
        {
            // And later we can clear the default query string params for all requests
            RestClient.ClearDefaultParams();
            a1 = Newtonsoft.Json.JsonConvert.DeserializeObject <MockAPIData>(res.Text);
        })
        .Catch(err => Debug.Log("Error" + err.Message));

        return(null);
    }