Esempio n. 1
0
 private IEnumerator ProcessMatchResponse <JSONRESPONSE, USERRESPONSEDELEGATETYPE>(WWW client, NetworkMatch.InternalResponseDelegate <JSONRESPONSE, USERRESPONSEDELEGATETYPE> internalCallback, USERRESPONSEDELEGATETYPE userCallback) where JSONRESPONSE : Response, new()
 {
     NetworkMatch.< ProcessMatchResponse > c__Iterator0 <JSONRESPONSE, USERRESPONSEDELEGATETYPE> < ProcessMatchResponse > c__Iterator = new NetworkMatch.< ProcessMatchResponse > c__Iterator0 <JSONRESPONSE, USERRESPONSEDELEGATETYPE>();
Esempio n. 2
0
        private IEnumerator ProcessMatchResponse <JSONRESPONSE, USERRESPONSEDELEGATETYPE>(UnityWebRequest client, NetworkMatch.InternalResponseDelegate <JSONRESPONSE, USERRESPONSEDELEGATETYPE> internalCallback, USERRESPONSEDELEGATETYPE userCallback) where JSONRESPONSE : Response, new()
        {
            yield return(client.SendWebRequest());

            JSONRESPONSE jSONRESPONSE = Activator.CreateInstance <JSONRESPONSE>();
            bool         flag         = client.result == UnityWebRequest.Result.Success;

            if (flag)
            {
                try
                {
                    JsonUtility.FromJsonOverwrite(client.downloadHandler.text, jSONRESPONSE);
                }
                catch (ArgumentException ex2)
                {
                    ArgumentException ex = ex2;
                    jSONRESPONSE.SetFailure(UnityString.Format("ArgumentException:[{0}] ", new object[]
                    {
                        ex.ToString()
                    }));
                }
            }
            else
            {
                jSONRESPONSE.SetFailure(UnityString.Format("Request error:[{0}] Raw response:[{1}]", new object[]
                {
                    client.error,
                    client.downloadHandler.text
                }));
            }
            client.Dispose();
            internalCallback(jSONRESPONSE, userCallback);
            yield break;
        }
Esempio n. 3
0
        private IEnumerator ProcessMatchResponse <JSONRESPONSE, USERRESPONSEDELEGATETYPE>(UnityWebRequest client, NetworkMatch.InternalResponseDelegate <JSONRESPONSE, USERRESPONSEDELEGATETYPE> internalCallback, USERRESPONSEDELEGATETYPE userCallback) where JSONRESPONSE : Response, new()
        {
            yield return(client.SendWebRequest());

            JSONRESPONSE jsonInterface = Activator.CreateInstance <JSONRESPONSE>();

            if (!client.isNetworkError && !client.isHttpError)
            {
                object obj;
                if (SimpleJson.TryDeserializeObject(client.downloadHandler.text, out obj))
                {
                    IDictionary <string, object> dictionary = obj as IDictionary <string, object>;
                    if (dictionary != null)
                    {
                        try
                        {
                            jsonInterface.Parse(obj);
                        }
                        catch (FormatException ex)
                        {
                            jsonInterface.SetFailure(UnityString.Format("FormatException:[{0}] ", new object[]
                            {
                                ex.ToString()
                            }));
                        }
                    }
                }
            }
            else
            {
                jsonInterface.SetFailure(UnityString.Format("Request error:[{0}] Raw response:[{1}]", new object[]
                {
                    client.error,
                    client.downloadHandler.text
                }));
            }
            client.Dispose();
            internalCallback(jsonInterface, userCallback);
            yield break;
        }
Esempio n. 4
0
 private IEnumerator ProcessMatchResponse <JSONRESPONSE, USERRESPONSEDELEGATETYPE>(UnityWebRequest client, NetworkMatch.InternalResponseDelegate <JSONRESPONSE, USERRESPONSEDELEGATETYPE> internalCallback, USERRESPONSEDELEGATETYPE userCallback) where JSONRESPONSE : Response, new()
 {
     /*
      * NetworkMatch.<ProcessMatchResponse>c__Iterator0<JSONRESPONSE, USERRESPONSEDELEGATETYPE> <ProcessMatchResponse>c__Iterator = new NetworkMatch.<ProcessMatchResponse>c__Iterator0<JSONRESPONSE, USERRESPONSEDELEGATETYPE>();
      * <ProcessMatchResponse>c__Iterator.client = client;
      * <ProcessMatchResponse>c__Iterator.internalCallback = internalCallback;
      * <ProcessMatchResponse>c__Iterator.userCallback = userCallback;
      * return <ProcessMatchResponse>c__Iterator;
      */
     return(null);
 }