pull/150/head
hevinci 2023-08-17 21:05:21 +08:00
parent 995b0c8050
commit 057ff6b22b
3 changed files with 32 additions and 25 deletions

View File

@ -33,7 +33,7 @@ namespace YooAsset.Editor
Dictionary<string, BuildAssetInfo> allBuildAssetInfoDic = new Dictionary<string, BuildAssetInfo>(1000);
// 1. 检测配置合法性
AssetBundleCollectorSettingData.Setting.CheckConfigError();
AssetBundleCollectorSettingData.Setting.CheckPackageConfigError(packageName);
// 2. 获取所有收集器收集的资源
var collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(buildMode, packageName);

View File

@ -61,9 +61,18 @@ namespace YooAsset.Editor
}
/// <summary>
/// 检测配置错误
/// 检测包裹配置错误
/// </summary>
public void CheckConfigError()
public void CheckPackageConfigError(string packageName)
{
var package = GetPackage(packageName);
package.CheckConfigError();
}
/// <summary>
/// 检测所有配置错误
/// </summary>
public void CheckAllPackageConfigError()
{
foreach (var package in Packages)
{
@ -72,9 +81,9 @@ namespace YooAsset.Editor
}
/// <summary>
/// 修复配置错误
/// 修复所有配置错误
/// </summary>
public bool FixConfigError()
public bool FixAllPackageConfigError()
{
bool isFixed = false;
foreach (var package in Packages)
@ -92,17 +101,9 @@ namespace YooAsset.Editor
/// </summary>
public List<string> GetPackageAllTags(string packageName)
{
foreach (var package in Packages)
{
if (package.PackageName == packageName)
{
var package = GetPackage(packageName);
return package.GetAllTags();
}
}
Debug.LogWarning($"Not found package : {packageName}");
return new List<string>();
}
/// <summary>
/// 获取包裹收集的资源文件
@ -112,19 +113,25 @@ namespace YooAsset.Editor
if (string.IsNullOrEmpty(packageName))
throw new Exception("Build package name is null or mepty !");
foreach (var package in Packages)
{
if (package.PackageName == packageName)
{
var package = GetPackage(packageName);
CollectCommand command = new CollectCommand(buildMode, packageName,
EnableAddressable, LocationToLower, IncludeAssetGUID, UniqueBundleName);
CollectResult collectResult = new CollectResult(command);
collectResult.SetCollectAssets(package.GetAllCollectAssets(command));
return collectResult;
}
}
throw new Exception($"Not found collector pacakge : {packageName}");
/// <summary>
/// 获取包裹类
/// </summary>
public AssetBundleCollectorPackage GetPackage(string packageName)
{
foreach (var package in Packages)
{
if (package.PackageName == packageName)
return package;
}
throw new Exception($"Not found pacakge : {packageName}");
}
}
}

View File

@ -161,7 +161,7 @@ namespace YooAsset.Editor
/// </summary>
public static void FixFile()
{
bool isFixed = Setting.FixConfigError();
bool isFixed = Setting.FixAllPackageConfigError();
if (isFixed)
{
IsDirty = true;