From b5d76e1f22ebcaa7bafaf685dbc9daf11d75ff45 Mon Sep 17 00:00:00 2001
From: ALEXTANG <574809918@qq.com>
Date: Thu, 13 Apr 2023 11:48:34 +0800
Subject: [PATCH] Update DownloaderOperation.cs
---
.../PackageSystem/Operations/DownloaderOperation.cs | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs
index 352c6176..6b6d8483 100644
--- a/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs
+++ b/Assets/TEngine/Runtime/GameFramework/Resource/YooAsset/PackageSystem/Operations/DownloaderOperation.cs
@@ -34,6 +34,7 @@ namespace YooAsset
private int _lastDownloadCount = 0;
private long _cachedDownloadBytes = 0;
private int _cachedDownloadCount = 0;
+ private float _currentSpeed = 0f;
private ESteps _steps = ESteps.None;
@@ -62,6 +63,14 @@ namespace YooAsset
{
get { return _lastDownloadBytes; }
}
+
+ ///
+ /// 当前下载器下载速度
+ ///
+ public float CurrentSpeed
+ {
+ get { return _currentSpeed; }
+ }
///
/// 当下载器结束(无论成功或失败)
@@ -150,6 +159,7 @@ namespace YooAsset
_cachedDownloadCount++;
_cachedDownloadBytes += bundleInfo.Bundle.FileSize;
}
+ _currentSpeed = downloadBytes / UnityEngine.Time.time;
// 移除已经完成的下载器(无论成功或失败)
foreach (var loader in _removeList)