示例#1
0
    /// <summary>
    ///   拷贝初始目录所有文件
    /// </summary>
    IEnumerator CopyAllInitialFiles()
    {
        //拷贝所有配置文件
        yield return(DownLoadCommon.StartCopyInitialFile(DownLoadCommon.MAIN_MANIFEST_FILE_NAME));

        string mainifestFullName    = DownLoadCommon.GetFileFullName(DownLoadCommon.MAIN_MANIFEST_FILE_NAME);
        AssetBundleManifest initial = DownLoadCommon.LoadMainManifestByPath(mainifestFullName);

        if (initial == null)
        {
            yield break;
        }
        //拷贝AssetBundle文件
        string[] all_assetbundle = initial.GetAllAssetBundles();
        this.InitTotal = all_assetbundle.Length;
        for (int i = 0; i < all_assetbundle.Length; ++i)
        {
            this.InitCurrent = i;
            string name = all_assetbundle[i];
            yield return(DownLoadCommon.StartCopyInitialFile(name));
        }

        //拷贝结束资源 保证安装包拷贝结束
        yield return(DownLoadCommon.StartCopyInitialFile(DownLoadCommon.END_RESOUCES_FILE_NAME));
    }
示例#2
0
    /// <summary>
    ///   拷贝初始目录所有文件
    /// </summary>
    IEnumerator CopyAllInitialFiles()
    {
        //拷贝所有配置文件
        yield return(DownLoadCommon.StartCopyInitialFile(DownLoadCommon.MAIN_MANIFEST_FILE_NAME));

        string initial_full_name    = DownLoadCommon.GetFileFullName(DownLoadCommon.MAIN_MANIFEST_FILE_NAME);
        AssetBundleManifest initial = DownLoadCommon.LoadMainManifestByPath(initial_full_name);

        if (initial == null)
        {
            yield break;
        }
        //拷贝AssetBundle文件
        string[] all_assetbundle = initial.GetAllAssetBundles();
        for (int i = 0; i < all_assetbundle.Length; ++i)
        {
            string name = all_assetbundle[i];
            yield return(DownLoadCommon.StartCopyInitialFile(name));
        }
        //ResourcesManifest resources_manifest = DownLoadCommon.LoadResourcesManifest();
        //if (resources_manifest == null)
        //{
        //    Debug.LogWarning("Can't load ResourcesManifest file!");
        //    yield break;
        //}
        //var itr = resources_manifest.Data.AssetBundles.GetEnumerator();
        //while (itr.MoveNext())
        //{
        //    if (itr.Current.Value.IsNative)
        //    {
        //        string assetbundlename = itr.Current.Value.AssetBundleName;
        //        string dest = DownLoadCommon.GetFileFullName(assetbundlename);

        //        //保证路径存在
        //        string directory = Path.GetDirectoryName(dest);
        //        if (!Directory.Exists(directory))
        //            Directory.CreateDirectory(directory);

        //        //拷贝数据
        //        yield return DownLoadCommon.StartCopyInitialFile(assetbundlename);
        //    }
        //}
        //itr.Dispose();
    }