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