Example #1
0
    public static List <string> CheckShaderLods(string[] allFiles, int minLod = 100)
    {
        if (allFiles == null)
        {
            return(null);
        }

        List <string> shader_infos = new List <string>();

        for (int i = 0; i < allFiles.Length; i++)
        {
            string file = allFiles[i];
            PackAssetBundleUtlis.ShowProgress(i, allFiles.Length, "检测ShaderLOD", file);

            int shader_lod = GetShaderLOD(file);
            if (shader_lod <= minLod)
            {
                continue;
            }

            shader_infos.Add(string.Format("{0} ----- minLod = {1}", file, shader_lod));
        }

        EditorUtility.ClearProgressBar();
        return(shader_infos);
    }
Example #2
0
    static IEnumerator DisposeSceneAsync()
    {
        string[] scenePaths = Directory.GetFiles(ResourceConst.ScenePath, "*.unity");
        if (scenePaths == null || scenePaths.Length < 1)
        {
            yield break;
        }

        for (int i = 0; i < scenePaths.Length; i++)
        {
            string scenePath = scenePaths[i];
            PackAssetBundleUtlis.ShowProgress(i, scenePaths.Length, "分析场景:", scenePath);
            DisposeSingleScene(scenePath);
            yield return(1);
        }

        string[] sceneConfPaths = Directory.GetFiles(ResourceConst.ScenePath, "*.asset");
        if (sceneConfPaths == null || sceneConfPaths.Length < 1)
        {
            yield break;
        }

        foreach (string sceneConf in sceneConfPaths)
        {
            _packTools.PushAssetBuild(sceneConf, ResourceConst.bundleSceneConf);
        }

        EditorUtility.ClearProgressBar();
    }
Example #3
0
    public static void BuildFileList(bool show_dialog)
    {
        Clear();

        DateTime dt1 = System.DateTime.UtcNow;
        // 获取AssetBundleManifest;
        string manifestPath          = string.Format("{0}/{1}", PackAssetBundle.bundleBuildFolder, ResourceConst.PkgBundleFolder);
        AssetBundleManifest manifest = PackBundleTools.GetAssetBundleManifest(manifestPath);

        if (manifest == null)
        {
            return;
        }

        // 计算总控文件;
        AddBundleInfo(ResourceConst.PkgBundleFolder, ref s_FileList);

        // 计算Config;
        AddConfInfo(s_FileList);

        // 计算其它文件;
        string[] allBundleKeyList = manifest.GetAllAssetBundles();
        for (int i = 0; i < allBundleKeyList.Length; i++)
        {
            string file = allBundleKeyList[i];
            if (string.IsNullOrEmpty(file))
            {
                continue;
            }
            AddBundleInfo(file, ref s_FileList);

            PackAssetBundleUtlis.ShowProgress(i, allBundleKeyList.Length, "计算MD5:", file);
        }
        EditorUtility.ClearProgressBar();

        string   strFileList = string.Format("{0}.txt", ResourceConst.FileListName);
        DateTime dt2         = System.DateTime.UtcNow;

        BuildCommon.WriteJsonToFile(PackAssetBundle.bundleBuildFolder, strFileList, s_FileList);

        FileDepencies.WriteMd5Info();

        DateTime dt3 = System.DateTime.UtcNow;

        BuildFileListAssetBundle(PackAssetBundle.bundleBuildFolder, strFileList, ResourceConst.FileListName);

        DateTime dt4 = System.DateTime.UtcNow;

        if (show_dialog)
        {
            string info = string.Format("FileList生成完成,总时长{0}秒", (dt4 - dt1).TotalSeconds.ToString("f1"));
            EditorUtility.DisplayDialog("打包完成", info, "好的");
        }
    }
Example #4
0
    static ArtResourceFileList BuildMD5()
    {
        ArtResourceFileList filelist = new ArtResourceFileList();

        filelist.m_BuildTime = System.DateTime.Now.ToString();

        for (int i = 0; i < s_AllArtsFiles.Count; i++)
        {
            string path = s_AllArtsFiles[i];
            string md5  = GetUnityFileMD5(path);
            //ArtResourceInfo info = new ArtResourceInfo();
            //info.mFilePath = path;
            //info.mFileMD5 = md5;

            filelist.m_ResourceInfoList.Add(path, md5);

            PackAssetBundleUtlis.ShowProgress(i, s_AllArtsFiles.Count, "计算MD5:", path);
        }
        EditorUtility.ClearProgressBar();

        return(filelist);
    }
Example #5
0
    static void DisposeSceneRes()
    {
        string[] scenePaths = Directory.GetFiles(ResourceConst.ScenePath, "*.unity");
        if (scenePaths == null || scenePaths.Length < 1)
        {
            return;
        }

        string[] sceneConfPaths = Directory.GetFiles(ResourceConst.ScenePath, "*.asset");
        foreach (string sceneConf in sceneConfPaths)
        {
            DisposeAsset(sceneConf);
        }

        for (int i = 0; i < scenePaths.Length; i++)
        {
            string scenePath = scenePaths[i];
            PackAssetBundleUtlis.ShowProgress(i, scenePaths.Length, "分析场景资源:", scenePath);

            DisposeAsset(scenePath);
        }
        EditorUtility.ClearProgressBar();
    }
Example #6
0
    // 处理场景资源;
    static void DisposeScene()
    {
        string[] scenePaths = null;
        try
        {
            scenePaths = Directory.GetFiles(ResourceConst.ScenePath, "*.unity");
        }
        catch (System.Exception ex)
        {
            Debug.LogError(ex.ToString());
        }

        if (scenePaths == null || scenePaths.Length < 1)
        {
            return;
        }

        for (int i = 0; i < scenePaths.Length; i++)
        {
            string scenePath = scenePaths[i];
            PackAssetBundleUtlis.ShowProgress(i, scenePaths.Length, "分析场景:", scenePath);
            DisposeSingleScene(scenePath);
        }

        string[] sceneConfPaths = Directory.GetFiles(ResourceConst.ScenePath, "*.asset");
        if (sceneConfPaths == null || sceneConfPaths.Length < 1)
        {
            return;
        }

        foreach (string sceneConf in sceneConfPaths)
        {
            _packTools.PushAssetBuild(sceneConf, ResourceConst.bundleSceneConf);
        }

        EditorUtility.ClearProgressBar();
    }