示例#1
0
 public void Open(ResourceManagerArgs args)
 {
     _bytesPerSecond     = args.bytesPerSecond;
     _bytesPerSecondIdle = args.bytesPerSecondIdle;
     _worker             = new DownloadWorker(onDownloadJobDone, args.bufferSize, args.urls,
                                              System.Threading.ThreadPriority.BelowNormal);
     _idleWorker = new DownloadWorker(onDownloadJobDone, args.bufferSize, args.urls,
                                      System.Threading.ThreadPriority.Lowest);
     _localPathRoot        = args.localPathRoot;
     _assetPathTransformer = args.assetPathTransformer;
     _password             = args.password;
     _streamingAssets      = new StreamingAssetsLoader();
     _streamingAssets.LoadEmbeddedManifest(streamingAssets =>
     {
         if (args.useBaseManifest)
         {
             Helpers.ReadSAManifest(_password, (manifest, fileEntry) =>
             {
                 SetManifest(manifest, fileEntry);
             });
         }
         else
         {
             Helpers.GetManifest(_localPathRoot, _worker, args.manifestChecksum, args.manifestSize, args.manifestRSize,
                                 _password, args.manifestChunkSize, (manifest, fileEntry) =>
             {
                 SetManifest(manifest, fileEntry);
             });
         }
     });
 }
示例#2
0
 public void Open(ResourceManagerArgs args)
 {
     _password = args.password;
     Helpers.GetManifest(_localPathRoot, _worker, args.manifestChecksum, args.manifestSize, args.manifestRSize,
                         _password, (manifest, fileEntry) =>
     {
         _streamingAssets = new StreamingAssetsLoader();
         _streamingAssets.LoadEmbeddedManifest(streamingAssets =>
         {
             SetManifest(manifest, fileEntry);
             ResourceManager.GetListener().OnSetManifest();
         });
     });
 }
示例#3
0
 private void Initialize()
 {
     Utils.Helpers.GetManifest(_urls, _localPathRoot, manifest =>
     {
         new StreamingAssetsLoader(manifest).OpenManifest(streamingAssets =>
         {
             _streamingAssets = streamingAssets;
             var startups     = Utils.Helpers.CollectBundles(manifest, _localPathRoot, bundleInfo =>
             {
                 if (bundleInfo.startup)
                 {
                     return(streamingAssets == null || !streamingAssets.Contains(bundleInfo.name, bundleInfo.checksum, bundleInfo.size));
                 }
                 return(false);
             });
             if (startups.Length > 0)
             {
                 for (int i = 0, size = startups.Length; i < size; i++)
                 {
                     var bundleInfo = startups[i];
                     AddDownloadTask(DownloadTask.Create(bundleInfo, _urls, _localPathRoot, -1, 10, self =>
                     {
                         RemoveDownloadTask(self);
                         if (_tasks.Count == 0)
                         {
                             SetManifest(manifest);
                             ResourceManager.GetListener().OnComplete();
                         }
                     }), false);
                 }
                 ResourceManager.GetListener().OnStartupTask(startups);
                 Schedule();
             }
             else
             {
                 SetManifest(manifest);
                 ResourceManager.GetListener().OnComplete();
             }
         });
     });
 }
示例#4
0
 public void Open(ResourceManagerArgs args)
 {
     _password = args.password;
     Helpers.GetManifest(_localPathRoot, _worker, args.manifestChecksum, args.manifestSize, args.manifestRSize,
                         _password, (manifest, fileEntry) =>
     {
         _streamingAssets = new StreamingAssetsLoader();
         _streamingAssets.LoadEmbeddedManifest(streamingAssets =>
         {
             SetManifest(manifest, fileEntry);
             try
             {
                 ResourceManager.GetListener().OnSetManifest();
             }
             catch (Exception exception)
             {
                 Debug.LogWarningFormat("OnSetManifest exception\n{0}", exception);
             }
         });
     });
 }