update runtime logic
parent
c4875d4f80
commit
69c7a51215
|
@ -122,7 +122,7 @@ namespace YooAsset
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文件名称(远端文件名和内置文件名)
|
||||
/// 文件名称
|
||||
/// </summary>
|
||||
private string _fileName;
|
||||
public string FileName
|
||||
|
@ -135,6 +135,20 @@ namespace YooAsset
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文件后缀名
|
||||
/// </summary>
|
||||
private string _fileExtension;
|
||||
public string FileExtension
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_fileExtension))
|
||||
throw new Exception("Should never get here !");
|
||||
return _fileExtension;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public PatchBundle()
|
||||
{
|
||||
|
@ -146,7 +160,8 @@ namespace YooAsset
|
|||
public void ParseBundle(string packageName, int nameStype)
|
||||
{
|
||||
PackageName = packageName;
|
||||
_fileName = PatchManifestTools.CreateBundleFileName(nameStype, BundleName, FileHash, IsRawFile);
|
||||
_fileExtension = PatchManifestTools.GetRemoteBundleFileExtension(BundleName);
|
||||
_fileName = PatchManifestTools.GetRemoteBundleFileName(nameStype, BundleName, _fileExtension, FileHash);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -155,21 +155,21 @@ namespace YooAsset
|
|||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// 生成Bundle文件的正式名称
|
||||
/// </summary>
|
||||
public static string CreateBundleFileName(int nameStyle, string bundleName, string fileHash, bool isRawFile)
|
||||
public static string GetRemoteBundleFileExtension(string bundleName)
|
||||
{
|
||||
string fileExtension = Path.GetExtension(bundleName);
|
||||
return fileExtension;
|
||||
}
|
||||
public static string GetRemoteBundleFileName(int nameStyle, string bundleName, string fileExtension, string fileHash)
|
||||
{
|
||||
if (nameStyle == 1) //HashName
|
||||
{
|
||||
string fileExtension = isRawFile ? YooAssetSettingsData.Setting.RawBundleFileVariant : YooAssetSettingsData.Setting.AssetBundleFileVariant;
|
||||
return StringUtility.Format("{0}.{1}", fileHash, fileExtension);
|
||||
return StringUtility.Format("{0}{1}", fileHash, fileExtension);
|
||||
}
|
||||
else if (nameStyle == 4) //BundleName_HashName
|
||||
{
|
||||
string fileName = bundleName.Remove(bundleName.LastIndexOf('.'));
|
||||
string fileExtension = isRawFile ? YooAssetSettingsData.Setting.RawBundleFileVariant : YooAssetSettingsData.Setting.AssetBundleFileVariant;
|
||||
return StringUtility.Format("{0}_{1}.{2}", fileName, fileHash, fileExtension);
|
||||
return StringUtility.Format("{0}_{1}{2}", fileName, fileHash, fileExtension);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -5,26 +5,11 @@ namespace YooAsset
|
|||
[CreateAssetMenu(fileName = "YooAssetSettings", menuName = "YooAsset/Create Settings")]
|
||||
internal class YooAssetSettings : ScriptableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// AssetBundle文件的后缀名
|
||||
/// </summary>
|
||||
public string AssetBundleFileVariant = "bundle";
|
||||
|
||||
/// <summary>
|
||||
/// 原生文件的后缀名
|
||||
/// </summary>
|
||||
public string RawBundleFileVariant = "rawfile";
|
||||
|
||||
/// <summary>
|
||||
/// 清单文件名称
|
||||
/// </summary>
|
||||
public string PatchManifestFileName = "PatchManifest";
|
||||
|
||||
/// <summary>
|
||||
/// 资源包名正规化(移除路径分隔符)
|
||||
/// </summary>
|
||||
public bool RegularBundleName = true;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 清单文件头标记
|
||||
|
@ -63,20 +48,9 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public const string ReportFileName = "BuildReport";
|
||||
|
||||
/// <summary>
|
||||
/// Unity着色器资源包名称
|
||||
/// </summary>
|
||||
public const string UnityShadersBundleName = "unityshaders";
|
||||
|
||||
/// <summary>
|
||||
/// 内置资源目录名称
|
||||
/// </summary>
|
||||
public const string StreamingAssetsBuildinFolder = "BuildinFiles";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 忽略的文件类型
|
||||
/// </summary>
|
||||
public static readonly string[] IgnoreFileExtensions = { "", ".so", ".dll", ".cs", ".js", ".boo", ".meta", ".cginc", ".hlsl" };
|
||||
}
|
||||
}
|
|
@ -71,18 +71,5 @@ namespace YooAsset
|
|||
{
|
||||
return $"{Setting.PatchManifestFileName}_{packageName}.version";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取着色器资源包全名称(包含后缀名)
|
||||
/// </summary>
|
||||
public static string GetUnityShadersBundleFullName(bool uniqueBundleName, string packageName)
|
||||
{
|
||||
string shareBundleName;
|
||||
if (uniqueBundleName)
|
||||
shareBundleName = $"{packageName.ToLower()}_{YooAssetSettings.UnityShadersBundleName}.{Setting.AssetBundleFileVariant}";
|
||||
else
|
||||
shareBundleName = $"{YooAssetSettings.UnityShadersBundleName}.{Setting.AssetBundleFileVariant}";
|
||||
return shareBundleName.ToLower();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue