mlyDevMerge1.5.7
hevinci 2023-08-17 21:05:21 +08:00 committed by QiJing
parent 8a74d32ac5
commit bf92e6bf18
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); Dictionary<string, BuildAssetInfo> allBuildAssetInfoDic = new Dictionary<string, BuildAssetInfo>(1000);
// 1. 检测配置合法性 // 1. 检测配置合法性
AssetBundleCollectorSettingData.Setting.CheckConfigError(); AssetBundleCollectorSettingData.Setting.CheckPackageConfigError(packageName);
// 2. 获取所有收集器收集的资源 // 2. 获取所有收集器收集的资源
var collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(buildMode, packageName); var collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(buildMode, packageName);

View File

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