update runtime code

This commit is contained in:
hevinci
2022-12-27 10:19:35 +08:00
parent 4fa01e1a29
commit ac839450e2
10 changed files with 82 additions and 53 deletions
@@ -12,7 +12,7 @@ namespace YooAsset
}
private static int RequestCount = 0;
private readonly HostPlayModeImpl _impl;
private readonly IRemoteServices _remoteServices;
private readonly string _packageName;
private readonly string _packageVersion;
private readonly int _timeout;
@@ -20,9 +20,9 @@ namespace YooAsset
private UnityWebFileRequester _downloader2;
private ESteps _steps = ESteps.None;
internal DownloadManifestOperation(HostPlayModeImpl impl, string packageName, string packageVersion, int timeout)
internal DownloadManifestOperation(IRemoteServices remoteServices, string packageName, string packageVersion, int timeout)
{
_impl = impl;
_remoteServices = remoteServices;
_packageName = packageName;
_packageVersion = packageVersion;
_timeout = timeout;
@@ -103,9 +103,9 @@ namespace YooAsset
{
// 轮流返回请求地址
if (RequestCount % 2 == 0)
return _impl.GetPatchDownloadFallbackURL(fileName);
return _remoteServices.GetRemoteFallbackURL(fileName);
else
return _impl.GetPatchDownloadMainURL(fileName);
return _remoteServices.GetRemoteMainURL(fileName);
}
}
}
@@ -12,7 +12,7 @@ namespace YooAsset
}
private static int RequestCount = 0;
private readonly HostPlayModeImpl _impl;
private readonly IRemoteServices _remoteServices;
private readonly string _packageName;
private readonly bool _appendTimeTicks;
private readonly int _timeout;
@@ -25,9 +25,9 @@ namespace YooAsset
public string PackageVersion { private set; get; }
public QueryRemotePackageVersionOperation(HostPlayModeImpl impl, string packageName, bool appendTimeTicks, int timeout)
public QueryRemotePackageVersionOperation(IRemoteServices remoteServices, string packageName, bool appendTimeTicks, int timeout)
{
_impl = impl;
_remoteServices = remoteServices;
_packageName = packageName;
_appendTimeTicks = appendTimeTicks;
_timeout = timeout;
@@ -89,9 +89,9 @@ namespace YooAsset
// 轮流返回请求地址
if (RequestCount % 2 == 0)
url = _impl.GetPatchDownloadFallbackURL(fileName);
url = _remoteServices.GetRemoteFallbackURL(fileName);
else
url = _impl.GetPatchDownloadMainURL(fileName);
url = _remoteServices.GetRemoteMainURL(fileName);
// 在URL末尾添加时间戳
if (_appendTimeTicks)