Update AssetBundleBuilder
parent
42d52720f3
commit
e5c7bbdf52
|
@ -28,6 +28,11 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BundleName;
|
public string BundleName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件名称
|
||||||
|
/// </summary>
|
||||||
|
public string FileName;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 哈希值
|
/// 哈希值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace YooAsset.Editor
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
string sourcePath = $"{pipelineOutputDirectory}/{patchBundle.BundleName}";
|
string sourcePath = $"{pipelineOutputDirectory}/{patchBundle.BundleName}";
|
||||||
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{patchBundle.Hash}";
|
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{patchBundle.FileName}";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,8 +83,7 @@ namespace YooAsset.Editor
|
||||||
bool isBuildin = IsBuildinBundle(tags, buildinTags);
|
bool isBuildin = IsBuildinBundle(tags, buildinTags);
|
||||||
bool isRawFile = bundleInfo.IsRawFile;
|
bool isRawFile = bundleInfo.IsRawFile;
|
||||||
|
|
||||||
string fileName = GetFileOutputName(outputNameStype, hash, bundleInfo);
|
PatchBundle patchBundle = new PatchBundle(bundleName, hash, crc32, size, (byte)outputNameStype, tags);
|
||||||
PatchBundle patchBundle = new PatchBundle(bundleName, fileName, crc32, size, tags);
|
|
||||||
patchBundle.SetFlagsValue(isEncrypted, isBuildin, isRawFile);
|
patchBundle.SetFlagsValue(isEncrypted, isBuildin, isRawFile);
|
||||||
result.Add(patchBundle);
|
result.Add(patchBundle);
|
||||||
}
|
}
|
||||||
|
@ -104,37 +103,6 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
private string GetFileOutputName(EOutputNameStyle outputNameStyle, string hash, BuildBundleInfo bundleInfo)
|
|
||||||
{
|
|
||||||
string fileName;
|
|
||||||
var bundleName = bundleInfo.BundleName;
|
|
||||||
if (outputNameStyle == EOutputNameStyle.HashName)
|
|
||||||
{
|
|
||||||
fileName = hash;
|
|
||||||
}
|
|
||||||
else if (outputNameStyle == EOutputNameStyle.HashName_Extension)
|
|
||||||
{
|
|
||||||
string tempFileExtension = bundleInfo.GetAppendExtension();
|
|
||||||
fileName = $"{hash}{tempFileExtension}";
|
|
||||||
}
|
|
||||||
else if (outputNameStyle == EOutputNameStyle.BundleName_HashName)
|
|
||||||
{
|
|
||||||
string tempFileExtension = bundleInfo.GetAppendExtension();
|
|
||||||
string tempBundleName = bundleName.Replace('/', '_').Replace(tempFileExtension, "");
|
|
||||||
fileName = $"{tempBundleName}_{hash}";
|
|
||||||
}
|
|
||||||
else if (outputNameStyle == EOutputNameStyle.BundleName_HashName_Extension)
|
|
||||||
{
|
|
||||||
string tempFileExtension = bundleInfo.GetAppendExtension();
|
|
||||||
string tempBundleName = bundleName.Replace('/', '_').Replace(tempFileExtension, "");
|
|
||||||
fileName = $"{tempBundleName}_{hash}{tempFileExtension}";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
private string GetFileHash(string filePath, bool standardBuild)
|
private string GetFileHash(string filePath, bool standardBuild)
|
||||||
{
|
{
|
||||||
if (standardBuild)
|
if (standardBuild)
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace YooAsset.Editor
|
||||||
foreach (var patchBundle in patchManifest.BundleList)
|
foreach (var patchBundle in patchManifest.BundleList)
|
||||||
{
|
{
|
||||||
string sourcePath = $"{buildParameters.PipelineOutputDirectory}/{patchBundle.BundleName}";
|
string sourcePath = $"{buildParameters.PipelineOutputDirectory}/{patchBundle.BundleName}";
|
||||||
string destPath = $"{packageDirectory}/{patchBundle.Hash}";
|
string destPath = $"{packageDirectory}/{patchBundle.FileName}";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
EditorTools.DisplayProgressBar("拷贝补丁文件", ++progressValue, patchFileTotalCount);
|
EditorTools.DisplayProgressBar("拷贝补丁文件", ++progressValue, patchFileTotalCount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,6 +95,7 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
ReportBundleInfo reportBundleInfo = new ReportBundleInfo();
|
ReportBundleInfo reportBundleInfo = new ReportBundleInfo();
|
||||||
reportBundleInfo.BundleName = patchBundle.BundleName;
|
reportBundleInfo.BundleName = patchBundle.BundleName;
|
||||||
|
reportBundleInfo.FileName = patchBundle.FileName;
|
||||||
reportBundleInfo.Hash = patchBundle.Hash;
|
reportBundleInfo.Hash = patchBundle.Hash;
|
||||||
reportBundleInfo.CRC = patchBundle.CRC;
|
reportBundleInfo.CRC = patchBundle.CRC;
|
||||||
reportBundleInfo.SizeBytes = patchBundle.SizeBytes;
|
reportBundleInfo.SizeBytes = patchBundle.SizeBytes;
|
||||||
|
|
|
@ -9,21 +9,21 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 000000000000000f000000000000000
|
/// 000000000000000f000000000000000
|
||||||
/// </summary>
|
/// </summary>
|
||||||
HashName,
|
HashName = 1,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 000000000000000f000000000000000.bundle
|
/// 000000000000000f000000000000000.bundle
|
||||||
/// </summary>
|
/// </summary>
|
||||||
HashName_Extension,
|
HashName_Extension = 2,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// bundle_name_000000000000000f000000000000000
|
/// bundle_name_000000000000000f000000000000000
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BundleName_HashName,
|
BundleName_HashName = 3,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// bundle_name_000000000000000f000000000000000.bundle
|
/// bundle_name_000000000000000f000000000000000.bundle
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BundleName_HashName_Extension,
|
BundleName_HashName_Extension = 4,
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -275,7 +275,7 @@ namespace YooAsset.Editor
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string rootDirectory = Path.GetDirectoryName(_reportFilePath);
|
string rootDirectory = Path.GetDirectoryName(_reportFilePath);
|
||||||
string filePath = $"{rootDirectory}/{bundleInfo.Hash}";
|
string filePath = $"{rootDirectory}/{bundleInfo.FileName}";
|
||||||
if (File.Exists(filePath))
|
if (File.Exists(filePath))
|
||||||
Selection.activeObject = AssetBundleRecorder.GetAssetBundle(filePath);
|
Selection.activeObject = AssetBundleRecorder.GetAssetBundle(filePath);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue