[add]Add ShowEditorAlias 添加显示编辑器名字

This commit is contained in:
ZensYue
2022-12-02 12:31:15 +08:00
parent 2696da092d
commit aa49980231
10 changed files with 148 additions and 15 deletions

View File

@@ -38,6 +38,22 @@ namespace YooAsset.Editor
}
}
private static string GetEditorShowName(string name,Type type)
{
if (Setting != null && Setting.ShowEditorAlias)
{
var attr = YooAssetAttributes.GetAttribute<EditorShowAttribute>(type);
if (attr != null && !string.IsNullOrEmpty(attr.Name))
return attr.Name;
else
return name;
}
else
{
return name;
}
}
public static List<string> 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<string> GetAddressRuleNames()
{
@@ -58,7 +74,7 @@ namespace YooAsset.Editor
List<string> names = new List<string>();
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<string> names = new List<string>();
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<string> names = new List<string>();
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)
{