feat : asset bundle collector config upgrade compatible

This commit is contained in:
hevinci
2024-03-12 11:12:13 +08:00
parent ef8229981e
commit 0a709f741a
4 changed files with 38 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ namespace YooAsset.Editor
{
public class AssetBundleCollectorConfig
{
public const string ConfigVersion = "v2.0.0";
public const string ConfigVersion = "v2.1";
public const string XmlVersion = "Version";
public const string XmlCommon = "Common";
@@ -258,6 +258,23 @@ namespace YooAsset.Editor
if (configVersion == ConfigVersion)
return true;
// v2.0.0 -> v2.1
if (configVersion == "v2.0.0")
{
// 读取包裹配置
var packageNodeList = root.GetElementsByTagName(XmlPackage);
foreach (var packageNode in packageNodeList)
{
XmlElement packageElement = packageNode as XmlElement;
if (packageElement.HasAttribute(XmlIgnoreRuleName) == false)
packageElement.SetAttribute(XmlIgnoreRuleName, nameof(NormalIgnoreRule));
}
// 更新版本
root.SetAttribute(XmlVersion, "v2.1");
return UpdateXmlConfig(xmlDoc);
}
return false;
}
}