Beispiel #1
0
 public void DeleteDownloader(Job job, IDownloader downloader)
 {
     if (!(downloader is FileDispatch.Downloader))
     {
         this.wwwFallback.DeleteDownloader(job, downloader);
     }
 }
Beispiel #2
0
 private Loader(Group masterGroup, Job[] allJobs, Group[] allGroups, IDownloaderDispatch dispatch)
 {
     this.MasterGroup = masterGroup;
     this.Jobs = allJobs;
     this.Groups = allGroups;
     this.Dispatch = dispatch;
 }
Beispiel #3
0
 public void OnJobCompleted(Facepunch.Load.Job job)
 {
     if (this.Job == job)
     {
         this.Download.Dispose();
         this.Download = null;
         this.Job      = null;
     }
 }
Beispiel #4
0
 public void DeleteDownloader(Job job, IDownloader idownloader)
 {
     if (idownloader is WWWDispatch.Downloader)
     {
         WWWDispatch.Downloader downloader = (WWWDispatch.Downloader)idownloader;
         downloader.Job = null;
         downloader.Download = null;
     }
 }
Beispiel #5
0
 private void DownloadBegin(WWWDispatch.Downloader downloader, Job job)
 {
     downloader.Job = job;
     downloader.Download = new WWW(job.Path);
     job.OnDownloadingBegin(downloader);
     if (!downloader.Download.isDone)
     {
         this.coroutineRunner.Install(WWWDispatch.Downloader.DownloaderRoutineCallback, downloader, downloader.Download, true);
     }
     else
     {
         this.DownloadFinished(downloader);
     }
 }
Beispiel #6
0
 public IDownloader CreateDownloaderForJob(Job job)
 {
     if (File.Exists(job.Path) && (new FileInfo(job.Path)).Length == (long)job.ByteLength)
     {
         AssetBundle assetBundle = AssetBundle.CreateFromFile(Path.GetFullPath(job.Path).Replace('\\', '/'));
         if (assetBundle)
         {
             return new FileDispatch.Downloader()
             {
                 bundle = assetBundle
             };
         }
     }
     Debug.LogWarning(string.Concat("Missing Bundle ", job.Path));
     if (job.ContentType == ContentType.Assets && job.TypeOfAssets != typeof(NavMesh))
     {
         return null;
     }
     return this.wwwFallback.CreateDownloaderForJob(job);
 }
Beispiel #7
0
 public float GetDownloadProgress(Facepunch.Load.Job job)
 {
     return((this.Download != null) ? this.Download.progress : 0f);
 }
Beispiel #8
0
 public void BeginJob(Facepunch.Load.Job job)
 {
     this.Dispatch.DownloadBegin(this, job);
 }
Beispiel #9
0
 public AssetBundle GetLoadedAssetBundle(Job job)
 {
     return this.bundle;
 }
Beispiel #10
0
 public float GetDownloadProgress(Job job)
 {
     return 0f;
 }
Beispiel #11
0
 public void BeginJob(Job job)
 {
     job.OnDownloadingBegin(this);
     job.OnDownloadingComplete();
 }
Beispiel #12
0
 public AssetBundle GetLoadedAssetBundle(Job job)
 {
     return this.Download.assetBundle;
 }
Beispiel #13
0
 public void OnJobCompleted(Job job)
 {
     this.bundle = null;
 }
Beispiel #14
0
 public float GetDownloadProgress(Job job)
 {
     return (this.Download != null ? this.Download.progress : 0f);
 }
Beispiel #15
0
 public AssetBundle GetLoadedAssetBundle(Facepunch.Load.Job job)
 {
     return(this.Download.assetBundle);
 }
Beispiel #16
0
 private static Loader Deserialize(Reader reader, IDownloaderDispatch dispatch)
 {
     List<Item[]> itemArrays = new List<Item[]>();
     List<Item> items = new List<Item>();
     while (reader.Read())
     {
         switch (reader.Token)
         {
             case Token.RandomLoadOrderAreaBegin:
             {
                 items.Clear();
                 continue;
             }
             case Token.BundleListing:
             {
                 items.Add(reader.Item);
                 continue;
             }
             case Token.RandomLoadOrderAreaEnd:
             {
                 itemArrays.Add(items.ToArray());
                 continue;
             }
             case Token.DownloadQueueEnd:
             {
                 Operation operation = new Operation();
                 int length = 0;
                 foreach (Item[] itemArray in itemArrays)
                 {
                     length = length + (int)itemArray.Length;
                 }
                 Job[] jobArray = new Job[length];
                 int num = 0;
                 foreach (Item[] itemArray1 in itemArrays)
                 {
                     Item[] itemArray2 = itemArray1;
                     for (int i = 0; i < (int)itemArray2.Length; i++)
                     {
                         Item item = itemArray2[i];
                         int num1 = num;
                         num = num1 + 1;
                         Job job = new Job()
                         {
                             _op = operation,
                             Item = item
                         };
                         jobArray[num1] = job;
                     }
                 }
                 Group group = new Group()
                 {
                     _op = operation,
                     Jobs = jobArray
                 };
                 group.Initialize();
                 Group[] groupArray = new Group[itemArrays.Count];
                 int num2 = 0;
                 int num3 = 0;
                 foreach (Item[] itemArray3 in itemArrays)
                 {
                     int length1 = (int)itemArray3.Length;
                     Job[] jobArray1 = new Job[length1];
                     for (int j = 0; j < length1; j++)
                     {
                         int num4 = num2;
                         num2 = num4 + 1;
                         jobArray1[j] = jobArray[num4];
                     }
                     groupArray[num3] = new Group();
                     groupArray[num3]._op = operation;
                     groupArray[num3].Jobs = jobArray1;
                     groupArray[num3].Initialize();
                     for (int k = 0; k < length1; k++)
                     {
                         jobArray1[k].Group = groupArray[num3];
                     }
                     num3++;
                 }
                 Loader loader = new Loader(group, jobArray, groupArray, dispatch);
                 Loader loader1 = loader;
                 operation.Loader = loader;
                 return loader1;
             }
             default:
             {
                 continue;
             }
         }
     }
     throw new InvalidProgramException();
 }
Beispiel #17
0
 internal void OnJobCompleted(Job job, IDownloader downloader)
 {
     Item[] itemArray;
     AssetBundle[] assetBundleArray;
     Item[] itemArray1;
     AssetBundle[] assetBundleArray1;
     job.AssetBundle = downloader.GetLoadedAssetBundle(job);
     if (this.OnAssetBundleLoaded != null)
     {
         try
         {
             this.OnAssetBundleLoaded(job.AssetBundle, job.Item);
         }
         catch (Exception exception)
         {
             UnityEngine.Debug.LogException(exception);
         }
     }
     downloader.OnJobCompleted(job);
     this.Dispatch.DeleteDownloader(job, downloader);
     Loader loader = this;
     int num = loader.jobsCompleted + 1;
     int num1 = num;
     loader.jobsCompleted = num;
     if (num1 != this.MasterGroup.Count)
     {
         Loader loader1 = this;
         int num2 = loader1.jobsCompletedInGroup + 1;
         num1 = num2;
         loader1.jobsCompletedInGroup = num2;
         if (num1 == (int)this.Groups[this.currentGroup].Jobs.Length)
         {
             if (this.OnGroupedAssetBundlesLoaded != null)
             {
                 this.Groups[this.currentGroup].GetArrays(out assetBundleArray1, out itemArray1);
                 try
                 {
                     this.OnGroupedAssetBundlesLoaded(assetBundleArray1, itemArray1);
                 }
                 catch (Exception exception1)
                 {
                     UnityEngine.Debug.LogException(exception1);
                 }
             }
             this.StartNextGroup();
         }
     }
     else
     {
         if (this.OnAllAssetBundlesLoaded != null)
         {
             this.MasterGroup.GetArrays(out assetBundleArray, out itemArray);
             try
             {
                 this.OnAllAssetBundlesLoaded(assetBundleArray, itemArray);
             }
             catch (Exception exception2)
             {
                 UnityEngine.Debug.LogException(exception2);
             }
         }
         this.DisposeDispatch();
     }
 }
Beispiel #18
0
 public IDownloader CreateDownloaderForJob(Job job)
 {
     return new WWWDispatch.Downloader(this);
 }
Beispiel #19
0
 public void OnJobCompleted(Job job)
 {
     if (this.Job == job)
     {
         this.Download.Dispose();
         this.Download = null;
         this.Job = null;
     }
 }
Beispiel #20
0
 private void StartJob(Job job)
 {
     this.Dispatch.CreateDownloaderForJob(job).BeginJob(job);
 }
Beispiel #21
0
 public void BeginJob(Job job)
 {
     this.Dispatch.DownloadBegin(this, job);
 }