mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
修正ProcedureDownloadFile更新时网速计算
修正ProcedureDownloadFile更新时网速计算
This commit is contained in:
@@ -13,9 +13,18 @@ namespace GameMain
|
|||||||
|
|
||||||
private ProcedureOwner _procedureOwner;
|
private ProcedureOwner _procedureOwner;
|
||||||
|
|
||||||
private float CurrentSpeed =>
|
private float _lastUpdateDownloadedSize;
|
||||||
(GameModule.Resource.Downloader.TotalDownloadBytes -
|
private float CurrentSpeed
|
||||||
GameModule.Resource.Downloader.CurrentDownloadBytes) / GameTime.time;
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
float interval = GameTime.deltaTime;
|
||||||
|
var sizeDiff = GameModule.Resource.Downloader.CurrentDownloadBytes - _lastUpdateDownloadedSize;
|
||||||
|
_lastUpdateDownloadedSize = GameModule.Resource.Downloader.CurrentDownloadBytes;
|
||||||
|
var speed = (float)Math.Floor(sizeDiff / interval);
|
||||||
|
return speed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnEnter(ProcedureOwner procedureOwner)
|
protected override void OnEnter(ProcedureOwner procedureOwner)
|
||||||
{
|
{
|
||||||
@@ -63,7 +72,7 @@ namespace GameMain
|
|||||||
Utility.File.GetByteLengthString(currentDownloadBytes),
|
Utility.File.GetByteLengthString(currentDownloadBytes),
|
||||||
Utility.File.GetByteLengthString(totalDownloadBytes),
|
Utility.File.GetByteLengthString(totalDownloadBytes),
|
||||||
GameModule.Resource.Downloader.Progress,
|
GameModule.Resource.Downloader.Progress,
|
||||||
Utility.File.GetByteLengthString((int)CurrentSpeed));
|
Utility.File.GetLengthString((int)CurrentSpeed));
|
||||||
LoadUpdateLogic.Instance.DownProgressAction?.Invoke(GameModule.Resource.Downloader.Progress);
|
LoadUpdateLogic.Instance.DownProgressAction?.Invoke(GameModule.Resource.Downloader.Progress);
|
||||||
UILoadMgr.Show(UIDefine.UILoadUpdate,descriptionText);
|
UILoadMgr.Show(UIDefine.UILoadUpdate,descriptionText);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user