Exemplo n.º 1
0
 public void Init(ResourceManager rm, IResourceProvider provider, IResourceLocation location, AsyncOperationHandle <IList <AsyncOperationHandle> > depOp, bool releaseDependenciesOnFailure)
 {
     m_DownloadStatus  = default;
     m_ResourceManager = rm;
     m_DepOp           = depOp;
     if (m_DepOp.IsValid())
     {
         m_DepOp.Acquire();
     }
     m_Provider = provider;
     m_Location = location;
     m_ReleaseDependenciesOnFailure = releaseDependenciesOnFailure;
 }
 public void Init(ResourceManager rm, IResourceProvider provider, IResourceLocation location, AsyncOperationHandle <IList <AsyncOperationHandle> > depOp)
 {
     m_DownloadStatus  = default;
     m_ResourceManager = rm;
     m_DepOp           = depOp;
     if (m_DepOp.IsValid())
     {
         m_DepOp.Acquire();
     }
     m_Provider = provider;
     m_Location = location;
     m_ReleaseDependenciesOnFailure = true;
     SetWaitForCompletionCallback(WaitForCompletionHandler);
 }
        internal override DownloadStatus GetDownloadStatus(HashSet <object> visited)
        {
            var status = new DownloadStatus()
            {
                IsDone = IsDone
            };

            for (int i = 0; i < Result.Count; i++)
            {
                if (Result[i].IsValid())
                {
                    var depStatus = Result[i].InternalGetDownloadStatus(visited);
                    status.DownloadedBytes += depStatus.DownloadedBytes;
                    status.TotalBytes      += depStatus.TotalBytes;
                }
            }
            return(status);
        }
        internal override DownloadStatus GetDownloadStatus(HashSet <object> visited)
        {
            var depDLS = m_DepOp.IsValid() ? m_DepOp.InternalGetDownloadStatus(visited) : default;

            if (m_GetDownloadProgressCallback != null)
            {
                m_DownloadStatus = m_GetDownloadProgressCallback();
            }

            if (Status == AsyncOperationStatus.Succeeded)
            {
                m_DownloadStatus.DownloadedBytes = m_DownloadStatus.TotalBytes;
            }

            return(new DownloadStatus()
            {
                DownloadedBytes = m_DownloadStatus.DownloadedBytes + depDLS.DownloadedBytes, TotalBytes = m_DownloadStatus.TotalBytes + depDLS.TotalBytes, IsDone = IsDone
            });
        }