namespace YooAsset.Editor { public enum ECollectFlags { None = 0, /// /// 不收集依赖资源 /// IgnoreGetDependencies = 1 << 0, /// /// 忽略静态收集器 /// IgnoreStaticCollector = 1 << 1, /// /// 忽略依赖收集器 /// IgnoreDependCollector = 1 << 2, } public class CollectCommand { /// /// 包裹名称 /// public string PackageName { private set; get; } /// /// 忽略规则实例 /// public IIgnoreRule IgnoreRule { private set; get; } /// /// 模拟构建模式 /// public bool SimulateBuild { set { SetFlag(ECollectFlags.IgnoreGetDependencies, value); SetFlag(ECollectFlags.IgnoreStaticCollector, value); SetFlag(ECollectFlags.IgnoreDependCollector, value); } } /// /// 窗口收集模式 /// public int CollectFlags { set; get; } = 0; /// /// 资源包名唯一化 /// public bool UniqueBundleName { set; get; } /// /// 使用资源依赖数据库 /// public bool UseAssetDependencyDB { set; get; } /// /// 启用可寻址资源定位 /// public bool EnableAddressable { set; get; } /// /// 支持无后缀名的资源定位地址 /// public bool SupportExtensionless { set; get; } /// /// 资源定位地址大小写不敏感 /// public bool LocationToLower { set; get; } /// /// 包含资源GUID数据 /// public bool IncludeAssetGUID { set; get; } /// /// 自动收集所有着色器 /// public bool AutoCollectShaders { set; get; } private AssetDependencyCache _assetDependency; public AssetDependencyCache AssetDependency { get { if (_assetDependency == null) _assetDependency = new AssetDependencyCache(UseAssetDependencyDB); return _assetDependency; } } public CollectCommand(string packageName, IIgnoreRule ignoreRule) { PackageName = packageName; IgnoreRule = ignoreRule; } /// /// 设置标记位 /// public void SetFlag(ECollectFlags flag, bool isOn) { if (isOn) CollectFlags |= (int)flag; // 开启指定标志位 else CollectFlags &= ~(int)flag; // 关闭指定标志位 } /// /// 查询标记位 /// public bool IsFlagSet(ECollectFlags flag) { return (CollectFlags & (int)flag) != 0; } } }