mirror of https://github.com/tuyoogame/YooAsset
feat : asset bundle collector config upgrade compatible
parent
ef8229981e
commit
0a709f741a
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,16 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public void CheckConfigError()
|
||||
{
|
||||
if (string.IsNullOrEmpty(IgnoreRuleName))
|
||||
{
|
||||
throw new Exception($"{nameof(IgnoreRuleName)} is null or empty !");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AssetBundleCollectorSettingData.HasIgnoreRuleName(IgnoreRuleName) == false)
|
||||
throw new Exception($"Invalid {nameof(IIgnoreRule)} class type : {IgnoreRuleName} in package : {PackageName}");
|
||||
}
|
||||
|
||||
foreach (var group in Groups)
|
||||
{
|
||||
group.CheckConfigError();
|
||||
|
@ -68,6 +78,14 @@ namespace YooAsset.Editor
|
|||
public bool FixConfigError()
|
||||
{
|
||||
bool isFixed = false;
|
||||
|
||||
if (string.IsNullOrEmpty(IgnoreRuleName))
|
||||
{
|
||||
Debug.LogWarning($"Set the {nameof(IgnoreRuleName)} to {nameof(NormalIgnoreRule)}");
|
||||
IgnoreRuleName = nameof(NormalIgnoreRule);
|
||||
isFixed = true;
|
||||
}
|
||||
|
||||
foreach (var group in Groups)
|
||||
{
|
||||
if (group.FixConfigError())
|
||||
|
@ -75,6 +93,7 @@ namespace YooAsset.Editor
|
|||
isFixed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return isFixed;
|
||||
}
|
||||
|
||||
|
|
|
@ -191,6 +191,7 @@ namespace YooAsset.Editor
|
|||
if (isFixed)
|
||||
{
|
||||
IsDirty = true;
|
||||
Debug.Log("Fix package config error done !");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
<ui:Toggle label="Enable Addressable" name="EnableAddressable" style="width: 196px; -unity-text-align: middle-left;" />
|
||||
<ui:Toggle label="Location To Lower" name="LocationToLower" style="width: 196px; -unity-text-align: middle-left;" />
|
||||
<ui:Toggle label="Include Asset GUID" name="IncludeAssetGUID" style="width: 196px; -unity-text-align: middle-left;" />
|
||||
<ui:Toggle label="Ignore Default Type" name="IgnoreDefaultType" style="width: 196px; -unity-text-align: middle-left;" />
|
||||
<ui:Toggle label="Auto Collect Shaders" name="AutoCollectShaders" value="true" style="width: 196px; -unity-text-align: middle-left;" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
|
|
Loading…
Reference in New Issue