Exemple #1
0
        public static IEnumerator Dispose()
        {
            IsInitialising = true;
            ProgressManager.RemoveProgressBars("Unload Asset Bundles");

            int progressID = Progress.Start("Unload Asset Bundles", null, Progress.Options.Sticky);
            int bundleID   = Progress.Start("Bundles", null, Progress.Options.Sticky, progressID);
            int prefabID   = Progress.Start("Prefabs", null, Progress.Options.Sticky, progressID);

            Progress.Report(bundleID, 0f);
            Progress.Report(prefabID, 0f);
            PrefabManager.ReplaceWithDefault(PrefabManager.CurrentMapPrefabs, prefabID);

            while (PrefabManager.IsChangingPrefabs)
            {
                yield return(null);
            }

            for (int i = 0; i < BundleCache.Count; i++)
            {
                Progress.Report(bundleID, (float)i / BundleCache.Count, "Unloading: " + BundleCache.ElementAt(i).Key);
                BundleCache.ElementAt(i).Value.Unload(true);
                yield return(null);
            }

            int bundleCount = BundleCache.Count;

            BundleLookup.Clear();
            BundleCache.Clear();
            AssetCache.Clear();

            Progress.Report(bundleID, 0.99f, "Unloaded: " + bundleCount + " bundles.");
            Progress.Finish(bundleID, Progress.Status.Succeeded);
            IsInitialised = false; IsInitialising = false;
        }
Exemple #2
0
 internal void FreeAll()
 {
     com.QH.QPGame.GameUtils.Logger.Res.Log("FreeAll~~~~~~~~~~~");
     foreach (var loAssetBundle in BundleCache)
     {
         loAssetBundle.Value.Bundle.Unload(true);
     }
     BundleCache.Clear();
     ErrorCache.Clear();
     DependCache.Clear();
     WwwCache.Clear();
 }