Exemplo n.º 1
0
        private string genStatusText(WebData data)
        {
            string tmp = "";

            if (data != null)
            {
                tmp += data.Name + ":";

                if (!string.IsNullOrEmpty(data.Error))
                {
                    tmp += data.Error.ToString();
                }
                else
                if (data.Progress < 100f)
                {
                    tmp += (data.Progress.ToString() + "%");
                }
                else
                {
                    tmp += "done";
                }
            }
            else
            {
                tmp += "null Data";
            }
            tmp += "\n";
            return(tmp);
        }
Exemplo n.º 2
0
        IEnumerator LoadWebData(WebData wData)
        {
            while (!wData.IsDone && string.IsNullOrEmpty(wData.Error))
            {
                wData.Load();
                while (string.IsNullOrEmpty(wData.Error) && !wData.IsDone)
                {
                    new WaitForSeconds(DownloadStatusUpdateTimmer);
                    yield return(wData);
                }

                if (wData.IsDone && string.IsNullOrEmpty(wData.Error))
                {
                    wData.Dispose();
                    yield return(wData);
                }
                else
                {
                    Debug.Log(wData.Error);
                    yield return(wData);
                }
            }

            yield return(wData);
        }
Exemplo n.º 3
0
        public void AddDownload(WebData dload)
        {
            downloads.Add(dload);

            if (!isLoading)
            {
                StartCoroutine(ProceedQueue());
            }
        }
Exemplo n.º 4
0
        private void proceedDownload()
        {
            if (downloads != null && downloads.Count > 0)
            {
                WebData nextDload = downloads.FirstOrDefault <WebData>();

                // remove Failed Loads
                if (!string.IsNullOrEmpty(nextDload.Error))
                {
                    failed.Add(nextDload);
                    downloads.Remove(nextDload);

                    if (nextDload.OnFail != null)
                    {
                        nextDload.OnFail.Invoke();
                    }

                    return;
                }

                // remove done dloads
                if (nextDload.IsDone && string.IsNullOrEmpty(nextDload.Error))
                {
                    done.Add(nextDload);
                    downloads.Remove(nextDload);

                    if (nextDload.OnSuccess != null)
                    {
                        nextDload.OnSuccess.Invoke();
                    }

                    return;
                }

                // not Started
                if (!nextDload.IsDone && nextDload.downloadData == null)
                {
                    if (nextDload.OnStart != null)
                    {
                        nextDload.OnStart.Invoke();
                    }

                    StartCoroutine(LoadWebData(nextDload));
                    return;
                }
            }
        }