diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs
index 141365a..adf6910 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs
@@ -45,16 +45,11 @@ namespace YooAsset.Editor
///
public string AssetTags = string.Empty;
-
///
- /// 可寻址路径
+ /// 用户自定义数据
///
- public string Address = string.Empty;
+ public string UserData = string.Empty;
- ///
- /// 跨平台
- ///
- public bool IsMultiPlatform = false;
///
/// 收集器是否有效
@@ -173,20 +168,6 @@ namespace YooAsset.Editor
{
if (IsValidateAsset(assetPath, isRawFilePackRule) && IsCollectAsset(assetPath))
{
- if (IsMultiPlatform)
- {
- string platform = "Windows";
-#if UNITY_ANDROID
- platform = "Android";
-#elif UNITY_IOS
- platform = "iOS";
-#elif UNITY_STANDALONE_OSX
- platform = "OSX";
-#endif
- if (!assetPath.Contains(platform))
- continue;
- }
-
if (result.ContainsKey(assetPath) == false)
{
var collectAssetInfo = CreateCollectAssetInfo(command, group, assetPath, isRawFilePackRule);
@@ -329,7 +310,7 @@ namespace YooAsset.Editor
return string.Empty;
IAddressRule addressRuleInstance = AssetBundleCollectorSettingData.GetAddressRuleInstance(AddressRuleName);
- string adressValue = addressRuleInstance.GetAssetAddress(new AddressRuleData(assetPath, CollectPath, group.GroupName, Address, IsMultiPlatform));
+ string adressValue = addressRuleInstance.GetAssetAddress(new AddressRuleData(assetPath, CollectPath, group.GroupName, UserData));
return adressValue;
}
private string GetBundleName(CollectCommand command, AssetBundleCollectorGroup group, string assetPath)
@@ -345,7 +326,7 @@ namespace YooAsset.Editor
{
// 获取其它资源打包规则结果
IPackRule packRuleInstance = AssetBundleCollectorSettingData.GetPackRuleInstance(PackRuleName);
- PackRuleResult packRuleResult = packRuleInstance.GetPackRuleResult(new PackRuleData(assetPath, CollectPath, group.GroupName));
+ PackRuleResult packRuleResult = packRuleInstance.GetPackRuleResult(new PackRuleData(assetPath, CollectPath, group.GroupName, UserData));
return packRuleResult.GetMainBundleName(command.PackageName, command.UniqueBundleName);
}
}
diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs
index 1996b0a..9c43cfe 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs
@@ -10,7 +10,7 @@ namespace YooAsset.Editor
{
public class AssetBundleCollectorConfig
{
- public const string ConfigVersion = "2.2";
+ public const string ConfigVersion = "2.3";
public const string XmlVersion = "Version";
public const string XmlCommon = "Common";
@@ -34,6 +34,7 @@ namespace YooAsset.Editor
public const string XmlAddressRule = "AddressRule";
public const string XmlPackRule = "PackRule";
public const string XmlFilterRule = "FilterRule";
+ public const string XmlUserData = "UserData";
public const string XmlAssetTags = "AssetTags";
///
@@ -137,6 +138,8 @@ namespace YooAsset.Editor
throw new Exception($"Not found attribute {XmlPackRule} in {XmlCollector}");
if (collectorElement.HasAttribute(XmlFilterRule) == false)
throw new Exception($"Not found attribute {XmlFilterRule} in {XmlCollector}");
+ if (collectorElement.HasAttribute(XmlUserData) == false)
+ throw new Exception($"Not found attribute {XmlUserData} in {XmlCollector}");
if (collectorElement.HasAttribute(XmlAssetTags) == false)
throw new Exception($"Not found attribute {XmlAssetTags} in {XmlCollector}");
@@ -147,6 +150,7 @@ namespace YooAsset.Editor
collector.AddressRuleName = collectorElement.GetAttribute(XmlAddressRule);
collector.PackRuleName = collectorElement.GetAttribute(XmlPackRule);
collector.FilterRuleName = collectorElement.GetAttribute(XmlFilterRule);
+ collector.UserData = collectorElement.GetAttribute(XmlUserData);
collector.AssetTags = collectorElement.GetAttribute(XmlAssetTags);
group.Collectors.Add(collector);
}
@@ -219,6 +223,7 @@ namespace YooAsset.Editor
collectorElement.SetAttribute(XmlAddressRule, collector.AddressRuleName);
collectorElement.SetAttribute(XmlPackRule, collector.PackRuleName);
collectorElement.SetAttribute(XmlFilterRule, collector.FilterRuleName);
+ collectorElement.SetAttribute(XmlUserData, collector.UserData);
collectorElement.SetAttribute(XmlAssetTags, collector.AssetTags);
groupElement.AppendChild(collectorElement);
}
@@ -320,6 +325,28 @@ namespace YooAsset.Editor
return UpdateXmlConfig(xmlDoc);
}
+ // 2.2 -> 2.3
+ if (configVersion == "2.2")
+ {
+ // 获取所有分组元素
+ var groupNodeList = root.GetElementsByTagName(XmlGroup);
+ foreach (var groupNode in groupNodeList)
+ {
+ XmlElement groupElement = groupNode as XmlElement;
+ var collectorNodeList = groupElement.GetElementsByTagName(XmlCollector);
+ foreach (var collectorNode in collectorNodeList)
+ {
+ XmlElement collectorElement = collectorNode as XmlElement;
+ if (collectorElement.HasAttribute(XmlUserData) == false)
+ collectorElement.SetAttribute(XmlUserData, string.Empty);
+ }
+ }
+
+ // 更新版本
+ root.SetAttribute(XmlVersion, "2.3");
+ return UpdateXmlConfig(xmlDoc);
+ }
+
return false;
}
}
diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs
index 55600c4..a3f1a28 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs
@@ -108,7 +108,7 @@ namespace YooAsset.Editor
List types = new List(100)
{
typeof(AddressByFileName),
- typeof(AddressByCollectorAndFileName),
+ typeof(AddressByFolderAndFileName),
typeof(AddressByGroupAndFileName)
};
diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs
index 3b96ed7..a6a9bf1 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs
@@ -582,18 +582,6 @@ namespace YooAsset.Editor
label.style.width = 90;
elementBottom.Add(label);
}
- {
- var textField = new TextField();
- textField.name = "TextField0";
- textField.label = "Address";
- textField.style.unityTextAlign = TextAnchor.MiddleLeft;
- textField.style.flexGrow = 1f;
- elementBottom.Add(textField);
- var label = textField.Q
- [DisplayName("以文件路径作为资源包名")]
+ [DisplayName("资源包名: 文件路径")]
public class PackSeparately : IPackRule
{
PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data)
@@ -57,7 +57,7 @@ namespace YooAsset.Editor
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop_image.bundle"
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop_view.bundle"
///
- [DisplayName("以父类文件夹路径作为资源包名")]
+ [DisplayName("资源包名: 父类文件夹路径")]
public class PackDirectory : IPackRule
{
public static PackDirectory StaticPackRule = new PackDirectory();
@@ -82,7 +82,7 @@ namespace YooAsset.Editor
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop.bundle"
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop.bundle"
///
- [DisplayName("以收集器路径下顶级文件夹为资源包名")]
+ [DisplayName("资源包名: 收集器下顶级文件夹路径")]
public class PackTopDirectory : IPackRule
{
PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data)
@@ -114,7 +114,7 @@ namespace YooAsset.Editor
/// 以收集器路径作为资源包名
/// 注意:收集的所有文件打进一个资源包
///
- [DisplayName("以收集器路径作为资源包名")]
+ [DisplayName("资源包名: 收集器路径")]
public class PackCollector : IPackRule
{
PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data)
@@ -144,7 +144,7 @@ namespace YooAsset.Editor
/// 以分组名称作为资源包名
/// 注意:收集的所有文件打进一个资源包
///
- [DisplayName("以分组名称作为资源包名")]
+ [DisplayName("资源包名: 分组名称")]
public class PackGroup : IPackRule
{
PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data)
@@ -162,7 +162,6 @@ namespace YooAsset.Editor
///
/// 打包原生文件
- /// 注意:原生文件打包支持:图片,音频,视频,文本
///
[DisplayName("打包原生文件")]
public class PackRawFile : IPackRule
@@ -183,7 +182,7 @@ namespace YooAsset.Editor
///
/// 打包着色器变种集合
///
- [DisplayName("打包着色器变种集合")]
+ [DisplayName("打包着色器变种集合文件")]
public class PackShaderVariants : IPackRule
{
public PackRuleResult GetPackRuleResult(PackRuleData data)
diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/IAddressRule.cs b/Assets/YooAsset/Editor/AssetBundleCollector/IAddressRule.cs
index d541791..7b4f609 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/IAddressRule.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/IAddressRule.cs
@@ -6,16 +6,14 @@ namespace YooAsset.Editor
public string AssetPath;
public string CollectPath;
public string GroupName;
- public string Address;
- public bool IsMultiPlatform;
+ public string UserData;
- public AddressRuleData(string assetPath, string collectPath, string groupName, string address, bool isMultiPlatform)
+ public AddressRuleData(string assetPath, string collectPath, string groupName, string userData)
{
AssetPath = assetPath;
CollectPath = collectPath;
GroupName = groupName;
- Address = address;
- IsMultiPlatform = isMultiPlatform;
+ UserData = userData;
}
}
diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/IPackRule.cs b/Assets/YooAsset/Editor/AssetBundleCollector/IPackRule.cs
index 7593baa..3e45713 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/IPackRule.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/IPackRule.cs
@@ -6,18 +6,21 @@ namespace YooAsset.Editor
public string AssetPath;
public string CollectPath;
public string GroupName;
+ public string UserData;
public PackRuleData(string assetPath)
{
AssetPath = assetPath;
CollectPath = string.Empty;
GroupName = string.Empty;
+ UserData = string.Empty;
}
- public PackRuleData(string assetPath, string collectPath, string groupName)
+ public PackRuleData(string assetPath, string collectPath, string groupName, string userData)
{
AssetPath = assetPath;
CollectPath = collectPath;
GroupName = groupName;
+ UserData = userData;
}
}