mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-23 09:10:11 +00:00
[add]Add ShowEditorAlias 添加显示编辑器名字
This commit is contained in:
@@ -17,6 +17,7 @@ namespace YooAsset.Editor
|
|||||||
public const string XmlEnableAddressable = "AutoAddressable";
|
public const string XmlEnableAddressable = "AutoAddressable";
|
||||||
public const string XmlUniqueBundleName = "UniqueBundleName";
|
public const string XmlUniqueBundleName = "UniqueBundleName";
|
||||||
public const string XmlShowPackageView = "ShowPackageView";
|
public const string XmlShowPackageView = "ShowPackageView";
|
||||||
|
public const string XmlShowEditorAlias = "ShowEditorAlias";
|
||||||
|
|
||||||
public const string XmlPackage = "Package";
|
public const string XmlPackage = "Package";
|
||||||
public const string XmlPackageName = "PackageName";
|
public const string XmlPackageName = "PackageName";
|
||||||
@@ -65,6 +66,7 @@ namespace YooAsset.Editor
|
|||||||
bool enableAddressable = false;
|
bool enableAddressable = false;
|
||||||
bool uniqueBundleName = false;
|
bool uniqueBundleName = false;
|
||||||
bool showPackageView = false;
|
bool showPackageView = false;
|
||||||
|
bool showEditorAlias = false;
|
||||||
var commonNodeList = root.GetElementsByTagName(XmlCommon);
|
var commonNodeList = root.GetElementsByTagName(XmlCommon);
|
||||||
if (commonNodeList.Count > 0)
|
if (commonNodeList.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -79,6 +81,7 @@ namespace YooAsset.Editor
|
|||||||
enableAddressable = commonElement.GetAttribute(XmlEnableAddressable) == "True" ? true : false;
|
enableAddressable = commonElement.GetAttribute(XmlEnableAddressable) == "True" ? true : false;
|
||||||
uniqueBundleName = commonElement.GetAttribute(XmlUniqueBundleName) == "True" ? true : false;
|
uniqueBundleName = commonElement.GetAttribute(XmlUniqueBundleName) == "True" ? true : false;
|
||||||
showPackageView = commonElement.GetAttribute(XmlShowPackageView) == "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.EnableAddressable = enableAddressable;
|
||||||
AssetBundleCollectorSettingData.Setting.UniqueBundleName = uniqueBundleName;
|
AssetBundleCollectorSettingData.Setting.UniqueBundleName = uniqueBundleName;
|
||||||
AssetBundleCollectorSettingData.Setting.ShowPackageView = showPackageView;
|
AssetBundleCollectorSettingData.Setting.ShowPackageView = showPackageView;
|
||||||
|
AssetBundleCollectorSettingData.Setting.ShowEditorAlias = showEditorAlias;
|
||||||
AssetBundleCollectorSettingData.Setting.Packages.AddRange(packages);
|
AssetBundleCollectorSettingData.Setting.Packages.AddRange(packages);
|
||||||
AssetBundleCollectorSettingData.SaveFile();
|
AssetBundleCollectorSettingData.SaveFile();
|
||||||
Debug.Log($"导入配置完毕!");
|
Debug.Log($"导入配置完毕!");
|
||||||
@@ -183,6 +187,7 @@ namespace YooAsset.Editor
|
|||||||
commonElement.SetAttribute(XmlEnableAddressable, AssetBundleCollectorSettingData.Setting.EnableAddressable.ToString());
|
commonElement.SetAttribute(XmlEnableAddressable, AssetBundleCollectorSettingData.Setting.EnableAddressable.ToString());
|
||||||
commonElement.SetAttribute(XmlUniqueBundleName, AssetBundleCollectorSettingData.Setting.UniqueBundleName.ToString());
|
commonElement.SetAttribute(XmlUniqueBundleName, AssetBundleCollectorSettingData.Setting.UniqueBundleName.ToString());
|
||||||
commonElement.SetAttribute(XmlShowPackageView, AssetBundleCollectorSettingData.Setting.ShowPackageView.ToString());
|
commonElement.SetAttribute(XmlShowPackageView, AssetBundleCollectorSettingData.Setting.ShowPackageView.ToString());
|
||||||
|
commonElement.SetAttribute(XmlShowEditorAlias, AssetBundleCollectorSettingData.Setting.ShowEditorAlias.ToString());
|
||||||
root.AppendChild(commonElement);
|
root.AppendChild(commonElement);
|
||||||
|
|
||||||
// 设置Package配置
|
// 设置Package配置
|
||||||
|
|||||||
@@ -23,6 +23,12 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool UniqueBundleName = false;
|
public bool UniqueBundleName = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否显示编辑器别名
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowEditorAlias = false;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 包裹列表
|
/// 包裹列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -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()
|
public static List<string> GetActiveRuleNames()
|
||||||
{
|
{
|
||||||
if (_setting == null)
|
if (_setting == null)
|
||||||
@@ -47,8 +63,8 @@ namespace YooAsset.Editor
|
|||||||
foreach (var pair in _cacheActiveRuleTypes)
|
foreach (var pair in _cacheActiveRuleTypes)
|
||||||
{
|
{
|
||||||
names.Add(pair.Key);
|
names.Add(pair.Key);
|
||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
public static List<string> GetAddressRuleNames()
|
public static List<string> GetAddressRuleNames()
|
||||||
{
|
{
|
||||||
@@ -58,7 +74,7 @@ namespace YooAsset.Editor
|
|||||||
List<string> names = new List<string>();
|
List<string> names = new List<string>();
|
||||||
foreach (var pair in _cacheAddressRuleTypes)
|
foreach (var pair in _cacheAddressRuleTypes)
|
||||||
{
|
{
|
||||||
names.Add(pair.Key);
|
names.Add(GetEditorShowName(pair.Key, pair.Value));
|
||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
@@ -70,7 +86,7 @@ namespace YooAsset.Editor
|
|||||||
List<string> names = new List<string>();
|
List<string> names = new List<string>();
|
||||||
foreach (var pair in _cachePackRuleTypes)
|
foreach (var pair in _cachePackRuleTypes)
|
||||||
{
|
{
|
||||||
names.Add(pair.Key);
|
names.Add(GetEditorShowName(pair.Key, pair.Value));
|
||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
@@ -82,7 +98,7 @@ namespace YooAsset.Editor
|
|||||||
List<string> names = new List<string>();
|
List<string> names = new List<string>();
|
||||||
foreach (var pair in _cacheFilterRuleTypes)
|
foreach (var pair in _cacheFilterRuleTypes)
|
||||||
{
|
{
|
||||||
names.Add(pair.Key);
|
names.Add(GetEditorShowName(pair.Key, pair.Value));
|
||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
@@ -353,6 +369,12 @@ namespace YooAsset.Editor
|
|||||||
IsDirty = true;
|
IsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ModifyShowEditorAlias(bool showAlias)
|
||||||
|
{
|
||||||
|
Setting.ShowEditorAlias = showAlias;
|
||||||
|
IsDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
// 资源包裹编辑相关
|
// 资源包裹编辑相关
|
||||||
public static AssetBundleCollectorPackage CreatePackage(string packageName)
|
public static AssetBundleCollectorPackage CreatePackage(string packageName)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace YooAsset.Editor
|
|||||||
private Toggle _showPackageToogle;
|
private Toggle _showPackageToogle;
|
||||||
private Toggle _enableAddressableToogle;
|
private Toggle _enableAddressableToogle;
|
||||||
private Toggle _uniqueBundleNameToogle;
|
private Toggle _uniqueBundleNameToogle;
|
||||||
|
private Toggle _showEditorAliasToggle;
|
||||||
|
|
||||||
private VisualElement _packageContainer;
|
private VisualElement _packageContainer;
|
||||||
private ListView _packageListView;
|
private ListView _packageListView;
|
||||||
@@ -57,14 +58,12 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
_collectorTypeList = new List<string>()
|
_collectorTypeList = new List<string>()
|
||||||
{
|
{
|
||||||
$"{nameof(ECollectorType.MainAssetCollector)}",
|
$"{nameof(ECollectorType.MainAssetCollector)}",
|
||||||
$"{nameof(ECollectorType.StaticAssetCollector)}",
|
$"{nameof(ECollectorType.StaticAssetCollector)}",
|
||||||
$"{nameof(ECollectorType.DependAssetCollector)}"
|
$"{nameof(ECollectorType.DependAssetCollector)}"
|
||||||
};
|
};
|
||||||
_activeRuleList = AssetBundleCollectorSettingData.GetActiveRuleNames();
|
|
||||||
_addressRuleList = AssetBundleCollectorSettingData.GetAddressRuleNames();
|
RefreshNames();
|
||||||
_packRuleList = AssetBundleCollectorSettingData.GetPackRuleNames();
|
|
||||||
_filterRuleList = AssetBundleCollectorSettingData.GetFilterRuleNames();
|
|
||||||
|
|
||||||
VisualElement root = this.rootVisualElement;
|
VisualElement root = this.rootVisualElement;
|
||||||
|
|
||||||
@@ -95,6 +94,14 @@ namespace YooAsset.Editor
|
|||||||
RefreshWindow();
|
RefreshWindow();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_showEditorAliasToggle = root.Q<Toggle>("ShowEditorAlias");
|
||||||
|
_showEditorAliasToggle.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
AssetBundleCollectorSettingData.ModifyShowEditorAlias(evt.newValue);
|
||||||
|
RefreshNames();
|
||||||
|
RefreshWindow();
|
||||||
|
});
|
||||||
|
|
||||||
// 配置修复按钮
|
// 配置修复按钮
|
||||||
var fixBtn = root.Q<Button>("FixButton");
|
var fixBtn = root.Q<Button>("FixButton");
|
||||||
fixBtn.clicked += FixBtn_clicked;
|
fixBtn.clicked += FixBtn_clicked;
|
||||||
@@ -286,10 +293,21 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RefreshNames()
|
||||||
|
{
|
||||||
|
_activeRuleList = AssetBundleCollectorSettingData.GetActiveRuleNames();
|
||||||
|
_addressRuleList = AssetBundleCollectorSettingData.GetAddressRuleNames();
|
||||||
|
_packRuleList = AssetBundleCollectorSettingData.GetPackRuleNames();
|
||||||
|
_filterRuleList = AssetBundleCollectorSettingData.GetFilterRuleNames();
|
||||||
|
}
|
||||||
|
|
||||||
private void RefreshWindow()
|
private void RefreshWindow()
|
||||||
{
|
{
|
||||||
_showPackageToogle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.ShowPackageView);
|
_showPackageToogle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.ShowPackageView);
|
||||||
_enableAddressableToogle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.EnableAddressable);
|
_enableAddressableToogle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.EnableAddressable);
|
||||||
|
_uniqueBundleNameToogle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.UniqueBundleName);
|
||||||
|
_showEditorAliasToggle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.ShowEditorAlias);
|
||||||
|
|
||||||
_groupContainer.visible = false;
|
_groupContainer.visible = false;
|
||||||
_collectorContainer.visible = false;
|
_collectorContainer.visible = false;
|
||||||
|
|
||||||
@@ -574,7 +592,7 @@ namespace YooAsset.Editor
|
|||||||
var popupField = new PopupField<string>(_packRuleList, 0);
|
var popupField = new PopupField<string>(_packRuleList, 0);
|
||||||
popupField.name = "PopupField2";
|
popupField.name = "PopupField2";
|
||||||
popupField.style.unityTextAlign = TextAnchor.MiddleLeft;
|
popupField.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
popupField.style.width = 150;
|
popupField.style.width = 230;
|
||||||
elementBottom.Add(popupField);
|
elementBottom.Add(popupField);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<ui:Toggle label="Show Packages" name="ShowPackages" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Show Packages" name="ShowPackages" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
<ui:Toggle label="Enable Addressable" name="EnableAddressable" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Enable Addressable" name="EnableAddressable" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
<ui:Toggle label="Unique Bundle Name" name="UniqueBundleName" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Unique Bundle Name" name="UniqueBundleName" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
|
<ui:Toggle label="Show Editor Alias" name="ShowEditorAlias" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
</ui:VisualElement>
|
</ui:VisualElement>
|
||||||
<ui:VisualElement name="ContentContainer" style="flex-grow: 1; flex-direction: row;">
|
<ui:VisualElement name="ContentContainer" style="flex-grow: 1; flex-direction: row;">
|
||||||
<ui:VisualElement name="PackageContainer" style="width: 200px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
|
<ui:VisualElement name="PackageContainer" style="width: 200px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 以文件名为定位地址
|
/// 以文件名为定位地址
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("以文件名为定位地址")]
|
||||||
public class AddressByFileName : IAddressRule
|
public class AddressByFileName : IAddressRule
|
||||||
{
|
{
|
||||||
string IAddressRule.GetAssetAddress(AddressRuleData data)
|
string IAddressRule.GetAssetAddress(AddressRuleData data)
|
||||||
@@ -16,6 +17,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 以组名+文件名为定位地址
|
/// 以组名+文件名为定位地址
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("以组名+文件名为定位地址")]
|
||||||
public class AddressByGroupAndFileName : IAddressRule
|
public class AddressByGroupAndFileName : IAddressRule
|
||||||
{
|
{
|
||||||
string IAddressRule.GetAssetAddress(AddressRuleData data)
|
string IAddressRule.GetAssetAddress(AddressRuleData data)
|
||||||
@@ -28,6 +30,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 以收集器名+文件名为定位地址
|
/// 以收集器名+文件名为定位地址
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("以收集器名+文件名为定位地址")]
|
||||||
public class AddressByCollectorAndFileName : IAddressRule
|
public class AddressByCollectorAndFileName : IAddressRule
|
||||||
{
|
{
|
||||||
string IAddressRule.GetAssetAddress(AddressRuleData data)
|
string IAddressRule.GetAssetAddress(AddressRuleData data)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 收集所有资源
|
/// 收集所有资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("收集所有资源")]
|
||||||
public class CollectAll : IFilterRule
|
public class CollectAll : IFilterRule
|
||||||
{
|
{
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
@@ -18,6 +19,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 只收集场景
|
/// 只收集场景
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("只收集场景")]
|
||||||
public class CollectScene : IFilterRule
|
public class CollectScene : IFilterRule
|
||||||
{
|
{
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
@@ -25,10 +27,11 @@ namespace YooAsset.Editor
|
|||||||
return Path.GetExtension(data.AssetPath) == ".unity";
|
return Path.GetExtension(data.AssetPath) == ".unity";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 只收集预制体
|
/// 只收集预制体
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("只收集预制体")]
|
||||||
public class CollectPrefab : IFilterRule
|
public class CollectPrefab : IFilterRule
|
||||||
{
|
{
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
@@ -40,6 +43,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 只收集精灵类型的资源
|
/// 只收集精灵类型的资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("只收集精灵类型的资源")]
|
||||||
public class CollectSprite : IFilterRule
|
public class CollectSprite : IFilterRule
|
||||||
{
|
{
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
@@ -63,6 +67,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 只收集着色器变种收集文件
|
/// 只收集着色器变种收集文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("只收集着色器变种收集文件")]
|
||||||
public class CollectShaderVariants : IFilterRule
|
public class CollectShaderVariants : IFilterRule
|
||||||
{
|
{
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace YooAsset.Editor
|
|||||||
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop_image_backgroud.bundle"
|
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop_image_backgroud.bundle"
|
||||||
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop_view_main.bundle"
|
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop_view_main.bundle"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("以文件路径作为资源包名")]
|
||||||
public class PackSeparately : IPackRule
|
public class PackSeparately : IPackRule
|
||||||
{
|
{
|
||||||
string IPackRule.GetBundleName(PackRuleData data)
|
string IPackRule.GetBundleName(PackRuleData data)
|
||||||
@@ -25,6 +26,7 @@ namespace YooAsset.Editor
|
|||||||
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop_image.bundle"
|
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop_image.bundle"
|
||||||
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop_view.bundle"
|
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop_view.bundle"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("以父类文件夹路径作为资源包名")]
|
||||||
public class PackDirectory : IPackRule
|
public class PackDirectory : IPackRule
|
||||||
{
|
{
|
||||||
public static PackDirectory StaticPackRule = new PackDirectory();
|
public static PackDirectory StaticPackRule = new PackDirectory();
|
||||||
@@ -43,6 +45,7 @@ namespace YooAsset.Editor
|
|||||||
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop.bundle"
|
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop.bundle"
|
||||||
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop.bundle"
|
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop.bundle"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("以收集器路径下顶级文件夹为资源包名")]
|
||||||
public class PackTopDirectory : IPackRule
|
public class PackTopDirectory : IPackRule
|
||||||
{
|
{
|
||||||
string IPackRule.GetBundleName(PackRuleData data)
|
string IPackRule.GetBundleName(PackRuleData data)
|
||||||
@@ -68,6 +71,7 @@ namespace YooAsset.Editor
|
|||||||
/// 以收集器路径作为资源包名
|
/// 以收集器路径作为资源包名
|
||||||
/// 注意:收集的所有文件打进一个资源包
|
/// 注意:收集的所有文件打进一个资源包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("以收集器路径作为资源包名")]
|
||||||
public class PackCollector : IPackRule
|
public class PackCollector : IPackRule
|
||||||
{
|
{
|
||||||
string IPackRule.GetBundleName(PackRuleData data)
|
string IPackRule.GetBundleName(PackRuleData data)
|
||||||
@@ -90,6 +94,7 @@ namespace YooAsset.Editor
|
|||||||
/// 以分组名称作为资源包名
|
/// 以分组名称作为资源包名
|
||||||
/// 注意:收集的所有文件打进一个资源包
|
/// 注意:收集的所有文件打进一个资源包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("以分组名称作为资源包名")]
|
||||||
public class PackGroup : IPackRule
|
public class PackGroup : IPackRule
|
||||||
{
|
{
|
||||||
string IPackRule.GetBundleName(PackRuleData data)
|
string IPackRule.GetBundleName(PackRuleData data)
|
||||||
@@ -102,6 +107,7 @@ namespace YooAsset.Editor
|
|||||||
/// 原生文件打包模式
|
/// 原生文件打包模式
|
||||||
/// 注意:原生文件打包支持:图片,音频,视频,文本
|
/// 注意:原生文件打包支持:图片,音频,视频,文本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("原生文件打包模式")]
|
||||||
public class PackRawFile : IPackRule
|
public class PackRawFile : IPackRule
|
||||||
{
|
{
|
||||||
string IPackRule.GetBundleName(PackRuleData data)
|
string IPackRule.GetBundleName(PackRuleData data)
|
||||||
@@ -128,6 +134,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 着色器变种收集文件
|
/// 着色器变种收集文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EditorShow("着色器变种收集文件")]
|
||||||
public class PackShaderVariants : IPackRule
|
public class PackShaderVariants : IPackRule
|
||||||
{
|
{
|
||||||
public string GetBundleName(PackRuleData data)
|
public string GetBundleName(PackRuleData data)
|
||||||
|
|||||||
55
Assets/YooAsset/Editor/YooAssetAttributes.cs
Normal file
55
Assets/YooAsset/Editor/YooAssetAttributes.cs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <20>༭<EFBFBD><E0BCAD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||||
|
/// </summary>
|
||||||
|
internal sealed class EditorShowAttribute : Attribute
|
||||||
|
{
|
||||||
|
public string Name;
|
||||||
|
public EditorShowAttribute(string name)
|
||||||
|
{
|
||||||
|
this.Name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static class YooAssetAttributes
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <20><>ȡ Type <20><><EFBFBD><EFBFBD>
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <returns><3E><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA></returns>
|
||||||
|
internal static T GetAttribute<T>(Type type) where T : Attribute
|
||||||
|
{
|
||||||
|
return (T)type.GetCustomAttribute(typeof(T), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <20><>ȡ MethodInfo <20><><EFBFBD><EFBFBD>
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="methodInfo"></param>
|
||||||
|
/// <returns><3E><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA></returns>
|
||||||
|
internal static T GetAttribute<T>(MethodInfo methodInfo) where T : Attribute
|
||||||
|
{
|
||||||
|
return (T)methodInfo.GetCustomAttribute(typeof(T), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <20><>ȡ FieldInfo <20><><EFBFBD><EFBFBD>
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="field"></param>
|
||||||
|
/// <returns><3E><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA></returns>
|
||||||
|
internal static T GetAttribute<T>(FieldInfo field) where T : Attribute
|
||||||
|
{
|
||||||
|
return (T)field.GetCustomAttribute(typeof(T), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/YooAsset/Editor/YooAssetAttributes.cs.meta
Normal file
11
Assets/YooAsset/Editor/YooAssetAttributes.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 92d5f73b21059af43b7f56165b7acd63
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user