mirror of
https://github.com/osukey/osukey.git
synced 2025-07-07 11:19:54 +09:00
Use float type for progress value
This commit is contained in:
@ -141,12 +141,12 @@ namespace osu.Game.Screens.Play
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
double currentTime = (AudioClock?.CurrentTime ?? Time.Current) - firstHitTime;
|
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);
|
graph.Progress = (int)(graph.ColumnCount * progress);
|
||||||
|
|
||||||
info.Progress = (int)(progress * 100);
|
info.Progress = progress;
|
||||||
info.CurrentTime = currentTime;
|
info.CurrentTime = currentTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,10 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
private OsuSpriteText timeCurrent;
|
private OsuSpriteText timeCurrent;
|
||||||
private OsuSpriteText timeLeft;
|
private OsuSpriteText timeLeft;
|
||||||
private OsuSpriteText progressText;
|
private OsuSpriteText progress;
|
||||||
|
|
||||||
private double currentTime;
|
private double currentTime;
|
||||||
private double songLenght;
|
private double songLenght;
|
||||||
private int progress;
|
|
||||||
|
|
||||||
private const int margin = 10;
|
private const int margin = 10;
|
||||||
|
|
||||||
@ -33,16 +32,12 @@ namespace osu.Game.Screens.Play
|
|||||||
timeCurrent.Text = TimeSpan.FromMilliseconds(value).ToString(@"m\:ss");
|
timeCurrent.Text = TimeSpan.FromMilliseconds(value).ToString(@"m\:ss");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int Progress
|
public float Progress
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (progress == value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
progress = value;
|
|
||||||
if (currentTime > 0)
|
if (currentTime > 0)
|
||||||
progressText.Text = value.ToString() + @"%";
|
progress.Text = value.ToString("P0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +58,7 @@ namespace osu.Game.Screens.Play
|
|||||||
},
|
},
|
||||||
Text = @"0:00",
|
Text = @"0:00",
|
||||||
},
|
},
|
||||||
progressText = new OsuSpriteText
|
progress = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Reference in New Issue
Block a user