mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
TEngine 6
This commit is contained in:
@@ -6,15 +6,15 @@ namespace YooAsset
|
||||
internal class YooAssetSettings : ScriptableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// 清单文件名称
|
||||
/// YooAsset文件夹名称
|
||||
/// </summary>
|
||||
public string ManifestFileName = "PackageManifest";
|
||||
public string DefaultYooFolderName = "yoo";
|
||||
|
||||
/// <summary>
|
||||
/// 默认的YooAsset文件夹名称
|
||||
/// 资源清单前缀名称(默认为空)
|
||||
/// </summary>
|
||||
public string DefaultYooFolderName = "package";
|
||||
|
||||
public string PackageManifestPrefix = string.Empty;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 清单文件头标记
|
||||
@@ -29,43 +29,12 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 清单文件格式版本
|
||||
/// </summary>
|
||||
public const string ManifestFileVersion = "2.0.0";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 缓存的数据文件名称
|
||||
/// </summary>
|
||||
public const string CacheBundleDataFileName = "__data";
|
||||
|
||||
/// <summary>
|
||||
/// 缓存的信息文件名称
|
||||
/// </summary>
|
||||
public const string CacheBundleInfoFileName = "__info";
|
||||
|
||||
/// <summary>
|
||||
/// 缓存的资源文件的文件夹名称
|
||||
/// </summary>
|
||||
public const string CacheFilesFolderName = "CacheFiles";
|
||||
|
||||
/// <summary>
|
||||
/// 缓存的清单文件的文件夹名称
|
||||
/// </summary>
|
||||
public const string ManifestFolderName = "ManifestFiles";
|
||||
|
||||
/// <summary>
|
||||
/// 记录应用程序版本的文件名称
|
||||
/// </summary>
|
||||
public const string AppFootPrintFileName = "ApplicationFootPrint.bytes";
|
||||
public const string ManifestFileVersion = "2.3.1";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 构建输出文件夹名称
|
||||
/// </summary>
|
||||
public const string OutputFolderName = "OutputCache";
|
||||
|
||||
/// <summary>
|
||||
/// 构建输出的报告文件
|
||||
/// </summary>
|
||||
public const string ReportFileName = "BuildReport";
|
||||
}
|
||||
}
|
@@ -1,11 +1,12 @@
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal static class YooAssetSettingsData
|
||||
public static class YooAssetSettingsData
|
||||
{
|
||||
private static YooAssetSettings _setting = null;
|
||||
public static YooAssetSettings Setting
|
||||
internal static YooAssetSettings Setting
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -32,12 +33,24 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取YooAsset文件夹名称
|
||||
/// </summary>
|
||||
public static string GetDefaultYooFolderName()
|
||||
{
|
||||
return Setting.DefaultYooFolderName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取构建报告文件名
|
||||
/// </summary>
|
||||
public static string GetReportFileName(string packageName, string packageVersion)
|
||||
public static string GetBuildReportFileName(string packageName, string packageVersion)
|
||||
{
|
||||
return $"{YooAssetSettings.ReportFileName}_{packageName}_{packageVersion}.json";
|
||||
if (string.IsNullOrEmpty(Setting.PackageManifestPrefix))
|
||||
return $"{packageName}_{packageVersion}.report";
|
||||
else
|
||||
return $"{Setting.PackageManifestPrefix}_{packageName}_{packageVersion}.report";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -45,7 +58,10 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public static string GetManifestBinaryFileName(string packageName, string packageVersion)
|
||||
{
|
||||
return $"{Setting.ManifestFileName}_{packageName}_{packageVersion}.bytes";
|
||||
if (string.IsNullOrEmpty(Setting.PackageManifestPrefix))
|
||||
return $"{packageName}_{packageVersion}.bytes";
|
||||
else
|
||||
return $"{Setting.PackageManifestPrefix}_{packageName}_{packageVersion}.bytes";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -53,7 +69,10 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public static string GetManifestJsonFileName(string packageName, string packageVersion)
|
||||
{
|
||||
return $"{Setting.ManifestFileName}_{packageName}_{packageVersion}.json";
|
||||
if (string.IsNullOrEmpty(Setting.PackageManifestPrefix))
|
||||
return $"{packageName}_{packageVersion}.json";
|
||||
else
|
||||
return $"{Setting.PackageManifestPrefix}_{packageName}_{packageVersion}.json";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -61,7 +80,10 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public static string GetPackageHashFileName(string packageName, string packageVersion)
|
||||
{
|
||||
return $"{Setting.ManifestFileName}_{packageName}_{packageVersion}.hash";
|
||||
if (string.IsNullOrEmpty(Setting.PackageManifestPrefix))
|
||||
return $"{packageName}_{packageVersion}.hash";
|
||||
else
|
||||
return $"{Setting.PackageManifestPrefix}_{packageName}_{packageVersion}.hash";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -69,7 +91,127 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public static string GetPackageVersionFileName(string packageName)
|
||||
{
|
||||
return $"{Setting.ManifestFileName}_{packageName}.version";
|
||||
if (string.IsNullOrEmpty(Setting.PackageManifestPrefix))
|
||||
return $"{packageName}.version";
|
||||
else
|
||||
return $"{Setting.PackageManifestPrefix}_{packageName}.version";
|
||||
}
|
||||
|
||||
#region 路径相关
|
||||
/// <summary>
|
||||
/// 获取YOO的Resources目录的加载路径
|
||||
/// </summary>
|
||||
internal static string GetYooResourcesLoadPath(string packageName, string fileName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return PathUtility.Combine(packageName, fileName);
|
||||
else
|
||||
return PathUtility.Combine(Setting.DefaultYooFolderName, packageName, fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的Resources目录的全路径
|
||||
/// </summary>
|
||||
internal static string GetYooResourcesFullPath()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return $"Assets/Resources";
|
||||
else
|
||||
return $"Assets/Resources/{Setting.DefaultYooFolderName}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的编辑器下缓存文件根目录
|
||||
/// </summary>
|
||||
internal static string GetYooEditorCacheRoot()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
{
|
||||
string projectPath = Path.GetDirectoryName(Application.dataPath);
|
||||
projectPath = PathUtility.RegularPath(projectPath);
|
||||
return projectPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 注意:为了方便调试查看,编辑器下把存储目录放到项目根目录下。
|
||||
string projectPath = Path.GetDirectoryName(Application.dataPath);
|
||||
projectPath = PathUtility.RegularPath(projectPath);
|
||||
return PathUtility.Combine(projectPath, Setting.DefaultYooFolderName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的PC平台缓存文件根目录
|
||||
/// </summary>
|
||||
internal static string GetYooStandaloneWinCacheRoot()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return Application.dataPath;
|
||||
else
|
||||
return PathUtility.Combine(Application.dataPath, Setting.DefaultYooFolderName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的Linux平台缓存文件根目录
|
||||
/// </summary>
|
||||
internal static string GetYooStandaloneLinuxCacheRoot()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return Application.dataPath;
|
||||
else
|
||||
return PathUtility.Combine(Application.dataPath, Setting.DefaultYooFolderName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的Mac平台缓存文件根目录
|
||||
/// </summary>
|
||||
internal static string GetYooStandaloneMacCacheRoot()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return Application.persistentDataPath;
|
||||
else
|
||||
return PathUtility.Combine(Application.persistentDataPath, Setting.DefaultYooFolderName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的移动平台缓存文件根目录
|
||||
/// </summary>
|
||||
internal static string GetYooMobileCacheRoot()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return Application.persistentDataPath;
|
||||
else
|
||||
return PathUtility.Combine(Application.persistentDataPath, Setting.DefaultYooFolderName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO默认的缓存文件根目录
|
||||
/// </summary>
|
||||
internal static string GetYooDefaultCacheRoot()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
return GetYooEditorCacheRoot();
|
||||
#elif UNITY_STANDALONE_WIN
|
||||
return GetYooStandaloneWinCacheRoot();
|
||||
#elif UNITY_STANDALONE_LINUX
|
||||
return GetYooStandaloneLinuxCacheRoot();
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
return GetYooStandaloneMacCacheRoot();
|
||||
#else
|
||||
return GetYooMobileCacheRoot();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO默认的内置文件根目录
|
||||
/// </summary>
|
||||
internal static string GetYooDefaultBuildinRoot()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return Application.streamingAssetsPath;
|
||||
else
|
||||
return PathUtility.Combine(Application.streamingAssetsPath, Setting.DefaultYooFolderName);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user