Пример #1
0
    static IEnumerator PackAllAssetBundleAsync(bool check)
    {
        string srcConfFolder = GetConf();

        if (string.IsNullOrEmpty(srcConfFolder))
        {
            yield break;
        }

        if (!Directory.Exists(ResourceConst.PkgBundleFolder))
        {
            Directory.CreateDirectory(ResourceConst.PkgBundleFolder);
        }

        Clear();

        DateTime dt1 = System.DateTime.UtcNow;

        // 分析场景;
        yield return(EditorCoroutineRunner.StartEditorCoroutine(DisposeSceneAsync()));

        DateTime dt2 = System.DateTime.UtcNow;

        yield return(EditorCoroutineRunner.StartEditorCoroutine(DisposeResourcesFolderAsync()));

        DateTime dt3 = System.DateTime.UtcNow;

        Build();

        DateTime dt4 = System.DateTime.UtcNow;

        // 拷贝Conf;
        PackAssetBundleUtlis.CopyFolder(srcConfFolder, bundleBuildFolder);
        FileListUtility.BuildFileList(false);
        DateTime dt5 = System.DateTime.UtcNow;

        string confFolder = Path.GetFileName(srcConfFolder);

        PackAssetBundleUtlis.CopyAssetBundle(bundleBuildFolder, ResourceConst.PkgBundleFolder, confFolder);

        DateTime dt6 = System.DateTime.UtcNow;

        string info = string.Format("bundle打包完成\n总共{0}个文件\n耗时:{1}分钟\n其中:\n"
                                    , _packTools.Count, (dt6 - dt1).TotalMinutes.ToString("f1"));

        info = string.Format("{0}分析场景资源耗时:{1}秒\n", info, (dt2 - dt1).TotalSeconds.ToString("f1"));
        info = string.Format("{0}分析Resource资源耗时:{1}秒\n", info, (dt3 - dt2).TotalSeconds.ToString("f1"));
        info = string.Format("{0}打包AssetBundle耗时:{1}秒\n", info, (dt4 - dt3).TotalSeconds.ToString("f1"));
        info = string.Format("{0}生成FileList耗时:{1}秒\n", info, (dt5 - dt4).TotalSeconds.ToString("f1"));
        info = string.Format("{0}拷贝AssetBundle耗时:{1}秒\n", info, (dt6 - dt5).TotalSeconds.ToString("f1"));

        EditorUtility.DisplayDialog("打包完成", info, "好的");

        if (check)
        {
            PackAssetBundleUtlis.CheckAllBundles();
        }
    }
Пример #2
0
 public static void CheckAllBundles()
 {
     PackAssetBundleUtlis.CheckAllBundles();
 }
Пример #3
0
    public static void PackAllAssetBundle(bool check, bool tip_dialog = true)
    {
        string srcConfFolder = GetConf(tip_dialog);

        if (string.IsNullOrEmpty(srcConfFolder))
        {
            return;
        }

        if (!Directory.Exists(ResourceConst.PkgBundleFolder))
        {
            Directory.CreateDirectory(ResourceConst.PkgBundleFolder);
        }

        Clear();

        DateTime dt1 = System.DateTime.UtcNow;

        // 分析场景;
        DisposeScene();

        DateTime dt2 = System.DateTime.UtcNow;

        DisposeResourcesInfoFolder();

        // 检查用到的Shader;
        if (!CheckShader())
        {
            return;
        }

        DateTime dt3 = System.DateTime.UtcNow;

        Build();

        DateTime dt4 = System.DateTime.UtcNow;

        // 拷贝Conf;
        PackAssetBundleUtlis.CopyFolder(srcConfFolder, bundleBuildFolder);
        FileListUtility.BuildFileList(false);

        GitUtility.PrintGitToData();
        //GitUtility.PrintGitModifyDetailToData_2();

        // 记录比较;
        string compareInfo  = PackAssetBundleUtlis.CompareFileList(BundleUpdateMode.Update_CRC);
        string compareInfo2 = PackAssetBundleUtlis.CompareFileList(BundleUpdateMode.Update_MD5);
        string compareInfo3 = PackAssetBundleUtlis.CompareFileList(BundleUpdateMode.Update_CRCANDMD5);
        string compareInfo4 = PackAssetBundleUtlis.CompareFileList(BundleUpdateMode.Update_CRCORMD5);

        DateTime dt5 = System.DateTime.UtcNow;

        string confFolder = Path.GetFileName(srcConfFolder);

        PackAssetBundleUtlis.CopyAssetBundle(bundleBuildFolder, ResourceConst.PkgBundleFolder, confFolder);

        DateTime dt6 = System.DateTime.UtcNow;
//		BuildMiniFileList.Build();
        DateTime dt7 = System.DateTime.UtcNow;
//		ExportMiniClient.Export();
        DateTime dt8 = System.DateTime.UtcNow;

        string info = string.Format("bundle打包完成\n总共{0}个文件\n耗时:{1}分钟\n其中:\n"
                                    , _packTools.Count, (dt6 - dt1).TotalMinutes.ToString("f1"));

        info = string.Format("{0}分析场景资源耗时:{1}秒\n", info, (dt2 - dt1).TotalSeconds.ToString("f1"));
        info = string.Format("{0}分析Resource资源耗时:{1}秒\n", info, (dt3 - dt2).TotalSeconds.ToString("f1"));
        info = string.Format("{0}打包AssetBundle耗时:{1}秒\n", info, (dt4 - dt3).TotalSeconds.ToString("f1"));
        info = string.Format("{0}生成FileList耗时:{1}秒\n", info, (dt5 - dt4).TotalSeconds.ToString("f1"));
        info = string.Format("{0}拷贝AssetBundle耗时:{1}秒\n", info, (dt6 - dt5).TotalSeconds.ToString("f1"));
        info = string.Format("{0}生成FileList2耗时:{1}秒\n", info, (dt7 - dt6).TotalSeconds.ToString("f1"));
        info = string.Format("{0}导出微端资源耗时:{1}秒\n", info, (dt8 - dt7).TotalSeconds.ToString("f1"));

        info = string.Format("{0}\n{1}\n", info, compareInfo);
        info = string.Format("{0}\n{1}\n", info, compareInfo2);
        info = string.Format("{0}\n{1}\n", info, compareInfo3);
        info = string.Format("{0}\n{1}\n", info, compareInfo4);

        if (tip_dialog)
        {
            EditorUtility.DisplayDialog("打包完成", info, "好的");
        }

        if (check)
        {
            PackAssetBundleUtlis.CheckAllBundles(tip_dialog);
        }
    }