示例#1
0
    public static void FiltrateCoaxSleepAudio()
    {
        string needDeleteCoaxSleepAudioPath = AssetBundleHelper.NeedDeleteCoaxSleepAudioPath();

        //先把StreamingAssets下的资源删掉
        if (Directory.Exists(needDeleteCoaxSleepAudioPath))
        {
            UnityEditor.FileUtil.DeleteFileOrDirectory(needDeleteCoaxSleepAudioPath);
        }



        string originalBundlePath = AssetBundleHelper.GetOriginalBundlesPath().Replace("\\", "/") + "/";

        string outPathRoot = AssetBundleHelper.GetOutCoaxSleepAudioFolderPath();
        bool   isExists    = Directory.Exists(outPathRoot);

        if (isExists)
        {
            UnityEditor.FileUtil.DeleteFileOrDirectory(outPathRoot);
        }


        Directory.CreateDirectory(outPathRoot);


        //把OriginalBundles的资源拷贝出来
        string findPath = AssetBundleHelper.CopyCoaxSleepAudioPath();

        string[] files = Directory.GetFiles(findPath, "*", SearchOption.AllDirectories);


        for (int i = 0; i < files.Length; i++)
        {
            string filePath = files[i];
            if (filePath.EndsWith(".manifest"))
            {
                continue;
            }
            string relatePath = filePath.Replace("\\", "/").Replace(originalBundlePath, "");

            string destFile = outPathRoot + "/" + relatePath;
            var    fileInfo = new FileInfo(destFile);
            if (fileInfo.Directory.Exists == false)
            {
                fileInfo.Directory.Create();
            }
            File.Copy(filePath, destFile, true);
        }

        CreateCoaxSleepAudioJson(outPathRoot);
    }