コード例 #1
0
        public static void StopAllTask()
        {
            if (CurrentTask_ != null)
            {
                CurrentTask_.Stop();
                CurrentTask_ = null;
            }

            foreach (var Task in DownloadTasks_)
            {
                Task.Stop();
            }

            DownloadTasks_.Clear();
        }
コード例 #2
0
        public static void Update(float DeltaTime)
        {
            if (CurrentTask_ == null && DownloadTasks_.Count == 0)
            {
                return;
            }

            if (CurrentTask_ != null)
            {
                CurrentTask_.Update(DeltaTime);
                CurrentTask_.InvokeProgressCallback();
                if (CurrentTask_.IsEnd())
                {
                    if (!CurrentTask_.IsCompleted())
                    {
                        if (CurrentTask_.DownloadCount < MaxRetryCount)
                        {
                            CurrentTask_.Reset();
                            DownloadTasks_.Enqueue(CurrentTask_);
                        }
                        else
                        {
                            FailedTasks_.Add(CurrentTask_);
                        }
                    }

                    var Task = CurrentTask_;
                    CurrentTask_ = null;
                    Task.InvokeCompletedCallback();
                }
            }
            else
            {
                CurrentTask_ = DownloadTasks_.Dequeue();
                CurrentTask_.Start();
            }
        }