コード例 #1
0
            /// <summary>
            /// Constructor
            /// </summary>
            public TemporaryPlatformManifest(string contents)
            {
                _manifestDirectory = FileUtilities.GetTemporaryDirectory();
                File.WriteAllText(Path.Combine(_manifestDirectory, "Platform.xml"), ObjectModelHelpers.CleanupFileContents(contents));

                Manifest = new PlatformManifest(_manifestDirectory);
            }
コード例 #2
0
    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));
            }));
        }));
    }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
        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);
                }
            }
        }
コード例 #5
0
    /// <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);
            }
        }
    }
コード例 #6
0
        public void InvalidManifestLocation()
        {
            PlatformManifest manifest = new PlatformManifest("|||||||");

            Assert.IsTrue(manifest.ReadError);
        }
コード例 #7
0
        public void InvalidManifestLocation()
        {
            PlatformManifest manifest = new PlatformManifest("|||||||");

            manifest.ReadError.ShouldBeTrue();
        }