public void AddRootTargets(DirectoryInfo bundleDir, EnAssetBundleFilter type, string[] partterns = null, SearchOption searchOption = SearchOption.AllDirectories) { if (partterns == null) { partterns = new string[] { "*.*" } } ; for (int i = 0; i < partterns.Length; i++) { FileInfo[] prefabs = bundleDir.GetFiles(partterns[i], searchOption); foreach (FileInfo file in prefabs) { AssetTarget target = ABBuilderTools.Load(file, null); target.filterType = type; if (type == EnAssetBundleFilter.合并) { target.exportType = EnAssetBundleExportType.RootMerge; int index = bundleDir.FullName.IndexOf("Assets"); target.SetAbName(bundleDir.FullName.Substring(index).Replace("\\", "/") + "/" + bundleDir.Name + ABBuilderTools.AbExtension); } else { target.exportType = EnAssetBundleExportType.Root; } config.Add(target); } } }
public void SetChildDependenciesAssetBundle(AssetTarget target) { target.SetAbName(GetAbName(target.assetPath, true)); string[] dependenciesList = AssetDatabase.GetDependencies(target.assetPath); for (int k = 0; k < dependenciesList.Length; k++) { string dependenciesUrl = dependenciesList[k]; if (dependenciesUrl == target.assetPath || dependenciesUrl.EndsWith(".cs") || dependenciesUrl.EndsWith(".asset")) { continue; } AssetTarget dependenciesTarget = Get(dependenciesUrl); if (dependenciesTarget == null) { dependenciesTarget = ABBuilderTools.Load(new FileInfo(dependenciesUrl), null); Add(dependenciesTarget); } switch (dependenciesTarget.exportType) { case EnAssetBundleExportType.None: dependenciesTarget.exportType = EnAssetBundleExportType.Asset; dependenciesTarget.SetAbName(GetAbName(target.assetPath, false)); dependenciesTarget.AddParent(target.abPath); break; case EnAssetBundleExportType.Asset: dependenciesTarget.AddParent(target.abPath); if (dependenciesTarget.ParentList.Count > 1) { dependenciesTarget.SetAbName(GetAbName(dependenciesUrl, false)); dependenciesTarget.exportType = EnAssetBundleExportType.Standalone; } break; } } }
public void SetIconAssetBundle(AssetTarget target) { target.SetAbName(GetAbName(target.assetPath, false)); }