From a90fbe1d0a7aaa6820d4d40aa8999a4e35b71eb6 Mon Sep 17 00:00:00 2001 From: Alienjack Date: Wed, 3 Sep 2025 11:19:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8C=85=E6=A8=A1=E5=BC=8F=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=8C=89=E6=96=87=E4=BB=B6=E5=A4=B9=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/VersionFlow/Editor/BuilderConfigEditor.cs | 11 ++++++++++- Assets/VersionFlow/Runtime/BundleManifest.cs | 13 ++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Assets/VersionFlow/Editor/BuilderConfigEditor.cs b/Assets/VersionFlow/Editor/BuilderConfigEditor.cs index 72af93e..f2b75e5 100644 --- a/Assets/VersionFlow/Editor/BuilderConfigEditor.cs +++ b/Assets/VersionFlow/Editor/BuilderConfigEditor.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.IO; using System.Linq; +using System.Reflection; using System.Text; using UnityEditor; using UnityEngine; @@ -176,7 +178,7 @@ namespace VersionFlow.Editors var tempColor = GUI.color; if (modeValue == group.BuildMode) GUI.color = Color.green; else GUI.color = Color.white; - if (GUILayout.Button(modeName)) + if (GUILayout.Button(new GUIContent(modeName, GetDescrib(modeValue)))) { group.BuildMode = modeValue; } @@ -267,6 +269,13 @@ namespace VersionFlow.Editors return Color.white; } + + string GetDescrib(T value) where T : Enum + { + var enumType = typeof(T); + var desAtt = enumType.GetField(value.ToString()).GetCustomAttribute(); + return desAtt != null ? desAtt.Description : value.ToString(); + } } private void DrawCompareResult(List compareResult, Dictionary bundleExtraInfo) diff --git a/Assets/VersionFlow/Runtime/BundleManifest.cs b/Assets/VersionFlow/Runtime/BundleManifest.cs index 3e0d0ae..2fb2183 100644 --- a/Assets/VersionFlow/Runtime/BundleManifest.cs +++ b/Assets/VersionFlow/Runtime/BundleManifest.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.IO; using System.Linq; using UnityEditor; @@ -180,6 +181,10 @@ namespace VersionFlow.Runtime assetInfo.BundleName = $"{Folder.name}_{subtopFold}"; } } + else if (BuildMode == EnumBuildMode.OneFolderOnePack) + { + assetInfo.BundleName = $"{Folder.name}"; + } //Unity不允许场景和资源打包到一个bundle中,所以如果该资源是场景,则Bundle名称添加一个后缀 if (assetType == typeof(SceneAsset)) @@ -217,11 +222,17 @@ namespace VersionFlow.Runtime public enum EnumBuildMode { /// 将文件夹下所有Asset打包到一个bundle + [Description("将文件夹下所有Asset打包到一个bundle")] PackTogether, /// 将文件夹下每个Asset打包成一个Bundle + [Description("将文件夹下每个Asset打包成一个Bundle")] OneAssetOnePack, /// 将文件夹下一级文件打包为一个Bundle - SubTopPack + [Description("将文件夹下一级文件打包为一个Bundle")] + SubTopPack, + /// 列表中指定的每一个文件夹打包为一个Bundle + [Description("列表中指定的每一个文件夹打包为一个Bundle")] + OneFolderOnePack } }