Adjust values

This commit is contained in:
EVAST9919
2017-05-08 00:16:58 +03:00
parent d06b5783cb
commit ea28a9f7ce
2 changed files with 47 additions and 12 deletions

View File

@ -139,15 +139,16 @@ namespace osu.Game.Screens.Play
if (objects == null) if (objects == null)
return; return;
double currentTime = AudioClock?.CurrentTime ?? Time.Current; double drawableCurrentTime = AudioClock?.CurrentTime ?? Time.Current;
double progress = (currentTime - firstHitTime) / lastHitTime; double songCurrentTime = drawableCurrentTime - firstHitTime;
double progress = songCurrentTime / lastHitTime;
bar.UpdatePosition((float)progress); bar.UpdatePosition((float)progress);
graph.Progress = (int)(graph.ColumnCount * progress); graph.Progress = (int)(graph.ColumnCount * progress);
info.TimeCurrent = currentTime; info.Progress = (int)(progress * 100);
info.TimeLeft = lastHitTime - currentTime; info.TimeCurrent = songCurrentTime;
info.Progress = (int)(currentTime / lastHitTime * 100); info.TimeLeft = lastHitTime - firstHitTime - songCurrentTime;
} }
} }
} }

View File

@ -13,22 +13,54 @@ namespace osu.Game.Screens.Play
{ {
public class SongProgressInfo : Container public class SongProgressInfo : Container
{ {
private OsuSpriteText timeCurrent; private OsuSpriteText timeCurrentText;
private OsuSpriteText timeLeft; private OsuSpriteText timeLeft;
private OsuSpriteText progress; private OsuSpriteText progressText;
private int progress;
private double timeCurrent;
private const int margin = 10; private const int margin = 10;
public double TimeCurrent { set { timeCurrent.Text = TimeSpan.FromMilliseconds(value).ToString(@"m\:ss"); } } public double TimeCurrent
public double TimeLeft { set { timeLeft.Text = @"- " + TimeSpan.FromMilliseconds(value).ToString(@"m\:ss"); } } {
public int Progress { set { progress.Text = value.ToString() + @"%"; } } set
{
timeCurrent = value;
if (value > 0)
timeCurrentText.Text = TimeSpan.FromMilliseconds(value).ToString(@"m\:ss");
}
}
public double TimeLeft
{
set
{
if(timeCurrent < 0)
timeLeft.Text = @"-" + TimeSpan.FromMilliseconds(value + timeCurrent).ToString(@"m\:ss");
else
timeLeft.Text = @"-" + TimeSpan.FromMilliseconds(value).ToString(@"m\:ss");
}
}
public int Progress
{
set
{
if (progress == value)
return;
progress = value;
if (value > 0)
progressText.Text = value.ToString() + @"%";
}
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
timeCurrent = new OsuSpriteText timeCurrentText = new OsuSpriteText
{ {
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
@ -38,13 +70,15 @@ namespace osu.Game.Screens.Play
{ {
Left = margin, Left = margin,
}, },
Text = @"0:00",
}, },
progress = new OsuSpriteText progressText = new OsuSpriteText
{ {
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Colour = colours.BlueLighter, Colour = colours.BlueLighter,
Font = @"Venera", Font = @"Venera",
Text = @"0%",
}, },
timeLeft = new OsuSpriteText timeLeft = new OsuSpriteText
{ {