1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 13:27:23 +08:00

Enforce double type in the download progress path

Wasn't sure where to exactly put this, or whether to split it, but it's very small change to worry about, so I guess it's fine being here
This commit is contained in:
Salman Ahmed 2021-01-16 23:17:47 +03:00
parent 23c7afa573
commit adb2605d5d
3 changed files with 10 additions and 10 deletions

View File

@ -10,18 +10,18 @@ namespace osu.Game.Online.API
{
public readonly TModel Model;
public float Progress;
public double Progress { get; private set; }
public event Action<float> DownloadProgressed;
public event Action<double> DownloadProgressed;
protected ArchiveDownloadRequest(TModel model)
{
Model = model;
Progressed += (current, total) => SetProgress((float)current / total);
Progressed += (current, total) => SetProgress((double)current / total);
}
protected void SetProgress(float progress)
protected void SetProgress(double progress)
{
Progress = progress;
DownloadProgressed?.Invoke(progress);

View File

@ -144,7 +144,7 @@ namespace osu.Game.Online
private void onRequestSuccess(string _) => Schedule(() => State.Value = DownloadState.Importing);
private void onRequestProgress(float progress) => Schedule(() => Progress.Value = progress);
private void onRequestProgress(double progress) => Schedule(() => Progress.Value = progress);
private void onRequestFailure(Exception e) => Schedule(() => attachDownload(null));

View File

@ -23,9 +23,9 @@ namespace osu.Game.Overlays.Notifications
public string CompletionText { get; set; } = "Task has completed!";
private float progress;
private double progress;
public float Progress
public double Progress
{
get => progress;
set
@ -185,9 +185,9 @@ namespace osu.Game.Overlays.Notifications
private Color4 colourActive;
private Color4 colourInactive;
private float progress;
private double progress;
public float Progress
public double Progress
{
get => progress;
set
@ -195,7 +195,7 @@ namespace osu.Game.Overlays.Notifications
if (progress == value) return;
progress = value;
box.ResizeTo(new Vector2(progress, 1), 100, Easing.OutQuad);
box.ResizeTo(new Vector2((float)progress, 1), 100, Easing.OutQuad);
}
}