From 304bff1f194f847bfb4f0e33a5773e48744bdb59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E5=86=A0=E5=B3=B0?= Date: Wed, 16 Nov 2022 11:51:01 +0800 Subject: [PATCH] Fix #43 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复了打包规则按收集器路径来命名,bundle文件名称显示不正确。 --- .../AssetBundleCollector/DefaultPackRule.cs | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/DefaultPackRule.cs b/Assets/YooAsset/Editor/AssetBundleCollector/DefaultPackRule.cs index 00a067b..c8e42c7 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/DefaultPackRule.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/DefaultPackRule.cs @@ -7,9 +7,8 @@ namespace YooAsset.Editor /// /// 以文件路径作为资源包名 /// 注意:每个文件独自打资源包 - /// 例如:收集器路径为 "Assets/UIPanel" - /// 例如:"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/Image/backgroud.png" --> "assets_uipanel_shop_image_backgroud.bundle" + /// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop_view_main.bundle" /// public class PackSeparately : IPackRule { @@ -23,9 +22,8 @@ namespace YooAsset.Editor /// /// 以父类文件夹路径作为资源包名 /// 注意:文件夹下所有文件打进一个资源包 - /// 例如:收集器路径为 "Assets/UIPanel" - /// 例如:"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/Image/backgroud.png" --> "assets_uipanel_shop_image.bundle" + /// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop_view.bundle" /// public class PackDirectory : IPackRule { @@ -42,8 +40,8 @@ namespace YooAsset.Editor /// 以收集器路径下顶级文件夹为资源包名 /// 注意:文件夹下所有文件打进一个资源包 /// 例如:收集器路径为 "Assets/UIPanel" - /// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets/uipanel/shop.bundle" - /// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets/uipanel/shop.bundle" + /// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets_uipanel_shop.bundle" + /// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets_uipanel_shop.bundle" /// public class PackTopDirectory : IPackRule { @@ -74,8 +72,17 @@ namespace YooAsset.Editor { string IPackRule.GetBundleName(PackRuleData data) { - string bundleName = StringUtility.RemoveExtension(data.CollectPath); - return EditorTools.GetRegularPath(bundleName).Replace('/', '_'); + string collectPath = data.CollectPath; + if (AssetDatabase.IsValidFolder(collectPath)) + { + string bundleName = collectPath; + return EditorTools.GetRegularPath(bundleName).Replace('/', '_'); + } + else + { + string bundleName = StringUtility.RemoveExtension(collectPath); + return EditorTools.GetRegularPath(bundleName).Replace('/', '_'); + } } }