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

Use float type for progress value

This commit is contained in:
EVAST9919 2017-05-08 19:42:36 +03:00
parent 4b5e24cc36
commit 17d1ecb8f5
2 changed files with 7 additions and 12 deletions

View File

@ -141,12 +141,12 @@ namespace osu.Game.Screens.Play
return;
double currentTime = (AudioClock?.CurrentTime ?? Time.Current) - firstHitTime;
double progress = currentTime / (lastHitTime - firstHitTime);
float progress = (float)(currentTime / (lastHitTime - firstHitTime));
bar.UpdatePosition((float)progress);
bar.UpdatePosition(progress);
graph.Progress = (int)(graph.ColumnCount * progress);
info.Progress = (int)(progress * 100);
info.Progress = progress;
info.CurrentTime = currentTime;
}
}

View File

@ -15,11 +15,10 @@ namespace osu.Game.Screens.Play
{
private OsuSpriteText timeCurrent;
private OsuSpriteText timeLeft;
private OsuSpriteText progressText;
private OsuSpriteText progress;
private double currentTime;
private double songLenght;
private int progress;
private const int margin = 10;
@ -33,16 +32,12 @@ namespace osu.Game.Screens.Play
timeCurrent.Text = TimeSpan.FromMilliseconds(value).ToString(@"m\:ss");
}
}
public int Progress
public float Progress
{
set
{
if (progress == value)
return;
progress = value;
if (currentTime > 0)
progressText.Text = value.ToString() + @"%";
progress.Text = value.ToString("P0");
}
}
@ -63,7 +58,7 @@ namespace osu.Game.Screens.Play
},
Text = @"0:00",
},
progressText = new OsuSpriteText
progress = new OsuSpriteText
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,