|
@@ -109,7 +109,7 @@ namespace VEngine.Editor.Builds
|
|
|
bundle = bundle.Substring(0, i);
|
|
|
bundle = bundle.ToLower();
|
|
|
|
|
|
-
|
|
|
+ //以文件名标识分组
|
|
|
for (int j = 0; j < buildSetting.dirTypeList.Count; j++)
|
|
|
{
|
|
|
string str = buildSetting.dirTypeList[j];
|
|
@@ -127,6 +127,7 @@ namespace VEngine.Editor.Builds
|
|
|
}
|
|
|
|
|
|
});
|
|
|
+ //以子文件夹为单位分组
|
|
|
foreach (var dir in dirBundleList)
|
|
|
{
|
|
|
var dirPath = Path.Combine(Environment.CurrentDirectory, dir);
|
|
@@ -165,6 +166,7 @@ namespace VEngine.Editor.Builds
|
|
|
for (var i = 0; i < bundledAssets.Count; i++)
|
|
|
{
|
|
|
var asset = bundledAssets[i];
|
|
|
+ //去重
|
|
|
if (!pathWithAssets.TryGetValue(asset.path, out var ba))
|
|
|
{
|
|
|
pathWithAssets[asset.path] = asset;
|
|
@@ -183,6 +185,7 @@ namespace VEngine.Editor.Builds
|
|
|
{
|
|
|
var bundles = new List<ManifestBundle>();
|
|
|
var dictionary = new Dictionary<string, List<string>>();
|
|
|
+ //分组
|
|
|
foreach (var asset in bundledAssets)
|
|
|
{
|
|
|
if (!dictionary.TryGetValue(asset.bundle, out var assets))
|
|
@@ -199,9 +202,13 @@ namespace VEngine.Editor.Builds
|
|
|
assets.Add(asset.path);
|
|
|
}
|
|
|
|
|
|
- var outputPath = Settings.PlatformBuildPath;
|
|
|
+ var unityBuildPath = Settings.PlatformBuildPath;
|
|
|
+ if (!string.IsNullOrEmpty(GFGGame.LauncherConfig.resKey))
|
|
|
+ {
|
|
|
+ unityBuildPath = Settings.UnityBuildPath;
|
|
|
+ }
|
|
|
if (bundles.Count <= 0) return;
|
|
|
- var manifest = BuildPipeline.BuildAssetBundles(outputPath, bundles.ConvertAll(bundle =>
|
|
|
+ var manifest = BuildPipeline.BuildAssetBundles(unityBuildPath, bundles.ConvertAll(bundle =>
|
|
|
new AssetBundleBuild
|
|
|
{
|
|
|
assetNames = bundle.assets.ToArray(),
|
|
@@ -217,7 +224,8 @@ namespace VEngine.Editor.Builds
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(GFGGame.LauncherConfig.resKey))
|
|
|
{
|
|
|
- CreateEncryptAssets(outputPath, outputPath, manifest, GFGGame.LauncherConfig.resKey);
|
|
|
+ string buildPath = Settings.PlatformBuildPath;
|
|
|
+ CreateEncryptAssets(unityBuildPath, buildPath, manifest, GFGGame.LauncherConfig.resKey);
|
|
|
}
|
|
|
AfterBuildBundles(bundles, manifest);
|
|
|
}
|
|
@@ -237,7 +245,7 @@ namespace VEngine.Editor.Builds
|
|
|
{
|
|
|
Directory.CreateDirectory(encryptAssetPath);
|
|
|
}
|
|
|
- using (FileStream fs = new FileStream(Path.Combine(bundlePackagePath, assetBundle), FileMode.OpenOrCreate))
|
|
|
+ using (FileStream fs = new FileStream(Path.Combine(encryptAssetPath, assetBundle), FileMode.OpenOrCreate))
|
|
|
{
|
|
|
fs.SetLength(0);
|
|
|
fs.Write(encryptBytes, 0, encryptBytes.Length);
|
|
@@ -273,13 +281,11 @@ namespace VEngine.Editor.Builds
|
|
|
foreach (var assetBundle in assetBundles)
|
|
|
{
|
|
|
var originBundle = GetOriginBundle(assetBundle);
|
|
|
- var dependencies =
|
|
|
- Array.ConvertAll(manifest.GetAllDependencies(assetBundle), GetOriginBundle);
|
|
|
+ var dependencies = Array.ConvertAll(manifest.GetAllDependencies(assetBundle), GetOriginBundle);
|
|
|
if (nameWithBundles.TryGetValue(originBundle, out var manifestBundle))
|
|
|
{
|
|
|
manifestBundle.nameWithAppendHash = assetBundle;
|
|
|
- manifestBundle.dependencies =
|
|
|
- Array.ConvertAll(dependencies, input => nameWithBundles[input].id);
|
|
|
+ manifestBundle.dependencies = Array.ConvertAll(dependencies, input => nameWithBundles[input].id);
|
|
|
var file = Settings.GetBuildPath(assetBundle);
|
|
|
if (File.Exists(file))
|
|
|
using (var stream = File.OpenRead(file))
|