예제 #1
0
        public static CloudDataSheetWriteQueueEntry Get(string key, string entry, string url)
        {
            CloudDataSheetWriteQueueEntry writeQueueEntry = new CloudDataSheetWriteQueueEntry();

            writeQueueEntry.sheetKey = key;
            writeQueueEntry.putEntry = entry;
            writeQueueEntry.putUrl   = url;
            return(writeQueueEntry);
        }
예제 #2
0
        protected virtual CloudDataSheetWriteQueueEntry GetInsertQueueEntry(string cloudDataKey, object val)
        {
            // Create put entry
            string entry =
                "    {" +
                "        \"value\": " + val +
                "    }";

            // Format URL
            string putUrl = getValueUrl(cloudDataKey) + GetAccessUrlPostfix(false);

            return(CloudDataSheetWriteQueueEntry.Get(cloudDataKey, entry, putUrl));
        }
예제 #3
0
        void WriteQueueEntries()
        {
            if (m_WriteQueue.Count > 0)
            {
                m_CurrentWriteEntry = m_WriteQueue.Dequeue();

                // Create request headers
                var headers = new Dictionary <string, string>();
                headers.Add("Content-Type", "application/json");
                Debug.Log(string.Format("[Unity Cloud Data] writing key '{0}' for sheet at path '{1}'", m_CurrentWriteEntry.sheetKey, path));
                byte[] body = Encoding.UTF8.GetBytes(m_CurrentWriteEntry.putEntry);
                WWWUtility.StartRequest(m_CurrentWriteEntry.putUrl, body, headers, FinishedWritingEntry);
            }
            else
            {
                Debug.Log(string.Format("[Unity Cloud Data] Done saving sheet at path '{0}'!", path));
                // wait until after the refresh completes to trigger the callback
                onRefreshCacheComplete += PostWriteRefreshFinished;
                RefreshCache();
            }
        }