mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-21 16:00:32 +00:00
Update AssetBundleGrouper
This commit is contained in:
@@ -40,7 +40,7 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public void CheckConfigError()
|
||||
{
|
||||
if(AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(CollectPath) == null)
|
||||
if (AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(CollectPath) == null)
|
||||
throw new Exception($"Invalid collect path : {CollectPath}");
|
||||
|
||||
if (AssetBundleGrouperSettingData.HasPackRuleName(PackRuleName) == false)
|
||||
@@ -137,7 +137,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// 根据规则设置过滤资源文件
|
||||
IFilterRule filterRuleInstance = AssetBundleGrouperSettingData.GetFilterRuleInstance(FilterRuleName);
|
||||
return filterRuleInstance.IsCollectAsset(assetPath);
|
||||
return filterRuleInstance.IsCollectAsset(new FilterRuleData(assetPath));
|
||||
}
|
||||
private string GetBundleName(AssetBundleGrouper grouper, string assetPath)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public class CollectAll : IFilterRule
|
||||
{
|
||||
public bool IsCollectAsset(string assetPath)
|
||||
public bool IsCollectAsset(FilterRuleData data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -20,9 +20,9 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public class CollectScene : IFilterRule
|
||||
{
|
||||
public bool IsCollectAsset(string assetPath)
|
||||
public bool IsCollectAsset(FilterRuleData data)
|
||||
{
|
||||
return Path.GetExtension(assetPath) == ".unity";
|
||||
return Path.GetExtension(data.AssetPath) == ".unity";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public class CollectPrefab : IFilterRule
|
||||
{
|
||||
public bool IsCollectAsset(string assetPath)
|
||||
public bool IsCollectAsset(FilterRuleData data)
|
||||
{
|
||||
return Path.GetExtension(assetPath) == ".prefab";
|
||||
return Path.GetExtension(data.AssetPath) == ".prefab";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public class CollectSprite : IFilterRule
|
||||
{
|
||||
public bool IsCollectAsset(string assetPath)
|
||||
public bool IsCollectAsset(FilterRuleData data)
|
||||
{
|
||||
if (AssetDatabase.GetMainAssetTypeAtPath(assetPath) == typeof(Sprite))
|
||||
if (AssetDatabase.GetMainAssetTypeAtPath(data.AssetPath) == typeof(Sprite))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
public struct FilterRuleData
|
||||
{
|
||||
public string AssetPath;
|
||||
|
||||
public FilterRuleData(string assetPath)
|
||||
{
|
||||
AssetPath = assetPath;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 资源过滤规则接口
|
||||
/// </summary>
|
||||
@@ -9,8 +19,7 @@ namespace YooAsset.Editor
|
||||
/// <summary>
|
||||
/// 是否为收集资源
|
||||
/// </summary>
|
||||
/// <param name="assetPath">资源路径</param>
|
||||
/// <returns>如果收集该资源返回TRUE</returns>
|
||||
bool IsCollectAsset(string assetPath);
|
||||
bool IsCollectAsset(FilterRuleData data);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 打包规则数据
|
||||
/// </summary>
|
||||
public struct PackRuleData
|
||||
{
|
||||
public string AssetPath;
|
||||
|
||||
Reference in New Issue
Block a user