示例#1
0
        public static IEnumerator Dispose()
        {
            IsInitialising = true;
            for (int i = 0; i < Progress.GetCount(); i++)             // Remove old progress
            {
                var progress = Progress.GetProgressById(Progress.GetId(i));
                if (progress.finished && progress.name.Contains("Asset Bundles"))
                {
                    progress.Remove();
                }
            }

            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 < Bundles.Count; i++)
            {
                Progress.Report(bundleID, (float)i / Bundles.Count, "Unloading: " + Bundles.ElementAt(i).Key);
                Bundles.ElementAt(i).Value.Unload(true);
                yield return(null);
            }

            int bundleCount = Bundles.Count;

            BundleLookup.Clear();
            Bundles.Clear();
            AssetCache.Clear();

            Progress.Report(bundleID, 0.99f, "Unloaded: " + bundleCount + " bundles.");
            Progress.Finish(bundleID, Progress.Status.Succeeded);
            IsInitialised = false; IsInitialising = false;
        }
示例#2
0
        public void Load(string configPath)
        {
            Bundles.Clear();
            Products.Clear();
            XElement configXml = XElement.Load(configPath);
            IEnumerator <XElement> elements = configXml.Elements().GetEnumerator();

            while (elements.MoveNext())
            {
                switch (elements.Current.Name.LocalName)
                {
                case BUNDLE_KEY:
                    LoadBundle(elements.Current);
                    break;

                case PRODUCT_KEY:
                    LoadProduct(elements.Current);
                    break;

                default:
                    break;
                }
            }
        }
示例#3
0
 private void Refresh()
 {
     Bundles.Clear();
     database.Refresh();
     database.Bundles.ForEach(x => Bundles.Add(x));
 }