Exemple #1
0
        static void EditorUpdate()
        {
#if UNITY_EDITOR
            while (!www.isDone)
            {
                elapsedTime = UnityEditor.EditorApplication.timeSinceStartup - startTime;
                if (elapsedTime >= timeOutLimit)
                {
                    CloudConnectorCore.ProcessResponse("TIME_OUT", (float)elapsedTime);
                    UnityEditor.EditorApplication.update -= EditorUpdate;
                }

                return;
            }

            if (www.isNetworkError)
            {
                CloudConnectorCore.ProcessResponse(
                    CloudConnectorCore.MSG_CONN_ERR + "Connection error after " + elapsedTime.ToString() + " seconds: " +
                    www.error, (float)elapsedTime);
                return;
            }

            CloudConnectorCore.ProcessResponse(www.downloadHandler.text, (float)elapsedTime);

            UnityEditor.EditorApplication.update -= EditorUpdate;
#endif
        }
        IEnumerator ExecuteRequest(Dictionary <string, string> postData)
        {
            www.SendWebRequest();

            float elapsedTime = 0.0f;

            while (!www.isDone)
            {
                elapsedTime += UnityEngine.Time.deltaTime;
                if (elapsedTime >= timeOutLimit)
                {
                    CloudConnectorCore.ProcessResponse("TIME_OUT", elapsedTime);
                    break;
                }

                yield return(null);
            }

            if (www.isNetworkError)
            {
                CloudConnectorCore.ProcessResponse(
                    CloudConnectorCore.MSG_CONN_ERR + "Connection error after " + elapsedTime.ToString() + " seconds: " +
                    www.error, elapsedTime);
                yield break;
            }

            CloudConnectorCore.ProcessResponse(www.downloadHandler.text, elapsedTime);
        }