mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-30 13:38:46 +00:00
fix #644
This commit is contained in:
@@ -139,6 +139,20 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public List<CollectAssetInfo> GetAllCollectAssets(CollectCommand command, AssetBundleCollectorGroup group)
|
public List<CollectAssetInfo> GetAllCollectAssets(CollectCommand command, AssetBundleCollectorGroup group)
|
||||||
{
|
{
|
||||||
|
bool ignoreStaticCollector = command.IsFlagSet(ECollectFlags.IgnoreStaticCollector);
|
||||||
|
if (ignoreStaticCollector)
|
||||||
|
{
|
||||||
|
if (CollectorType == ECollectorType.StaticAssetCollector)
|
||||||
|
return new List<CollectAssetInfo>();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ignoreDependCollector = command.IsFlagSet(ECollectFlags.IgnoreDependCollector);
|
||||||
|
if (ignoreDependCollector)
|
||||||
|
{
|
||||||
|
if (CollectorType == ECollectorType.DependAssetCollector)
|
||||||
|
return new List<CollectAssetInfo>();
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary<string, CollectAssetInfo> result = new Dictionary<string, CollectAssetInfo>(1000);
|
Dictionary<string, CollectAssetInfo> result = new Dictionary<string, CollectAssetInfo>(1000);
|
||||||
|
|
||||||
// 收集打包资源路径
|
// 收集打包资源路径
|
||||||
@@ -262,8 +276,8 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
private List<AssetInfo> GetAllDependencies(CollectCommand command, string mainAssetPath)
|
private List<AssetInfo> GetAllDependencies(CollectCommand command, string mainAssetPath)
|
||||||
{
|
{
|
||||||
// 注意:模拟构建模式下不需要收集依赖资源
|
bool ignoreGetDependencies = command.IsFlagSet(ECollectFlags.IgnoreGetDependencies);
|
||||||
if (command.SimulateBuild)
|
if (ignoreGetDependencies)
|
||||||
return new List<AssetInfo>();
|
return new List<AssetInfo>();
|
||||||
|
|
||||||
string[] depends = command.AssetDependency.GetDependencies(mainAssetPath, true);
|
string[] depends = command.AssetDependency.GetDependencies(mainAssetPath, true);
|
||||||
|
|||||||
@@ -1028,7 +1028,7 @@ namespace YooAsset.Editor
|
|||||||
IIgnoreRule ignoreRule = AssetBundleCollectorSettingData.GetIgnoreRuleInstance(_ignoreRulePopupField.value.ClassName);
|
IIgnoreRule ignoreRule = AssetBundleCollectorSettingData.GetIgnoreRuleInstance(_ignoreRulePopupField.value.ClassName);
|
||||||
string packageName = _packageNameTxt.value;
|
string packageName = _packageNameTxt.value;
|
||||||
var command = new CollectCommand(packageName, ignoreRule);
|
var command = new CollectCommand(packageName, ignoreRule);
|
||||||
command.SimulateBuild = true;
|
command.SetFlag(ECollectFlags.IgnoreGetDependencies, true);
|
||||||
command.UniqueBundleName = _uniqueBundleNameToogle.value;
|
command.UniqueBundleName = _uniqueBundleNameToogle.value;
|
||||||
command.EnableAddressable = _enableAddressableToogle.value;
|
command.EnableAddressable = _enableAddressableToogle.value;
|
||||||
command.SupportExtensionless = _supportExtensionlessToogle.value;
|
command.SupportExtensionless = _supportExtensionlessToogle.value;
|
||||||
|
|||||||
@@ -1,6 +1,26 @@
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
|
public enum ECollectFlags
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 不收集依赖资源
|
||||||
|
/// </summary>
|
||||||
|
IgnoreGetDependencies = 1 << 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 忽略静态收集器
|
||||||
|
/// </summary>
|
||||||
|
IgnoreStaticCollector = 1 << 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 忽略依赖收集器
|
||||||
|
/// </summary>
|
||||||
|
IgnoreDependCollector = 1 << 2,
|
||||||
|
}
|
||||||
|
|
||||||
public class CollectCommand
|
public class CollectCommand
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -17,7 +37,20 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模拟构建模式
|
/// 模拟构建模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SimulateBuild { set; get; }
|
public bool SimulateBuild
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetFlag(ECollectFlags.IgnoreGetDependencies, value);
|
||||||
|
SetFlag(ECollectFlags.IgnoreStaticCollector, value);
|
||||||
|
SetFlag(ECollectFlags.IgnoreDependCollector, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 窗口收集模式
|
||||||
|
/// </summary>
|
||||||
|
public int CollectFlags { set; get; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源包名唯一化
|
/// 资源包名唯一化
|
||||||
@@ -70,5 +103,24 @@ namespace YooAsset.Editor
|
|||||||
PackageName = packageName;
|
PackageName = packageName;
|
||||||
IgnoreRule = ignoreRule;
|
IgnoreRule = ignoreRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置标记位
|
||||||
|
/// </summary>
|
||||||
|
public void SetFlag(ECollectFlags flag, bool isOn)
|
||||||
|
{
|
||||||
|
if (isOn)
|
||||||
|
CollectFlags |= (int)flag; // 开启指定标志位
|
||||||
|
else
|
||||||
|
CollectFlags &= ~(int)flag; // 关闭指定标志位
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询标记位
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFlagSet(ECollectFlags flag)
|
||||||
|
{
|
||||||
|
return (CollectFlags & (int)flag) != 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user