打包模式新增按文件夹打包

This commit is contained in:
Alienjack 2025-09-03 11:19:18 +08:00
parent f3aa411e51
commit a90fbe1d0a
2 changed files with 22 additions and 2 deletions

View File

@ -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>(T value) where T : Enum
{
var enumType = typeof(T);
var desAtt = enumType.GetField(value.ToString()).GetCustomAttribute<DescriptionAttribute>();
return desAtt != null ? desAtt.Description : value.ToString();
}
}
private void DrawCompareResult(List<BundleCompare> compareResult, Dictionary<string, BundleExtraInfo> bundleExtraInfo)

View File

@ -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
{
/// <summary> 将文件夹下所有Asset打包到一个bundle </summary>
[Description("将文件夹下所有Asset打包到一个bundle")]
PackTogether,
/// <summary> 将文件夹下每个Asset打包成一个Bundle </summary>
[Description("将文件夹下每个Asset打包成一个Bundle")]
OneAssetOnePack,
/// <summary> 将文件夹下一级文件打包为一个Bundle </summary>
SubTopPack
[Description("将文件夹下一级文件打包为一个Bundle")]
SubTopPack,
/// <summary> 列表中指定的每一个文件夹打包为一个Bundle </summary>
[Description("列表中指定的每一个文件夹打包为一个Bundle")]
OneFolderOnePack
}
}