update YooAssetSettings

pull/464/head
何冠峰 2025-02-06 16:43:55 +08:00
parent 38471cdd6c
commit 20c07af504
9 changed files with 51 additions and 63 deletions

View File

@ -22,7 +22,7 @@ namespace YooAsset.Editor
/// </summary> /// </summary>
public static string GetStreamingAssetsRoot() public static string GetStreamingAssetsRoot()
{ {
return YooAssetSettingsData.GetYooEditorBuildinRoot(); return YooAssetSettingsData.GetYooDefaultBuildinRoot();
} }
} }
} }

View File

@ -68,6 +68,17 @@ namespace YooAsset
/// </summary> /// </summary>
public bool DisableCatalogFile { private set; get; } = false; public bool DisableCatalogFile { private set; get; } = false;
/// <summary>
/// 自定义参数:拷贝内置清单
/// </summary>
public bool CopyBuildinPackageManifest { private set; get; } = false;
/// <summary>
/// 自定义参数:拷贝内置清单的目标目录
/// 注意:该参数为空的时候,会获取默认的沙盒目录!
/// </summary>
public string CopyBuildinPackageManifestDestPath { private set; get; }
/// <summary> /// <summary>
/// 自定义参数:解密方法类 /// 自定义参数:解密方法类
/// </summary> /// </summary>
@ -147,6 +158,11 @@ namespace YooAsset
{ {
DisableCatalogFile = (bool)value; DisableCatalogFile = (bool)value;
} }
else if (name == FileSystemParametersDefine.COPY_BUILDIN_PACKAGE_MANIFEST)
{
CopyBuildinPackageManifest = true;
CopyBuildinPackageManifestDestPath = (string)value;
}
else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES) else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES)
{ {
DecryptionServices = (IDecryptionServices)value; DecryptionServices = (IDecryptionServices)value;
@ -291,7 +307,7 @@ namespace YooAsset
#region 内部方法 #region 内部方法
protected string GetDefaultBuildinPackageRoot(string packageName) protected string GetDefaultBuildinPackageRoot(string packageName)
{ {
string rootDirectory = YooAssetSettingsData.GetYooMobileBuildinRoot(); string rootDirectory = YooAssetSettingsData.GetYooDefaultBuildinRoot();
return PathUtility.Combine(rootDirectory, packageName); return PathUtility.Combine(rootDirectory, packageName);
} }
public string GetBuildinFileLoadPath(PackageBundle bundle) public string GetBuildinFileLoadPath(PackageBundle bundle)

View File

@ -22,7 +22,7 @@ namespace YooAsset
if (saveDirectory.Exists) if (saveDirectory.Exists)
saveDirectory.Delete(true); saveDirectory.Delete(true);
string rootPath = YooAssetSettingsData.GetYooEditorBuildinRoot(); string rootPath = YooAssetSettingsData.GetYooDefaultBuildinRoot();
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath); DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
if (rootDirectory.Exists == false) if (rootDirectory.Exists == false)
{ {

View File

@ -473,16 +473,7 @@ namespace YooAsset
#region 内部方法 #region 内部方法
public string GetDefaultCachePackageRoot(string packageName) public string GetDefaultCachePackageRoot(string packageName)
{ {
string rootDirectory; string rootDirectory = YooAssetSettingsData.GetYooDefaultCacheRoot();
#if UNITY_EDITOR
rootDirectory = YooAssetSettingsData.GetYooEditorCacheRoot();
#elif UNITY_STANDALONE
rootDirectory = YooAssetSettingsData.GetYooStandaloneCacheRoot();
#else
rootDirectory = YooAssetSettingsData.GetYooMobileCacheRoot();
#endif
return PathUtility.Combine(rootDirectory, packageName); return PathUtility.Combine(rootDirectory, packageName);
} }
public string GetCacheBundleFileLoadPath(PackageBundle bundle) public string GetCacheBundleFileLoadPath(PackageBundle bundle)

View File

@ -174,17 +174,17 @@ namespace YooAsset
public string GetEditorPackageVersionFilePath() public string GetEditorPackageVersionFilePath()
{ {
string fileName = YooAssetSettingsData.GetPackageVersionFileName(PackageName); string fileName = YooAssetSettingsData.GetPackageVersionFileName(PackageName);
return PathUtility.Combine(FileRoot, fileName); return PathUtility.Combine(_packageRoot, fileName);
} }
public string GetEditorPackageHashFilePath(string packageVersion) public string GetEditorPackageHashFilePath(string packageVersion)
{ {
string fileName = YooAssetSettingsData.GetPackageHashFileName(PackageName, packageVersion); string fileName = YooAssetSettingsData.GetPackageHashFileName(PackageName, packageVersion);
return PathUtility.Combine(FileRoot, fileName); return PathUtility.Combine(_packageRoot, fileName);
} }
public string GetEditorPackageManifestFilePath(string packageVersion) public string GetEditorPackageManifestFilePath(string packageVersion)
{ {
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(PackageName, packageVersion); string fileName = YooAssetSettingsData.GetManifestBinaryFileName(PackageName, packageVersion);
return PathUtility.Combine(FileRoot, fileName); return PathUtility.Combine(_packageRoot, fileName);
} }
public int GetAsyncSimulateFrame() public int GetAsyncSimulateFrame()
{ {

View File

@ -168,7 +168,7 @@ namespace YooAsset
#region 内部方法 #region 内部方法
protected string GetDefaultWebPackageRoot(string packageName) protected string GetDefaultWebPackageRoot(string packageName)
{ {
string rootDirectory = YooAssetSettingsData.GetYooWebBuildinRoot(); string rootDirectory = YooAssetSettingsData.GetYooDefaultBuildinRoot();
return PathUtility.Combine(rootDirectory, packageName); return PathUtility.Combine(rootDirectory, packageName);
} }
public string GetWebFileLoadPath(PackageBundle bundle) public string GetWebFileLoadPath(PackageBundle bundle)

View File

@ -37,8 +37,7 @@ namespace YooAsset
#if UNITY_EDITOR #if UNITY_EDITOR
// 兼容性初始化 // 兼容性初始化
// 说明:内置文件系统在编辑器下运行时需要动态生成 // 说明:内置文件系统在编辑器下运行时需要动态生成
string buildinRoot = YooAssetSettingsData.GetYooEditorBuildinRoot(); string packageRoot = _fileSystem.FileRoot;
string packageRoot = PathUtility.Combine(buildinRoot, _fileSystem.PackageName);
bool result = DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(_fileSystem.PackageName, packageRoot); bool result = DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(_fileSystem.PackageName, packageRoot);
if (result == false) if (result == false)
{ {

View File

@ -15,5 +15,6 @@ namespace YooAsset
public const string RESUME_DOWNLOAD_RESPONSE_CODES = "RESUME_DOWNLOAD_RESPONSE_CODES"; public const string RESUME_DOWNLOAD_RESPONSE_CODES = "RESUME_DOWNLOAD_RESPONSE_CODES";
public const string ASYNC_SIMULATE_MIN_FRAME = "ASYNC_SIMULATE_MIN_FRAME"; public const string ASYNC_SIMULATE_MIN_FRAME = "ASYNC_SIMULATE_MIN_FRAME";
public const string ASYNC_SIMULATE_MAX_FRAME = "ASYNC_SIMULATE_MAX_FRAME"; public const string ASYNC_SIMULATE_MAX_FRAME = "ASYNC_SIMULATE_MAX_FRAME";
public const string COPY_BUILDIN_PACKAGE_MANIFEST = "COPY_BUILDIN_PACKAGE_MANIFEST";
} }
} }

View File

@ -111,50 +111,6 @@ namespace YooAsset
return $"Assets/Resources/{Setting.DefaultYooFolderName}"; return $"Assets/Resources/{Setting.DefaultYooFolderName}";
} }
/// <summary>
/// 获取YOO的编辑器下内置文件根目录
/// </summary>
public static string GetYooEditorBuildinRoot()
{
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
return PathUtility.Combine(Application.dataPath, "StreamingAssets");
else
return PathUtility.Combine(Application.dataPath, "StreamingAssets", Setting.DefaultYooFolderName);
}
/// <summary>
/// 获取YOO的PC端内置文件根目录
/// </summary>
public static string GetYooStandaloneBuildinRoot()
{
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
return Application.streamingAssetsPath;
else
return PathUtility.Combine(Application.streamingAssetsPath, Setting.DefaultYooFolderName);
}
/// <summary>
/// 获取YOO的移动端内置文件根目录
/// </summary>
public static string GetYooMobileBuildinRoot()
{
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
return Application.streamingAssetsPath;
else
return PathUtility.Combine(Application.streamingAssetsPath, Setting.DefaultYooFolderName);
}
/// <summary>
/// 获取YOO的Web端内置文件根目录
/// </summary>
public static string GetYooWebBuildinRoot()
{
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
return Application.streamingAssetsPath;
else
return PathUtility.Combine(Application.streamingAssetsPath, Setting.DefaultYooFolderName);
}
/// <summary> /// <summary>
/// 获取YOO的编辑器下缓存文件根目录 /// 获取YOO的编辑器下缓存文件根目录
/// </summary> /// </summary>
@ -196,6 +152,31 @@ namespace YooAsset
else else
return PathUtility.Combine(Application.persistentDataPath, Setting.DefaultYooFolderName); return PathUtility.Combine(Application.persistentDataPath, Setting.DefaultYooFolderName);
} }
/// <summary>
/// 获取YOO默认的缓存文件根目录
/// </summary>
public static string GetYooDefaultCacheRoot()
{
#if UNITY_EDITOR
return GetYooEditorCacheRoot();
#elif UNITY_STANDALONE
return GetYooStandaloneCacheRoot();
#else
return GetYooMobileCacheRoot();
#endif
}
/// <summary>
/// 获取YOO默认的内置文件根目录
/// </summary>
public static string GetYooDefaultBuildinRoot()
{
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
return Application.streamingAssetsPath;
else
return PathUtility.Combine(Application.streamingAssetsPath, Setting.DefaultYooFolderName);
}
#endregion #endregion
} }
} }