static bool IsFilter(string path) { if (string.IsNullOrEmpty(path)) { return(true); } if (path.EndsWith(".cs")) { return(true); } string extension = Path.GetExtension(path); extension = extension.ToLower(); string folder = ""; if (string.Equals(extension, ".unity")) { folder = "scenes"; } string bundleName = PackAssetBundleUtlis.GetBundleName(path, folder); string bundlePath = string.Format("{0}/{1}", PackAssetBundle.bundleBuildFolder, bundleName); if (File.Exists(bundlePath)) { return(true); } return(false); }
static void DisposeSingleScene(string scenPath) { if (string.IsNullOrEmpty(scenPath)) { return; } string bundleName = string.Empty; // 打包依赖忽略文件; string sceneName = System.IO.Path.GetFileNameWithoutExtension(scenPath); string[] deps = AssetDatabase.GetDependencies(scenPath); FileDepencies.AddDepencies(scenPath, deps); if (deps != null) { for (int i = 0; i < deps.Length; i++) { string dep = deps[i]; if (PackAssetBundleUtlis.IsFilterSceneRes(dep, scenPath)) { continue; } bundleName = PackAssetBundleUtlis.GetBundleName(dep); _packTools.PushAssetBuild(dep, bundleName, false); } } //打场景本身; bundleName = PackAssetBundleUtlis.GetBundleName(scenPath, "scenes"); _packTools.PushAssetBuild(scenPath, bundleName); }
static void DisposeAsset(string path, bool check_dep = true) { if (string.IsNullOrEmpty(path)) { return; } if (PackAssetBundleUtlis.IsFilterAsset(path)) { return; } string bundleName = string.Empty; if (check_dep) { // 分析依赖; string[] deps = AssetDatabase.GetDependencies(path); FileDepencies.AddDepencies(path, deps); if (deps != null) { for (int i = 0; i < deps.Length; i++) { string dep = deps[i]; if (PackAssetBundleUtlis.IsFilterAssetDep(dep, path)) { continue; } bundleName = PackAssetBundleUtlis.GetBundleName(dep); _packTools.PushAssetBuild(dep, bundleName, false); } } } // 添加Asset自身; bundleName = PackAssetBundleUtlis.GetBundleName(path); _packTools.PushAssetBuild(path, bundleName); }