コード例 #1
0
ファイル: Content.cs プロジェクト: smdx24/CPI-Source-Code
 public void UpdateContentManifest(ContentManifest newManifest)
 {
     setManifest(newManifest);
     wwwBundleDevice.UpdateBaseUri(manifest.BaseUri);
     manifest.UpdateEntryMaps();
     Service.Get <EventDispatcher>().DispatchEvent(new ContentManifestUpdated(manifest));
 }
コード例 #2
0
 public void UpdateFrom(ContentManifest other)
 {
     AssetEntryMap.Clear();
     BundleEntryMap.Clear();
     AssetEntryMap        = new Dictionary <string, AssetEntry>(other.AssetEntryMap);
     BundleEntryMap       = new Dictionary <string, BundleEntry>(other.BundleEntryMap);
     ReverseDependencyMap = new Dictionary <BundleEntry, BundleEntry[]>(other.ReverseDependencyMap);
     BaseUri        = other.BaseUri;
     ContentVersion = other.ContentVersion;
 }
コード例 #3
0
 public BundleManager(ContentManifest manifest)
 {
     if (manifest == null)
     {
         manifest = new ContentManifest();
     }
     this.manifest     = manifest;
     mountedBundles    = new Dictionary <string, BundleMount>();
     bundlesToUnmount  = new List <BundleMount>();
     unmountingBundles = new Dictionary <string, BundleMount>();
 }
コード例 #4
0
ファイル: Content.cs プロジェクト: smdx24/CPI-Source-Code
 public Content(ContentManifest manifest, string currentLanguage = "en_US")
 {
     setManifest(manifest);
     assetIndex            = new WeakIndex <object>();
     activeRequests        = new Dictionary <string, CoroutineReturn>();
     activeRequestHandlers = new Dictionary <string, List <object> >();
     bundleManager         = new BundleManager(this.manifest);
     deviceManager         = new DeviceManager();
     this.currentLanguage  = currentLanguage;
     mountStandardDevices(manifest.BaseUri);
     Service.Get <EventDispatcher>().DispatchEvent(new ContentManifestUpdated(manifest));
 }
コード例 #5
0
        public static ContentManifest GetContentManifestFromAssetBundle(AssetBundle assetBundle)
        {
            string[]        allAssetNames = assetBundle.GetAllAssetNames();
            ContentManifest result        = null;

            for (int i = 0; i < allAssetNames.Length; i++)
            {
                string fileName = Path.GetFileName(allAssetNames[i]);
                if (string.Equals(fileName, "ContentManifest.txt", StringComparison.OrdinalIgnoreCase))
                {
                    TextAsset textAsset = assetBundle.LoadAsset <TextAsset>(allAssetNames[i]);
                    result = new ContentManifest(textAsset);
                    break;
                }
            }
            return(result);
        }
コード例 #6
0
        public void SetPrereqs(BundlePrecacheManager bundlePrecacheManager, ScenePrereqContentBundlesManifest scenePrereqBundlesManifest)
        {
            if (bundlePrecacheManager == null)
            {
                throw new ArgumentNullException("bundlePrecacheManager");
            }
            this.bundlePrecacheManager = bundlePrecacheManager;
            if (scenePrereqBundlesManifest == null)
            {
                return;
            }
            ContentManifest manifest = bundlePrecacheManager.GetManifest();

            if (manifest == null)
            {
                throw new ContentManifestException("No Contentmanifest set in BundlePreCacheManager to reference for scene prerequisites.");
            }
            foreach (KeyValuePair <string, string[]> item in scenePrereqBundlesManifest)
            {
                string   key   = item.Key;
                string[] value = item.Value;
                if (value == null)
                {
                    continue;
                }
                List <ContentManifest.BundleEntry> list = new List <ContentManifest.BundleEntry>();
                string[] array = value;
                foreach (string text in array)
                {
                    if (!manifest.BundleEntryMap.ContainsKey(text))
                    {
                        throw new ContentManifestException("Expected bundle key not found in BundleEntryMap for bundleKey=" + text);
                    }
                    list.Add(manifest.BundleEntryMap[text]);
                }
                if (list.Count > 0)
                {
                    scenePrereqBundles.Add(item.Key, list.ToArray());
                }
            }
        }
コード例 #7
0
        public static ContentManifest Merge(ContentManifest first, ContentManifest second)
        {
            Dictionary <string, ContentManifest.AssetEntry> dictionary = new Dictionary <string, ContentManifest.AssetEntry>(first.AssetEntryMap);

            foreach (KeyValuePair <string, ContentManifest.AssetEntry> item in second.AssetEntryMap)
            {
                dictionary[item.Key] = item.Value;
            }
            Dictionary <string, ContentManifest.BundleEntry> dictionary2 = new Dictionary <string, ContentManifest.BundleEntry>(first.BundleEntryMap);

            foreach (KeyValuePair <string, ContentManifest.BundleEntry> item2 in second.BundleEntryMap)
            {
                dictionary2[item2.Key] = item2.Value;
            }
            ContentManifest contentManifest = new ContentManifest();

            if (second != null)
            {
                contentManifest.BaseUri             = second.BaseUri;
                contentManifest.ContentVersion      = second.ContentVersion;
                contentManifest.ContentManifestHash = second.ContentManifestHash;
            }
            else if (first != null)
            {
                contentManifest.BaseUri             = first.BaseUri;
                contentManifest.ContentVersion      = first.ContentVersion;
                contentManifest.ContentManifestHash = first.ContentManifestHash;
            }
            HashSet <string> hashSet = new HashSet <string>();

            foreach (KeyValuePair <string, ContentManifest.AssetEntry> item3 in dictionary)
            {
                ContentManifest.AssetEntry value = item3.Value;
                if (!string.IsNullOrEmpty(value.BundleKey))
                {
                    hashSet.Add(value.BundleKey);
                }
            }
            foreach (KeyValuePair <string, ContentManifest.BundleEntry> item4 in dictionary2)
            {
                ContentManifest.BundleEntry value2 = item4.Value;
                if (!hashSet.Contains(value2.Key))
                {
                    continue;
                }
                string[] dependencyBundles = value2.DependencyBundles;
                foreach (string text in dependencyBundles)
                {
                    if (!string.IsNullOrEmpty(text))
                    {
                        hashSet.Add(text);
                    }
                }
            }
            Dictionary <string, ContentManifest.BundleEntry> dictionary3 = new Dictionary <string, ContentManifest.BundleEntry>();

            foreach (string item5 in hashSet)
            {
                if (string.IsNullOrEmpty(item5))
                {
                    throw new Exception("Bundle key cannot be empty when assigning it to Bundle map");
                }
                if (dictionary2.ContainsKey(item5))
                {
                    ContentManifest.BundleEntry value3 = dictionary2[item5];
                    dictionary3.Add(item5, value3);
                }
            }
            contentManifest.AssetEntryMap  = dictionary;
            contentManifest.BundleEntryMap = dictionary3;
            return(contentManifest);
        }
コード例 #8
0
 public void SetManifest(ContentManifest contentManifest)
 {
     manifest = contentManifest;
 }
コード例 #9
0
 public BundlePrecacheManager(ContentManifest contentManifest)
 {
     SetManifest(contentManifest);
     CoroutineRunner.StartPersistent(loadConfig(), this, "BundlePrecacheManager.loadConfig()");
 }
コード例 #10
0
ファイル: Content.cs プロジェクト: smdx24/CPI-Source-Code
 private void setManifest(ContentManifest newManifest)
 {
     manifest            = newManifest;
     contentVersionHash  = manifest.ContentVersion;
     contentManifestHash = manifest.ContentManifestHash;
 }
コード例 #11
0
ファイル: Content.cs プロジェクト: smdx24/CPI-Source-Code
 public ContentManifestUpdated(ContentManifest manifest)
 {
     ContentManifest = manifest;
 }
コード例 #12
0
ファイル: Content.cs プロジェクト: smdx24/CPI-Source-Code
 public void ReplaceManifest(ContentManifest newManifest)
 {
     manifest.UpdateFrom(newManifest);
 }