Exemple #1
0
 void Update()
 {
     if (m_client != null)
     {
         m_client.Update();
     }
 }
        private IEnumerator WaitForReturn(string[] uploadIds, int cancelTime = -1)
        {
            int  count = 0;
            bool sw    = true;

            Debug.Log("Waiting for file to upload...");
            BrainCloudClient client = _tc.bcWrapper.Client;

            client.Update();
            while (_returnCount < uploadIds.Length && count < 1000 * 30)
            {
                for (int i = 0; i < uploadIds.Length; i++)
                {
                    double progress = client.FileService.GetUploadProgress(uploadIds[i]);

                    if (progress > -1 && sw)
                    {
                        string logStr = "File " + (i + 1) + " Progress: " +
                                        progress + " | " +
                                        client.FileService.GetUploadBytesTransferred(uploadIds[i]) + "/" +
                                        client.FileService.GetUploadTotalBytesToTransfer(uploadIds[i]);
                        Debug.Log(logStr);
                    }

                    if (cancelTime > 0 && progress > 0.05)
                    {
                        client.FileService.CancelUpload(uploadIds[i]);
                    }
                }
                client.Update();
                sw = !sw;

                yield return(new WaitForFixedUpdate());

                count += 150;
            }
        }
Exemple #3
0
        private void WaitForReturn(string[] uploadIds, int cancelTime = -1)
        {
            int  count = 0;
            bool sw    = true;

            BrainCloudClient client = _bc.Client;

            client.Update();
            while (_returnCount < uploadIds.Length && count < 1000 * 30)
            {
                for (int i = 0; i < uploadIds.Length; i++)
                {
                    double progress = client.FileService.GetUploadProgress(uploadIds[i]);

                    if (progress > -1 && sw)
                    {
                        string logStr = "File " + (i + 1) + " Progress: " +
                                        progress + " | " +
                                        client.FileService.GetUploadBytesTransferred(uploadIds[i]) + "/" +
                                        client.FileService.GetUploadTotalBytesToTransfer(uploadIds[i]);
                        Console.WriteLine(logStr);
                    }

                    if (cancelTime > 0 && progress > 0.05)
                    {
                        client.FileService.CancelUpload(uploadIds[i]);
                    }
                }

                client.Update();
                sw = !sw;

                Thread.Sleep(150);
                count += 150;
            }
        }