Esempio n. 1
0
        // ---------[ UI FUNCTIONALITY ]---------
        public override void DisplayDownload(FileDownloadInfo downloadInfo)
        {
            Debug.Assert(downloadInfo != null);

            if (m_updateCoroutine != null)
            {
                this.StopCoroutine(m_updateCoroutine);
            }

            m_downloadInfo = downloadInfo;

            Int64 bytesReceived = (downloadInfo.request == null
                                   ? 0
                                   : (Int64)downloadInfo.request.downloadedBytes);

            m_data = new DownloadDisplayData()
            {
                bytesReceived  = bytesReceived,
                bytesPerSecond = 0,
                bytesTotal     = downloadInfo.fileSize,
                isActive       = !downloadInfo.isDone,
            };

            if (Application.isPlaying && this.isActiveAndEnabled)
            {
                m_updateCoroutine = this.StartCoroutine(UpdateCoroutine());
            }
        }
        public void DisplayDownload(FileDownloadInfo downloadInfo)
        {
            bool activeDownload = (downloadInfo != null && !downloadInfo.isDone);

            if (downloadDisplay != null)
            {
                if (m_downloadDisplayCoroutine != null)
                {
                    this.StopCoroutine(m_downloadDisplayCoroutine);
                }

                downloadDisplay.gameObject.SetActive(activeDownload);

                if (this.isActiveAndEnabled &&
                    activeDownload)
                {
                    downloadDisplay.DisplayDownload(downloadInfo);
                    m_downloadDisplayCoroutine = this.StartCoroutine(MonitorDownloadCoroutine(data.profile.modId));
                }

                m_data.binaryDownload = downloadDisplay.data;
            }
            else
            {
                DownloadDisplayData data = new DownloadDisplayData();
                data.bytesReceived  = 0;
                data.bytesPerSecond = 0;
                data.bytesTotal     = 0;
                data.isActive       = activeDownload;

                if (downloadInfo != null)
                {
                    data.bytesReceived = (downloadInfo.request == null
                                          ? 0 : (Int64)downloadInfo.request.downloadedBytes);
                    data.bytesTotal = downloadInfo.fileSize;
                }
            }
        }