mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-30 05:28:46 +00:00
fix #564
This commit is contained in:
@@ -11,14 +11,16 @@ internal class TTFSRequestPackageVersionOperation : FSRequestPackageVersionOpera
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly TiktokFileSystem _fileSystem;
|
private readonly TiktokFileSystem _fileSystem;
|
||||||
|
private readonly bool _appendTimeTicks;
|
||||||
private readonly int _timeout;
|
private readonly int _timeout;
|
||||||
private RequestTiktokPackageVersionOperation _requestPackageVersionOp;
|
private RequestTiktokPackageVersionOperation _requestPackageVersionOp;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
|
||||||
internal TTFSRequestPackageVersionOperation(TiktokFileSystem fileSystem, int timeout)
|
internal TTFSRequestPackageVersionOperation(TiktokFileSystem fileSystem, bool appendTimeTicks, int timeout)
|
||||||
{
|
{
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
|
_appendTimeTicks = appendTimeTicks;
|
||||||
_timeout = timeout;
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
@@ -34,7 +36,7 @@ internal class TTFSRequestPackageVersionOperation : FSRequestPackageVersionOpera
|
|||||||
{
|
{
|
||||||
if (_requestPackageVersionOp == null)
|
if (_requestPackageVersionOp == null)
|
||||||
{
|
{
|
||||||
_requestPackageVersionOp = new RequestTiktokPackageVersionOperation(_fileSystem, _timeout);
|
_requestPackageVersionOp = new RequestTiktokPackageVersionOperation(_fileSystem, _appendTimeTicks, _timeout);
|
||||||
_requestPackageVersionOp.StartOperation();
|
_requestPackageVersionOp.StartOperation();
|
||||||
AddChildOperation(_requestPackageVersionOp);
|
AddChildOperation(_requestPackageVersionOp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ internal class RequestTiktokPackageVersionOperation : AsyncOperationBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly TiktokFileSystem _fileSystem;
|
private readonly TiktokFileSystem _fileSystem;
|
||||||
|
private readonly bool _appendTimeTicks;
|
||||||
private readonly int _timeout;
|
private readonly int _timeout;
|
||||||
private UnityWebTextRequestOperation _webTextRequestOp;
|
private UnityWebTextRequestOperation _webTextRequestOp;
|
||||||
private int _requestCount = 0;
|
private int _requestCount = 0;
|
||||||
@@ -22,9 +23,10 @@ internal class RequestTiktokPackageVersionOperation : AsyncOperationBase
|
|||||||
public string PackageVersion { private set; get; }
|
public string PackageVersion { private set; get; }
|
||||||
|
|
||||||
|
|
||||||
public RequestTiktokPackageVersionOperation(TiktokFileSystem fileSystem, int timeout)
|
public RequestTiktokPackageVersionOperation(TiktokFileSystem fileSystem, bool appendTimeTicks, int timeout)
|
||||||
{
|
{
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
|
_appendTimeTicks = appendTimeTicks;
|
||||||
_timeout = timeout;
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
@@ -80,11 +82,19 @@ internal class RequestTiktokPackageVersionOperation : AsyncOperationBase
|
|||||||
|
|
||||||
private string GetRequestURL(string fileName)
|
private string GetRequestURL(string fileName)
|
||||||
{
|
{
|
||||||
|
string url;
|
||||||
|
|
||||||
// 轮流返回请求地址
|
// 轮流返回请求地址
|
||||||
if (_requestCount % 2 == 0)
|
if (_requestCount % 2 == 0)
|
||||||
return _fileSystem.RemoteServices.GetRemoteMainURL(fileName);
|
url = _fileSystem.RemoteServices.GetRemoteMainURL(fileName);
|
||||||
else
|
else
|
||||||
return _fileSystem.RemoteServices.GetRemoteFallbackURL(fileName);
|
url = _fileSystem.RemoteServices.GetRemoteFallbackURL(fileName);
|
||||||
|
|
||||||
|
// 在URL末尾添加时间戳
|
||||||
|
if (_appendTimeTicks)
|
||||||
|
return $"{url}?{System.DateTime.UtcNow.Ticks}";
|
||||||
|
else
|
||||||
|
return url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -121,7 +121,7 @@ internal class TiktokFileSystem : IFileSystem
|
|||||||
}
|
}
|
||||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||||
{
|
{
|
||||||
var operation = new TTFSRequestPackageVersionOperation(this, timeout);
|
var operation = new TTFSRequestPackageVersionOperation(this, appendTimeTicks, timeout);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
|
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ internal class RequestWechatPackageVersionOperation : AsyncOperationBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly WechatFileSystem _fileSystem;
|
private readonly WechatFileSystem _fileSystem;
|
||||||
private readonly int _timeout;
|
|
||||||
private readonly bool _appendTimeTicks;
|
private readonly bool _appendTimeTicks;
|
||||||
|
private readonly int _timeout;
|
||||||
private UnityWebTextRequestOperation _webTextRequestOp;
|
private UnityWebTextRequestOperation _webTextRequestOp;
|
||||||
private int _requestCount = 0;
|
private int _requestCount = 0;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|||||||
Reference in New Issue
Block a user