diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs
index ba880ef..7e9b039 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs
@@ -17,6 +17,7 @@ namespace YooAsset.Editor
public const string XmlEnableAddressable = "AutoAddressable";
public const string XmlUniqueBundleName = "UniqueBundleName";
public const string XmlShowPackageView = "ShowPackageView";
+ public const string XmlShowEditorAlias = "ShowEditorAlias";
public const string XmlPackage = "Package";
public const string XmlPackageName = "PackageName";
@@ -65,6 +66,7 @@ namespace YooAsset.Editor
bool enableAddressable = false;
bool uniqueBundleName = false;
bool showPackageView = false;
+ bool showEditorAlias = false;
var commonNodeList = root.GetElementsByTagName(XmlCommon);
if (commonNodeList.Count > 0)
{
@@ -79,6 +81,7 @@ namespace YooAsset.Editor
enableAddressable = commonElement.GetAttribute(XmlEnableAddressable) == "True" ? true : false;
uniqueBundleName = commonElement.GetAttribute(XmlUniqueBundleName) == "True" ? true : false;
showPackageView = commonElement.GetAttribute(XmlShowPackageView) == "True" ? true : false;
+ showEditorAlias = commonElement.GetAttribute(XmlShowEditorAlias) == "True" ? true : false;
}
// 读取包裹配置
@@ -153,6 +156,7 @@ namespace YooAsset.Editor
AssetBundleCollectorSettingData.Setting.EnableAddressable = enableAddressable;
AssetBundleCollectorSettingData.Setting.UniqueBundleName = uniqueBundleName;
AssetBundleCollectorSettingData.Setting.ShowPackageView = showPackageView;
+ AssetBundleCollectorSettingData.Setting.ShowEditorAlias = showEditorAlias;
AssetBundleCollectorSettingData.Setting.Packages.AddRange(packages);
AssetBundleCollectorSettingData.SaveFile();
Debug.Log($"导入配置完毕!");
@@ -183,6 +187,7 @@ namespace YooAsset.Editor
commonElement.SetAttribute(XmlEnableAddressable, AssetBundleCollectorSettingData.Setting.EnableAddressable.ToString());
commonElement.SetAttribute(XmlUniqueBundleName, AssetBundleCollectorSettingData.Setting.UniqueBundleName.ToString());
commonElement.SetAttribute(XmlShowPackageView, AssetBundleCollectorSettingData.Setting.ShowPackageView.ToString());
+ commonElement.SetAttribute(XmlShowEditorAlias, AssetBundleCollectorSettingData.Setting.ShowEditorAlias.ToString());
root.AppendChild(commonElement);
// 设置Package配置
diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs
index 9f4223c..bfcc7d8 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs
@@ -23,6 +23,12 @@ namespace YooAsset.Editor
///
public bool UniqueBundleName = false;
+ ///
+ /// 是否显示编辑器别名
+ ///
+ public bool ShowEditorAlias = false;
+
+
///
/// 包裹列表
///
diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs
index bacceb5..4510313 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs
@@ -38,6 +38,22 @@ namespace YooAsset.Editor
}
}
+ private static string GetEditorShowName(string name,Type type)
+ {
+ if (Setting != null && Setting.ShowEditorAlias)
+ {
+ var attr = YooAssetAttributes.GetAttribute(type);
+ if (attr != null && !string.IsNullOrEmpty(attr.Name))
+ return attr.Name;
+ else
+ return name;
+ }
+ else
+ {
+ return name;
+ }
+ }
+
public static List GetActiveRuleNames()
{
if (_setting == null)
@@ -47,8 +63,8 @@ namespace YooAsset.Editor
foreach (var pair in _cacheActiveRuleTypes)
{
names.Add(pair.Key);
- }
- return names;
+ }
+ return names;
}
public static List GetAddressRuleNames()
{
@@ -58,7 +74,7 @@ namespace YooAsset.Editor
List names = new List();
foreach (var pair in _cacheAddressRuleTypes)
{
- names.Add(pair.Key);
+ names.Add(GetEditorShowName(pair.Key, pair.Value));
}
return names;
}
@@ -70,7 +86,7 @@ namespace YooAsset.Editor
List names = new List();
foreach (var pair in _cachePackRuleTypes)
{
- names.Add(pair.Key);
+ names.Add(GetEditorShowName(pair.Key, pair.Value));
}
return names;
}
@@ -82,7 +98,7 @@ namespace YooAsset.Editor
List names = new List();
foreach (var pair in _cacheFilterRuleTypes)
{
- names.Add(pair.Key);
+ names.Add(GetEditorShowName(pair.Key, pair.Value));
}
return names;
}
@@ -353,6 +369,12 @@ namespace YooAsset.Editor
IsDirty = true;
}
+ public static void ModifyShowEditorAlias(bool showAlias)
+ {
+ Setting.ShowEditorAlias = showAlias;
+ IsDirty = true;
+ }
+
// 资源包裹编辑相关
public static AssetBundleCollectorPackage CreatePackage(string packageName)
{
diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs
index 8be6013..154d8f4 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs
@@ -28,6 +28,7 @@ namespace YooAsset.Editor
private Toggle _showPackageToogle;
private Toggle _enableAddressableToogle;
private Toggle _uniqueBundleNameToogle;
+ private Toggle _showEditorAliasToggle;
private VisualElement _packageContainer;
private ListView _packageListView;
@@ -57,14 +58,12 @@ namespace YooAsset.Editor
{
_collectorTypeList = new List()
{
- $"{nameof(ECollectorType.MainAssetCollector)}",
- $"{nameof(ECollectorType.StaticAssetCollector)}",
- $"{nameof(ECollectorType.DependAssetCollector)}"
- };
- _activeRuleList = AssetBundleCollectorSettingData.GetActiveRuleNames();
- _addressRuleList = AssetBundleCollectorSettingData.GetAddressRuleNames();
- _packRuleList = AssetBundleCollectorSettingData.GetPackRuleNames();
- _filterRuleList = AssetBundleCollectorSettingData.GetFilterRuleNames();
+ $"{nameof(ECollectorType.MainAssetCollector)}",
+ $"{nameof(ECollectorType.StaticAssetCollector)}",
+ $"{nameof(ECollectorType.DependAssetCollector)}"
+ };
+
+ RefreshNames();
VisualElement root = this.rootVisualElement;
@@ -95,6 +94,14 @@ namespace YooAsset.Editor
RefreshWindow();
});
+ _showEditorAliasToggle = root.Q("ShowEditorAlias");
+ _showEditorAliasToggle.RegisterValueChangedCallback(evt =>
+ {
+ AssetBundleCollectorSettingData.ModifyShowEditorAlias(evt.newValue);
+ RefreshNames();
+ RefreshWindow();
+ });
+
// 配置修复按钮
var fixBtn = root.Q