mirror of https://github.com/tuyoogame/YooAsset
parent
a290353cfa
commit
688cc271d5
|
@ -202,7 +202,8 @@ namespace YooAsset
|
|||
/// 向网络端请求最新的资源版本
|
||||
/// </summary>
|
||||
/// <param name="timeout">超时时间(默认值:60秒)</param>
|
||||
public UpdatePackageVersionOperation UpdatePackageVersionAsync(int timeout = 60)
|
||||
/// <param name="appendTimeTicks">在URL末尾添加时间戳</param>
|
||||
public UpdatePackageVersionOperation UpdatePackageVersionAsync(int timeout = 60, bool appendTimeTicks = true)
|
||||
{
|
||||
DebugCheckInitialize();
|
||||
if (_playMode == EPlayMode.EditorSimulateMode)
|
||||
|
@ -219,7 +220,7 @@ namespace YooAsset
|
|||
}
|
||||
else if (_playMode == EPlayMode.HostPlayMode)
|
||||
{
|
||||
return _hostPlayModeImpl.UpdatePackageVersionAsync(PackageName, timeout);
|
||||
return _hostPlayModeImpl.UpdatePackageVersionAsync(PackageName, timeout, appendTimeTicks);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -60,14 +60,16 @@ namespace YooAsset
|
|||
private readonly HostPlayModeImpl _impl;
|
||||
private readonly string _packageName;
|
||||
private readonly int _timeout;
|
||||
private readonly bool _appendTimeTicks;
|
||||
private ESteps _steps = ESteps.None;
|
||||
private UnityWebDataRequester _downloader;
|
||||
|
||||
internal HostPlayModeUpdatePackageVersionOperation(HostPlayModeImpl impl, string packageName, int timeout)
|
||||
internal HostPlayModeUpdatePackageVersionOperation(HostPlayModeImpl impl, string packageName, int timeout, bool appendTimeTicks)
|
||||
{
|
||||
_impl = impl;
|
||||
_packageName = packageName;
|
||||
_timeout = timeout;
|
||||
_appendTimeTicks = appendTimeTicks;
|
||||
}
|
||||
internal override void Start()
|
||||
{
|
||||
|
@ -130,8 +132,11 @@ namespace YooAsset
|
|||
else
|
||||
url = _impl.GetPatchDownloadMainURL(fileName);
|
||||
|
||||
// 注意:在URL末尾添加时间戳
|
||||
// 在URL末尾添加时间戳
|
||||
if (_appendTimeTicks)
|
||||
return $"{url}?{System.DateTime.UtcNow.Ticks}";
|
||||
else
|
||||
return url;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,9 +44,9 @@ namespace YooAsset
|
|||
/// <summary>
|
||||
/// 异步更新资源版本号
|
||||
/// </summary>
|
||||
public UpdatePackageVersionOperation UpdatePackageVersionAsync(string packageName, int timeout)
|
||||
public UpdatePackageVersionOperation UpdatePackageVersionAsync(string packageName, int timeout, bool appendTimeTicks)
|
||||
{
|
||||
var operation = new HostPlayModeUpdatePackageVersionOperation(this, packageName, timeout);
|
||||
var operation = new HostPlayModeUpdatePackageVersionOperation(this, packageName, timeout, appendTimeTicks);
|
||||
OperationSystem.StartOperation(operation);
|
||||
return operation;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue