Пример #1
0
        public DownloadTask DownLoadBundles(
            string[] bundlePaths,
            Action <object> downloadCall,
            ushort priority,
            Action <Resource, int, int> downPerAsset = null)
        {
            DownloadTask task = ObjectPool.GetObject <DownloadTask>();

            task.InitTask(bundlePaths, FinishDownloadTask, downloadCall, downPerAsset, null, null, null, priority);
            if (task.HasDownload())
            {
                addDownLoadTask(task);
            }
            return(task);
        }
Пример #2
0
        private void addDownLoadTask(DownloadTask task)
        {
            List <DownloadTask> downLoadList = null;

            if (newDownloadTasks.TryGetValue(task.priority, out downLoadList))
            {
                downLoadList.Add(task);
            }
            else
            {
                newDownloadTasks[task.priority] = new List <DownloadTask>();
                downLoadList = newDownloadTasks[task.priority];
                downLoadList.Add(task);
            }
            if (!priorityList.Contains(task.priority))
            {
                priorityList.Add(task.priority);
                priorityList.Sort();
            }
        }