parent
e3fa33b9b5
commit
d7ae52160b
|
@ -120,7 +120,7 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
_packageName = packageName;
|
_packageName = packageName;
|
||||||
_cacheKey = $"{packageName}-{FileHash}";
|
_cacheKey = $"{packageName}-{FileHash}";
|
||||||
_fileName = PatchManifest.CreateBundleFileName(nameStype, BundleName, FileHash);
|
_fileName = PatchManifest.CreateBundleFileName(nameStype, BundleName, FileHash, IsRawFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
@ -407,10 +408,13 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[ThreadStatic]
|
||||||
|
private static StringBuilder _cacheBuilder = new StringBuilder(1024);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生成Bundle文件的正式名称
|
/// 生成Bundle文件的正式名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string CreateBundleFileName(int nameStype, string bundleName, string fileHash)
|
public static string CreateBundleFileName(int nameStype, string bundleName, string fileHash, bool isRawFile)
|
||||||
{
|
{
|
||||||
if (nameStype == 1)
|
if (nameStype == 1)
|
||||||
{
|
{
|
||||||
|
@ -418,24 +422,26 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
else if (nameStype == 2)
|
else if (nameStype == 2)
|
||||||
{
|
{
|
||||||
string tempFileExtension = System.IO.Path.GetExtension(bundleName);
|
_cacheBuilder.Clear();
|
||||||
return $"{fileHash}{tempFileExtension}";
|
_cacheBuilder.Append(fileHash);
|
||||||
}
|
_cacheBuilder.Append(".");
|
||||||
else if (nameStype == 3)
|
if (isRawFile)
|
||||||
{
|
_cacheBuilder.Append(YooAssetSettingsData.Setting.RawFileVariant);
|
||||||
string tempFileExtension = System.IO.Path.GetExtension(bundleName);
|
else
|
||||||
string tempBundleName = bundleName.Replace('/', '_').Replace(tempFileExtension, "");
|
_cacheBuilder.Append(YooAssetSettingsData.Setting.AssetBundleFileVariant);
|
||||||
return $"{tempBundleName}_{fileHash}";
|
return _cacheBuilder.ToString();
|
||||||
}
|
}
|
||||||
else if (nameStype == 4)
|
else if (nameStype == 4)
|
||||||
{
|
{
|
||||||
string tempFileExtension = System.IO.Path.GetExtension(bundleName);
|
_cacheBuilder.Clear();
|
||||||
string tempBundleName = bundleName.Replace('/', '_').Replace(tempFileExtension, "");
|
_cacheBuilder.Append(fileHash);
|
||||||
return $"{tempBundleName}_{fileHash}{tempFileExtension}";
|
_cacheBuilder.Append("_");
|
||||||
|
_cacheBuilder.Append(bundleName);
|
||||||
|
return _cacheBuilder.ToString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException($"Invalid nameStype {nameStype}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue