/// <summary> /// Constructor /// </summary> public TemporaryPlatformManifest(string contents) { _manifestDirectory = FileUtilities.GetTemporaryDirectory(); File.WriteAllText(Path.Combine(_manifestDirectory, "Platform.xml"), ObjectModelHelpers.CleanupFileContents(contents)); Manifest = new PlatformManifest(_manifestDirectory); }
void Start() { m_assetPath = "file://" + Application.dataPath + "/StreamingAssets/" + PlatformManifest.GetMainManifest(Application.platform) + "/"; time = Time.time; StartCoroutine(DownloadAssetBundleManifest((Manifest) => { StartCoroutine(LoadDependenceAsset(fileName, Manifest, (fileName2, Manifest2, bundle) => { StartCoroutine(LoadAssetByName(fileName2, Manifest2, bundle)); })); })); }
public void EmptyManifestLocation() { string manifestDirectory = null; try { manifestDirectory = FileUtilities.GetTemporaryDirectory(); PlatformManifest manifest = new PlatformManifest(manifestDirectory); Assert.IsTrue(manifest.ReadError); } finally { if (manifestDirectory != null) { FileUtilities.DeleteDirectoryNoThrow(manifestDirectory, recursive: true); } } }
public void ManifestLocationHasNoPlatformXml() { string manifestDirectory = null; try { manifestDirectory = FileUtilities.GetTemporaryDirectory(); File.WriteAllText(Path.Combine(manifestDirectory, "SomeOtherFile.xml"), "hello"); PlatformManifest manifest = new PlatformManifest(manifestDirectory); Assert.IsTrue(manifest.ReadError); } finally { if (manifestDirectory != null) { FileUtilities.DeleteDirectoryNoThrow(manifestDirectory, recursive: true); } } }
/// <summary> /// 获取总的AssetBundleManifest文件 /// </summary> /// <param name="finish">完后加载后调用的委托</param> /// <returns></returns> public IEnumerator DownloadAssetBundleManifest(Action <AssetBundleManifest> finish = null) { WWW www = WWW.LoadFromCacheOrDownload(m_assetPath + PlatformManifest.GetMainManifest(Application.platform), version); yield return(www); if (!string.IsNullOrEmpty(www.error)) { Debug.LogError(www.error); } else { AssetBundle bundle = www.assetBundle; //获取AssetBundle AssetBundleManifest manifest = bundle.LoadAsset <AssetBundleManifest>("AssetBundleManifest"); //获取总的AssetBundleManifest bundle.Unload(false); Debug.Log(manifest); if (finish != null) { finish.Invoke(manifest); } } }
public void InvalidManifestLocation() { PlatformManifest manifest = new PlatformManifest("|||||||"); Assert.IsTrue(manifest.ReadError); }
public void InvalidManifestLocation() { PlatformManifest manifest = new PlatformManifest("|||||||"); manifest.ReadError.ShouldBeTrue(); }