mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-30 05:28:46 +00:00
refactor: 适配引擎版本
This commit is contained in:
@@ -50,21 +50,27 @@ namespace YooAsset
|
|||||||
if (_watchDogAborted)
|
if (_watchDogAborted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if UNITY_2020_3_OR_NEWER
|
||||||
|
double realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartupAsDouble;
|
||||||
|
#else
|
||||||
|
double realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartup;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (_watchDogInit == false)
|
if (_watchDogInit == false)
|
||||||
{
|
{
|
||||||
_watchDogInit = true;
|
_watchDogInit = true;
|
||||||
_lastDownloadBytes = 0;
|
_lastDownloadBytes = 0;
|
||||||
_lastGetDataTime = UnityEngine.Time.realtimeSinceStartupAsDouble;
|
_lastGetDataTime = realtimeSinceStartup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_webRequest.downloadedBytes != _lastDownloadBytes)
|
if (_webRequest.downloadedBytes != _lastDownloadBytes)
|
||||||
{
|
{
|
||||||
_lastDownloadBytes = _webRequest.downloadedBytes;
|
_lastDownloadBytes = _webRequest.downloadedBytes;
|
||||||
_lastGetDataTime = UnityEngine.Time.realtimeSinceStartupAsDouble;
|
_lastGetDataTime = realtimeSinceStartup;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double deltaTime = UnityEngine.Time.realtimeSinceStartupAsDouble - _lastGetDataTime;
|
double deltaTime = realtimeSinceStartup - _lastGetDataTime;
|
||||||
if (deltaTime > _fileSystem.DownloadWatchDogTime)
|
if (deltaTime > _fileSystem.DownloadWatchDogTime)
|
||||||
{
|
{
|
||||||
_watchDogAborted = true;
|
_watchDogAborted = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user