mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-19 14:50:10 +00:00
fix #617
This commit is contained in:
@@ -32,6 +32,7 @@ namespace YooAsset.Editor
|
||||
PackageManifest manifest = new PackageManifest();
|
||||
manifest.FileVersion = ManifestDefine.FileVersion;
|
||||
manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
||||
manifest.SupportExtensionless = buildMapContext.Command.SupportExtensionless;
|
||||
manifest.LocationToLower = buildMapContext.Command.LocationToLower;
|
||||
manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
||||
manifest.OutputNameStyle = (int)buildParameters.FileNameStyle;
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace YooAsset.Editor
|
||||
// 收集器配置
|
||||
buildReport.Summary.UniqueBundleName = buildMapContext.Command.UniqueBundleName;
|
||||
buildReport.Summary.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
||||
buildReport.Summary.SupportExtensionless = buildMapContext.Command.SupportExtensionless;
|
||||
buildReport.Summary.LocationToLower = buildMapContext.Command.LocationToLower;
|
||||
buildReport.Summary.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
||||
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
public class AssetBundleCollectorConfig
|
||||
{
|
||||
public const string ConfigVersion = "v2.1";
|
||||
public const string ConfigVersion = "v2025.8.28";
|
||||
|
||||
public const string XmlVersion = "Version";
|
||||
public const string XmlCommon = "Common";
|
||||
@@ -23,6 +23,7 @@ namespace YooAsset.Editor
|
||||
public const string XmlPackageName = "PackageName";
|
||||
public const string XmlPackageDesc = "PackageDesc";
|
||||
public const string XmlEnableAddressable = "AutoAddressable";
|
||||
public const string XmlSupportExtensionless = "SupportExtensionless";
|
||||
public const string XmlLocationToLower = "LocationToLower";
|
||||
public const string XmlIncludeAssetGUID = "IncludeAssetGUID";
|
||||
public const string XmlIgnoreRuleName = "IgnoreRuleName";
|
||||
@@ -99,6 +100,7 @@ namespace YooAsset.Editor
|
||||
package.PackageName = packageElement.GetAttribute(XmlPackageName);
|
||||
package.PackageDesc = packageElement.GetAttribute(XmlPackageDesc);
|
||||
package.EnableAddressable = packageElement.GetAttribute(XmlEnableAddressable) == "True" ? true : false;
|
||||
package.SupportExtensionless = packageElement.GetAttribute(XmlSupportExtensionless) == "True" ? true : false;
|
||||
package.LocationToLower = packageElement.GetAttribute(XmlLocationToLower) == "True" ? true : false;
|
||||
package.IncludeAssetGUID = packageElement.GetAttribute(XmlIncludeAssetGUID) == "True" ? true : false;
|
||||
package.IgnoreRuleName = packageElement.GetAttribute(XmlIgnoreRuleName);
|
||||
@@ -211,6 +213,7 @@ namespace YooAsset.Editor
|
||||
packageElement.SetAttribute(XmlPackageName, package.PackageName);
|
||||
packageElement.SetAttribute(XmlPackageDesc, package.PackageDesc);
|
||||
packageElement.SetAttribute(XmlEnableAddressable, package.EnableAddressable.ToString());
|
||||
packageElement.SetAttribute(XmlSupportExtensionless, package.SupportExtensionless.ToString());
|
||||
packageElement.SetAttribute(XmlLocationToLower, package.LocationToLower.ToString());
|
||||
packageElement.SetAttribute(XmlIncludeAssetGUID, package.IncludeAssetGUID.ToString());
|
||||
packageElement.SetAttribute(XmlIgnoreRuleName, package.IgnoreRuleName);
|
||||
@@ -275,6 +278,23 @@ namespace YooAsset.Editor
|
||||
return UpdateXmlConfig(xmlDoc);
|
||||
}
|
||||
|
||||
// v2.1 -> v2025.8.28
|
||||
if (configVersion == "v2.1")
|
||||
{
|
||||
// 读取包裹配置
|
||||
var packageNodeList = root.GetElementsByTagName(XmlPackage);
|
||||
foreach (var packageNode in packageNodeList)
|
||||
{
|
||||
XmlElement packageElement = packageNode as XmlElement;
|
||||
if (packageElement.HasAttribute(XmlSupportExtensionless) == false)
|
||||
packageElement.SetAttribute(XmlSupportExtensionless, "True");
|
||||
}
|
||||
|
||||
// 更新版本
|
||||
root.SetAttribute(XmlVersion, "v2025.8.28");
|
||||
return UpdateXmlConfig(xmlDoc);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public bool EnableAddressable = false;
|
||||
|
||||
/// <summary>
|
||||
/// 支持无后缀名的资源定位地址
|
||||
/// </summary>
|
||||
public bool SupportExtensionless = true;
|
||||
|
||||
/// <summary>
|
||||
/// 资源定位地址大小写不敏感
|
||||
/// </summary>
|
||||
|
||||
@@ -111,6 +111,7 @@ namespace YooAsset.Editor
|
||||
command.UniqueBundleName = UniqueBundleName;
|
||||
command.UseAssetDependencyDB = useAssetDependencyDB;
|
||||
command.EnableAddressable = package.EnableAddressable;
|
||||
command.SupportExtensionless = package.SupportExtensionless;
|
||||
command.LocationToLower = package.LocationToLower;
|
||||
command.IncludeAssetGUID = package.IncludeAssetGUID;
|
||||
command.AutoCollectShaders = package.AutoCollectShaders;
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace YooAsset.Editor
|
||||
|
||||
private VisualElement _setting2Container;
|
||||
private Toggle _enableAddressableToogle;
|
||||
private Toggle _supportExtensionlessToogle;
|
||||
private Toggle _locationToLowerToogle;
|
||||
private Toggle _includeAssetGUIDToogle;
|
||||
private Toggle _autoCollectShadersToogle;
|
||||
@@ -131,6 +132,17 @@ namespace YooAsset.Editor
|
||||
RefreshWindow();
|
||||
}
|
||||
});
|
||||
_supportExtensionlessToogle = root.Q<Toggle>("SupportExtensionless");
|
||||
_supportExtensionlessToogle.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
var selectPackage = _packageListView.selectedItem as AssetBundleCollectorPackage;
|
||||
if (selectPackage != null)
|
||||
{
|
||||
selectPackage.SupportExtensionless = evt.newValue;
|
||||
AssetBundleCollectorSettingData.ModifyPackage(selectPackage);
|
||||
RefreshWindow();
|
||||
}
|
||||
});
|
||||
_locationToLowerToogle = root.Q<Toggle>("LocationToLower");
|
||||
_locationToLowerToogle.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
@@ -487,6 +499,7 @@ namespace YooAsset.Editor
|
||||
_packageSettingsButton.SetEnabled(true);
|
||||
_packageSettingsButton.text = $"{packageSettingName} ({selectPackage.PackageName})";
|
||||
_enableAddressableToogle.SetValueWithoutNotify(selectPackage.EnableAddressable);
|
||||
_supportExtensionlessToogle.SetValueWithoutNotify(selectPackage.SupportExtensionless);
|
||||
_locationToLowerToogle.SetValueWithoutNotify(selectPackage.LocationToLower);
|
||||
_includeAssetGUIDToogle.SetValueWithoutNotify(selectPackage.IncludeAssetGUID);
|
||||
_autoCollectShadersToogle.SetValueWithoutNotify(selectPackage.AutoCollectShaders);
|
||||
@@ -1017,8 +1030,8 @@ namespace YooAsset.Editor
|
||||
var command = new CollectCommand(packageName, ignoreRule);
|
||||
command.SimulateBuild = true;
|
||||
command.UniqueBundleName = _uniqueBundleNameToogle.value;
|
||||
command.UseAssetDependencyDB = true;
|
||||
command.EnableAddressable = _enableAddressableToogle.value;
|
||||
command.SupportExtensionless = _supportExtensionlessToogle.value;
|
||||
command.LocationToLower = _locationToLowerToogle.value;
|
||||
command.IncludeAssetGUID = _includeAssetGUIDToogle.value;
|
||||
command.AutoCollectShaders = _autoCollectShadersToogle.value;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<ui:Button text="Package Settings" display-tooltip-when-elided="true" name="PackageSettingsButton" />
|
||||
<ui:VisualElement name="PublicContainer2">
|
||||
<ui:Toggle label="Enable Addressable" name="EnableAddressable" style="width: 196px; -unity-text-align: middle-left;" />
|
||||
<ui:Toggle label="Support Extensionless" name="SupportExtensionless" 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="Auto Collect Shaders" name="AutoCollectShaders" value="true" style="width: 196px; -unity-text-align: middle-left;" />
|
||||
|
||||
@@ -34,6 +34,11 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public bool EnableAddressable { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 支持无后缀名的资源定位地址
|
||||
/// </summary>
|
||||
public bool SupportExtensionless { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 资源定位地址大小写不敏感
|
||||
/// </summary>
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace YooAsset.Editor
|
||||
// 收集器配置
|
||||
public bool UniqueBundleName;
|
||||
public bool EnableAddressable;
|
||||
public bool SupportExtensionless;
|
||||
public bool LocationToLower;
|
||||
public bool IncludeAssetGUID;
|
||||
public bool AutoCollectShaders;
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace YooAsset.Editor
|
||||
BindListViewHeader("Collect Settings");
|
||||
BindListViewItem("Unique Bundle Name", $"{buildReport.Summary.UniqueBundleName}");
|
||||
BindListViewItem("Enable Addressable", $"{buildReport.Summary.EnableAddressable}");
|
||||
BindListViewItem("Support Extensionless", $"{buildReport.Summary.SupportExtensionless}");
|
||||
BindListViewItem("Location To Lower", $"{buildReport.Summary.LocationToLower}");
|
||||
BindListViewItem("Include Asset GUID", $"{buildReport.Summary.IncludeAssetGUID}");
|
||||
BindListViewItem("Auto Collect Shaders", $"{buildReport.Summary.AutoCollectShaders}");
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace YooAsset
|
||||
|
||||
// 写入文件头信息
|
||||
buffer.WriteBool(manifest.EnableAddressable);
|
||||
buffer.WriteBool(manifest.SupportExtensionless);
|
||||
buffer.WriteBool(manifest.LocationToLower);
|
||||
buffer.WriteBool(manifest.IncludeAssetGUID);
|
||||
buffer.WriteInt32(manifest.OutputNameStyle);
|
||||
@@ -153,6 +154,7 @@ namespace YooAsset
|
||||
// 读取文件头信息
|
||||
manifest.FileVersion = fileVersion;
|
||||
manifest.EnableAddressable = buffer.ReadBool();
|
||||
manifest.SupportExtensionless = buffer.ReadBool();
|
||||
manifest.LocationToLower = buffer.ReadBool();
|
||||
manifest.IncludeAssetGUID = buffer.ReadBool();
|
||||
manifest.OutputNameStyle = buffer.ReadInt32();
|
||||
@@ -280,13 +282,16 @@ namespace YooAsset
|
||||
manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath);
|
||||
|
||||
// 添加无后缀名路径的映射
|
||||
string locationWithoutExtension = Path.ChangeExtension(location, null);
|
||||
if (ReferenceEquals(location, locationWithoutExtension) == false)
|
||||
if (manifest.SupportExtensionless)
|
||||
{
|
||||
if (manifest.AssetPathMapping1.ContainsKey(locationWithoutExtension))
|
||||
YooLogger.Warning($"Location have existed : {locationWithoutExtension}");
|
||||
else
|
||||
manifest.AssetPathMapping1.Add(locationWithoutExtension, packageAsset.AssetPath);
|
||||
string locationWithoutExtension = Path.ChangeExtension(location, null);
|
||||
if (ReferenceEquals(location, locationWithoutExtension) == false)
|
||||
{
|
||||
if (manifest.AssetPathMapping1.ContainsKey(locationWithoutExtension))
|
||||
YooLogger.Warning($"Location have existed : {locationWithoutExtension}");
|
||||
else
|
||||
manifest.AssetPathMapping1.Add(locationWithoutExtension, packageAsset.AssetPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ namespace YooAsset
|
||||
Manifest = new PackageManifest();
|
||||
Manifest.FileVersion = fileVersion;
|
||||
Manifest.EnableAddressable = _buffer.ReadBool();
|
||||
Manifest.SupportExtensionless = _buffer.ReadBool();
|
||||
Manifest.LocationToLower = _buffer.ReadBool();
|
||||
Manifest.IncludeAssetGUID = _buffer.ReadBool();
|
||||
Manifest.OutputNameStyle = _buffer.ReadInt32();
|
||||
|
||||
@@ -13,6 +13,11 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public bool EnableAddressable;
|
||||
|
||||
/// <summary>
|
||||
/// 支持无后缀名的资源定位地址
|
||||
/// </summary>
|
||||
public bool SupportExtensionless;
|
||||
|
||||
/// <summary>
|
||||
/// 资源定位地址大小写不敏感
|
||||
/// </summary>
|
||||
|
||||
@@ -21,6 +21,11 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public bool EnableAddressable;
|
||||
|
||||
/// <summary>
|
||||
/// 支持无后缀名的资源定位地址
|
||||
/// </summary>
|
||||
public bool SupportExtensionless;
|
||||
|
||||
/// <summary>
|
||||
/// 资源定位地址大小写不敏感
|
||||
/// </summary>
|
||||
@@ -116,6 +121,7 @@ namespace YooAsset
|
||||
PackageDetails details = new PackageDetails();
|
||||
details.FileVersion = FileVersion;
|
||||
details.EnableAddressable = EnableAddressable;
|
||||
details.SupportExtensionless = SupportExtensionless;
|
||||
details.LocationToLower = LocationToLower;
|
||||
details.IncludeAssetGUID = IncludeAssetGUID;
|
||||
details.OutputNameStyle = OutputNameStyle;
|
||||
|
||||
Reference in New Issue
Block a user