Пример #1
0
        private void Update()
        {
            if (thread != null)
            {
                if (thread.Events.Count > 0)
                {
                    DownloadEvent e = thread.Events.Dequeue();
                    switch (e.eventType)
                    {
                    case DownloadEventType.Progress:
                        break;

                    case DownloadEventType.Completed:
                        md5File.UpdateLoaclMd5File(e.config.key);
                        completeCount++;
                        if (completeCount == downloadCount)
                        {
                            md5File.WriteToLocalFile(GameConfig.default_module);
                            isWriteMd5File = false;
                            Ready();
                        }
                        break;

                    case DownloadEventType.Error:
                        Debug.Log("下载失败了");
                        break;
                    }
                }
            }
        }
Пример #2
0
 private void OnProgress(DownloadEvent e)
 {
     if (_table != null)
     {
         _table.Progress(_module, (float)((int)e.param / 100f));
     }
 }
Пример #3
0
 private void OnError(DownloadEvent e)
 {
     Debug.Log("失败了");
     if (_table != null)
     {
         _table.Error(_module);
     }
 }
Пример #4
0
        private void Update()
        {
            if (_thread != null && _thread.Events.Count > 0)
            {
                DownloadEvent e = _thread.Events.Dequeue();
                switch (e.eventType)
                {
                case DownloadEventType.Progress: OnProgress(e); break;

                case DownloadEventType.Completed: OnCompleted(e); break;

                case DownloadEventType.Error: OnError(e); break;
                }
            }
        }
Пример #5
0
        private void OnCompleted(DownloadEvent e)
        {
            _currentCount++;
            _checkForUpdate.UpdateLoaclMd5File(e.config.key);

            if (_table != null)
            {
                _table.TotalProgress(_module, (float)_currentCount / (float)_downloadCount);
            }
            if (_currentCount == _downloadCount)
            {
                _checkForUpdate.WriteToLocalFile(_module);
                _isWriteMd5File = false;
                if (_table != null)
                {
                    _table.Complete(_module);
                }
                Destroy(gameObject);
            }
        }