update runtime code

pull/62/head
hevinci 2022-12-21 12:05:05 +08:00
parent 66cd491493
commit de09a042e6
2 changed files with 17 additions and 11 deletions

View File

@ -2,7 +2,6 @@
using System.IO; using System.IO;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine;
namespace YooAsset namespace YooAsset
{ {
@ -270,24 +269,26 @@ namespace YooAsset
/// <summary> /// <summary>
/// 生成Bundle文件的正式名称 /// 生成Bundle文件的正式名称
/// </summary> /// </summary>
public static string CreateBundleFileName(int nameStype, string bundleName, string fileHash, bool isRawFile) public static string CreateBundleFileName(int nameStyle, string bundleName, string fileHash, bool isRawFile)
{ {
if (nameStype == 1) if (nameStyle == 1) //HashName
{
return fileHash;
}
else if (nameStype == 2)
{ {
string fileExtension = isRawFile ? YooAssetSettingsData.Setting.RawFileVariant : YooAssetSettingsData.Setting.AssetBundleFileVariant; string fileExtension = isRawFile ? YooAssetSettingsData.Setting.RawFileVariant : YooAssetSettingsData.Setting.AssetBundleFileVariant;
return StringUtility.Format("{0}.{1}", fileHash, fileExtension); return StringUtility.Format("{0}.{1}", fileHash, fileExtension);
} }
else if (nameStype == 4) else if (nameStyle == 2) //BundleName
{ {
return StringUtility.Format("{0}_{1}", fileHash, bundleName); return bundleName;
}
else if (nameStyle == 4) //BundleName_HashName
{
string fileName = bundleName.Remove(bundleName.LastIndexOf('.'));
string fileExtension = isRawFile ? YooAssetSettingsData.Setting.RawFileVariant : YooAssetSettingsData.Setting.AssetBundleFileVariant;
return StringUtility.Format("{0}_{1}.{2}", fileName, fileHash, fileExtension);
} }
else else
{ {
throw new NotImplementedException($"Invalid nameStype {nameStype}"); throw new NotImplementedException($"Invalid name style : {nameStyle}");
} }
} }
} }

View File

@ -20,6 +20,11 @@ namespace YooAsset
/// </summary> /// </summary>
public string PatchManifestFileName = "PatchManifest"; public string PatchManifestFileName = "PatchManifest";
/// <summary>
/// 资源包名正规化(移除路径分隔符)
/// </summary>
public bool RegularBundleName = true;
/// <summary> /// <summary>
/// 清单文件头标记 /// 清单文件头标记
@ -34,7 +39,7 @@ namespace YooAsset
/// <summary> /// <summary>
/// 清单文件格式版本 /// 清单文件格式版本
/// </summary> /// </summary>
public const string PatchManifestFileVersion = "1.3.4"; public const string PatchManifestFileVersion = "1.4.0";
/// <summary> /// <summary>
/// 构建输出文件夹名称 /// 构建输出文件夹名称