Update editor logic

资源收集界面规则选项显示别名
This commit is contained in:
hevinci
2022-12-03 23:16:04 +08:00
parent 81401ca0b8
commit 32268f5a4a
12 changed files with 246 additions and 282 deletions

View File

@@ -10,7 +10,7 @@ namespace YooAsset.Editor
{
public class AssetBundleCollectorConfig
{
public const string ConfigVersion = "2.1";
public const string ConfigVersion = "2.2";
public const string XmlVersion = "Version";
public const string XmlCommon = "Common";
@@ -77,6 +77,8 @@ namespace YooAsset.Editor
throw new Exception($"Not found attribute {XmlUniqueBundleName} in {XmlCommon}");
if (commonElement.HasAttribute(XmlShowPackageView) == false)
throw new Exception($"Not found attribute {XmlShowPackageView} in {XmlCommon}");
if (commonElement.HasAttribute(XmlShowEditorAlias) == false)
throw new Exception($"Not found attribute {XmlShowEditorAlias} in {XmlCommon}");
enableAddressable = commonElement.GetAttribute(XmlEnableAddressable) == "True" ? true : false;
uniqueBundleName = commonElement.GetAttribute(XmlUniqueBundleName) == "True" ? true : false;
@@ -301,6 +303,23 @@ namespace YooAsset.Editor
return UpdateXmlConfig(xmlDoc);
}
// 2.1 -> 2.2
if (configVersion == "2.1")
{
// 添加公共元素属性
var commonNodeList = root.GetElementsByTagName(XmlCommon);
if (commonNodeList.Count > 0)
{
XmlElement commonElement = commonNodeList[0] as XmlElement;
if (commonElement.HasAttribute(XmlShowEditorAlias) == false)
commonElement.SetAttribute(XmlShowEditorAlias, "False");
}
// 更新版本
root.SetAttribute(XmlVersion, "2.2");
return UpdateXmlConfig(xmlDoc);
}
return false;
}
}