update runtime code

1. 新增了ResourcePackage.GetPackageBuildinRootDirectory()方法
2. 新增了ResourcePackage.GetPackageSandboxRootDirectory()方法
3. 新增了ResourcePackage.ClearPackageSandbox()方法
pull/134/head
hevinci 2023-07-05 14:56:18 +08:00
parent fbb48ba330
commit c5314c72f0
1 changed files with 35 additions and 0 deletions

View File

@ -79,6 +79,10 @@ namespace YooAsset
// 检测初始化参数合法性 // 检测初始化参数合法性
CheckInitializeParameters(parameters); CheckInitializeParameters(parameters);
// 重写持久化根目录
var persistent = PersistentTools.GetOrCreatePersistent(PackageName);
persistent.OverwriteRootDirectory(parameters.BuildinRootDirectory, parameters.SandboxRootDirectory);
// 初始化资源系统 // 初始化资源系统
InitializationOperation initializeOperation; InitializationOperation initializeOperation;
_assetSystemImpl = new AssetSystemImpl(); _assetSystemImpl = new AssetSystemImpl();
@ -291,6 +295,37 @@ namespace YooAsset
_assetSystemImpl.ForceUnloadAllAssets(); _assetSystemImpl.ForceUnloadAllAssets();
} }
#region 沙盒相关
/// <summary>
/// 获取包裹的内置文件根路径
/// </summary>
public string GetPackageBuildinRootDirectory()
{
DebugCheckInitialize();
var persistent = PersistentTools.GetPersistent(PackageName);
return persistent.BuildinRoot;
}
/// <summary>
/// 获取包裹的沙盒文件根路径
/// </summary>
public string GetPackageSandboxRootDirectory()
{
DebugCheckInitialize();
var persistent = PersistentTools.GetPersistent(PackageName);
return persistent.SandboxRoot;
}
/// <summary>
/// 清空包裹的沙盒目录
/// </summary>
public void ClearPackageSandbox()
{
DebugCheckInitialize();
var persistent = PersistentTools.GetPersistent(PackageName);
persistent.DeleteSandboxPackageFolder();
}
#endregion
#region 资源信息 #region 资源信息
/// <summary> /// <summary>