Ejemplo n.º 1
0
        private IEnumerator RecreateTable()
        {
            foreach (var parser in dataPerSheet)
            {
                Dictionary <int, JsonData> datas = parser.Value;

                if (datas.Count == 0)
                {
                    continue;
                }

                string tableName = DateRelatedTableCreation
                    ? parser.Key + " " + DateTime.Today.ToShortDateString()
                    : parser.Key;

                CloudConnectorCore.CreateTable(datas.Values.ElementAt(0).GetFieldNames(), tableName, false);
                yield return(new WaitForSeconds(SecondsBetweenEachPackages * 2));

                foreach (var jsonData in datas)
                {
                    if (DebugLog)
                    {
                        UnityEngine.Debug.Log("Sending Object JSon: " + jsonData.Value.ExportJson());
                    }

                    CloudConnectorCore.CreateObject(jsonData.Value.ExportJson(), tableName, false);
                    yield return(new WaitForSeconds(SecondsBetweenEachPackages));
                }
            }

            SendingData = false;
        }
Ejemplo n.º 2
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
        }
Ejemplo n.º 3
0
        public static void CreateRequest(Dictionary <string, string> form)
        {
#if UNITY_EDITOR
            form.Add("ssid", spreadsheetId);
            form.Add("pass", servicePassword);

            UnityEditor.EditorApplication.update += EditorUpdate;
            if (usePOST)
            {
                CloudConnectorCore.UpdateStatus("Establishing Connection at URL " + webServiceUrl);
                www = UnityWebRequest.Post(webServiceUrl, form);
            }
            else // Use GET.
            {
                string urlParams = "?";
                foreach (KeyValuePair <string, string> item in form)
                {
                    urlParams += item.Key + "=" + item.Value + "&";
                }

                CloudConnectorCore.UpdateStatus("Establishing Connection at URL " + webServiceUrl + urlParams);
                www = UnityWebRequest.Get(webServiceUrl + urlParams);
            }

            startTime = UnityEditor.EditorApplication.timeSinceStartup;
            www.SendWebRequest();
#endif
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        public void GetSpreadsheetData()
        {
            InitConnection();

            CloudConnectorCore.GetAllTables(false);
            CloudConnectorCore.processedResponseCallback.AddListener(OnDataReceived);
            ReceivingData = true;
        }
Ejemplo n.º 6
0
        public void CreateRequest(Dictionary <string, string> form)
        {
            form.Add("ssid", spreadsheetId);
            form.Add("pass", servicePassword);

            if (usePOST)
            {
                CloudConnectorCore.UpdateStatus("Establishing Connection at URL " + webServiceUrl);
                www = UnityWebRequest.Post(webServiceUrl, form);
            }
            else // Use GET.
            {
                string urlParams = "?";
                foreach (KeyValuePair <string, string> item in form)
                {
                    urlParams += item.Key + "=" + item.Value + "&";
                }

                CloudConnectorCore.UpdateStatus("Establishing Connection at URL " + webServiceUrl + urlParams);
                www = UnityWebRequest.Get(webServiceUrl + urlParams);
            }

            StartCoroutine(ExecuteRequest(form));
        }