update:统一WebGL平台与其他平台的远程热更资源引用方式

This commit is contained in:
Weekend
2023-11-19 01:41:47 +08:00
parent ef17cd851b
commit 69be3cfa23
3 changed files with 27 additions and 13 deletions

View File

@@ -10,18 +10,6 @@ namespace TEngine
public const string RootFolderName = "yoo";
}
/// <summary>
/// 内置文件查询服务类。
/// </summary>
public class BuiltinQueryServices : IBuildinQueryServices
{
public bool QueryStreamingAssets(string packageName, string fileName)
{
// 注意fileName包含文件格式
return BuiltinQueryMgr.FileExists(packageName, fileName);
}
}
#if UNITY_EDITOR
/// <summary>
/// 内置资源资源查询帮助类。

View File

@@ -84,6 +84,29 @@ namespace TEngine
return $"{_defaultHostServer}/{_packageName}/{fileName}";
}
}
/// <summary>
/// 内置文件查询服务类。
/// </summary>
public class BuiltinQueryServices : IBuildinQueryServices
{
public bool QueryStreamingAssets(string packageName, string fileName)
{
// 注意fileName包含文件格式
return BuiltinQueryMgr.FileExists(packageName, fileName);
}
}
/// <summary>
/// WebGL内置文件查询服务类。WebGL平台不需要内置查询直接使用远程热更资源。
/// </summary>
public class WebGLBuiltinQueryServices : IBuildinQueryServices
{
public bool QueryStreamingAssets(string packageName, string fileName)
{
return true;
}
}
}
public class BundleStream : FileStream

View File

@@ -394,8 +394,11 @@ namespace TEngine
YooAssets.SetCacheSystemDisableCacheOnWebGL();
var createParameters = new WebPlayModeParameters();
createParameters.DecryptionServices = new GameDecryptionServices();
createParameters.BuildinQueryServices = new BuiltinQueryServices();
createParameters.BuildinQueryServices = new WebGLBuiltinQueryServices();
createParameters.RemoteServices = new RemoteServices(targetPackageName);
// WebGL运行模式下直接使用远程热更资源。
createParameters.BuildinRootDirectory = SettingsUtils.FrameworkGlobalSettings.HostServerURL;
createParameters.SandboxRootDirectory = SettingsUtils.FrameworkGlobalSettings.HostServerURL;
initializationOperation = package.InitializeAsync(createParameters);
}