1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 02:02:53 +08:00

Make SongProgress return the actual time value via OnSeek.

This commit is contained in:
Dean Herbert 2017-04-26 18:17:17 +09:00
parent 01caaf44f3
commit 9d14b6e1e9
2 changed files with 6 additions and 4 deletions

View File

@ -165,9 +165,9 @@ namespace osu.Game.Screens.Play
hudOverlay.Progress.Objects = HitRenderer.Objects;
hudOverlay.Progress.AudioClock = decoupledClock;
hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded;
hudOverlay.Progress.OnSeek = progress =>
hudOverlay.Progress.OnSeek = pos =>
{
sourceClock.Seek(progress * track.Length);
decoupledClock.Seek(pos);
};
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)

View File

@ -35,6 +35,8 @@ namespace osu.Game.Screens.Play
private double lastHitTime => ((objects.Last() as IHasEndTime)?.EndTime ?? objects.Last().StartTime) + 1;
private double firstHitTime => objects.First().StartTime;
private IEnumerable<HitObject> objects;
public IEnumerable<HitObject> Objects
@ -75,7 +77,7 @@ namespace osu.Game.Screens.Play
Origin = Anchor.BottomLeft,
SeekRequested = delegate (float position)
{
OnSeek?.Invoke(position);
OnSeek?.Invoke(firstHitTime + position * (lastHitTime - firstHitTime));
},
},
};
@ -128,7 +130,7 @@ namespace osu.Game.Screens.Play
if (objects == null)
return;
double progress = (AudioClock?.CurrentTime ?? Time.Current) / lastHitTime;
double progress = ((AudioClock?.CurrentTime ?? Time.Current) - firstHitTime) / lastHitTime;
bar.UpdatePosition((float)progress);
graph.Progress = (int)(graph.ColumnCount * progress);