mirror of https://github.com/tuyoogame/YooAsset
增加查询预下载资源版本方法
parent
abaff0ede5
commit
99eb8774e0
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
|
@ -21,7 +21,7 @@ namespace YooAsset
|
||||||
private int _requestCount = 0;
|
private int _requestCount = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 包裹版本
|
/// 包裹版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PrePackageVersion { private set; get; }
|
public string PrePackageVersion { private set; get; }
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ namespace YooAsset
|
||||||
if (_downloader == null)
|
if (_downloader == null)
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPrePackageVersionFileName(_packageName);
|
string fileName = YooAssetSettingsData.GetPrePackageVersionFileName(_packageName);
|
||||||
string webURL = GetPackageVersionRequestURL(fileName);
|
string webURL = GetPackageVersionRequestURL(_packageName, fileName);
|
||||||
YooLogger.Log($"Beginning to request pre package version : {webURL}");
|
YooLogger.Log($"Beginning to request pre package version : {webURL}");
|
||||||
_downloader = new UnityWebDataRequester();
|
_downloader = new UnityWebDataRequester();
|
||||||
_downloader.SendRequest(webURL, _timeout);
|
_downloader.SendRequest(webURL, _timeout);
|
||||||
|
@ -86,17 +86,17 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetPackageVersionRequestURL(string fileName)
|
private string GetPackageVersionRequestURL(string packageName, string fileName)
|
||||||
{
|
{
|
||||||
string url;
|
string url;
|
||||||
|
|
||||||
// 轮流返回请求地址
|
// 轮流返回请求地址
|
||||||
if (_requestCount % 2 == 0)
|
if (_requestCount % 2 == 0)
|
||||||
url = _remoteServices.GetRemoteMainURL(fileName);
|
url = _remoteServices.GetRemoteMainURL(packageName, fileName);
|
||||||
else
|
else
|
||||||
url = _remoteServices.GetRemoteFallbackURL(fileName);
|
url = _remoteServices.GetRemoteFallbackURL(packageName, fileName);
|
||||||
|
|
||||||
// 在URL末尾添加时间戳
|
// 在URL末尾添加时间戳
|
||||||
if (_appendTimeTicks)
|
if (_appendTimeTicks)
|
||||||
return $"{url}?{System.DateTime.UtcNow.Ticks}";
|
return $"{url}?{System.DateTime.UtcNow.Ticks}";
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
@ -7,12 +7,12 @@ namespace YooAsset
|
||||||
public abstract class UpdatePrePackageVersionOperation : AsyncOperationBase
|
public abstract class UpdatePrePackageVersionOperation : AsyncOperationBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 预下载包裹版本
|
/// 预下载包裹版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PrePackageVersion { protected set; get; }
|
public string PrePackageVersion { protected set; get; }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 编辑器下模拟模式的请求远端包裹的预下载版本
|
/// 编辑器下模拟模式的请求远端包裹的预下载版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class EditorPlayModeUpdatePrePackageVersionOperation : UpdatePrePackageVersionOperation
|
internal sealed class EditorPlayModeUpdatePrePackageVersionOperation : UpdatePrePackageVersionOperation
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 离线模式的请求远端包裹的预下载版本
|
/// 离线模式的请求远端包裹的预下载版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class OfflinePlayModeUpdatePrePackageVersionOperation : UpdatePrePackageVersionOperation
|
internal sealed class OfflinePlayModeUpdatePrePackageVersionOperation : UpdatePrePackageVersionOperation
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 联机模式的请求远端包裹的预下载版本
|
/// 联机模式的请求远端包裹的预下载版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class HostPlayModeUpdatePrePackageVersionOperation : UpdatePrePackageVersionOperation
|
internal sealed class HostPlayModeUpdatePrePackageVersionOperation : UpdatePrePackageVersionOperation
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// WebGL模式的请求远端包裹的预下载版本
|
/// WebGL模式的请求远端包裹的预下载版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class WebPlayModeUpdatePrePackageVersionOperation : UpdatePrePackageVersionOperation
|
internal sealed class WebPlayModeUpdatePrePackageVersionOperation : UpdatePrePackageVersionOperation
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue