mirror of https://github.com/tuyoogame/YooAsset
fix #130
parent
995b0c8050
commit
057ff6b22b
|
@ -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);
|
||||||
|
|
|
@ -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,16 +101,8 @@ 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);
|
||||||
{
|
return package.GetAllTags();
|
||||||
if (package.PackageName == packageName)
|
|
||||||
{
|
|
||||||
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 !");
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取包裹类
|
||||||
|
/// </summary>
|
||||||
|
public AssetBundleCollectorPackage GetPackage(string packageName)
|
||||||
|
{
|
||||||
foreach (var package in Packages)
|
foreach (var package in Packages)
|
||||||
{
|
{
|
||||||
if (package.PackageName == packageName)
|
if (package.PackageName == packageName)
|
||||||
{
|
return package;
|
||||||
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 pacakge : {packageName}");
|
||||||
throw new Exception($"Not found collector pacakge : {packageName}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue