Use FrameStabilityClock to denote current position on song progress

This commit is contained in:
Dean Herbert
2019-05-09 18:06:11 +09:00
parent 5942072128
commit 9248e6290c
4 changed files with 35 additions and 13 deletions

View File

@ -10,6 +10,7 @@ using osu.Game.Graphics;
using osu.Framework.Allocation;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Timing;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.UI;
@ -55,7 +56,9 @@ namespace osu.Game.Screens.Play
private readonly BindableBool replayLoaded = new BindableBool();
private GameplayClock gameplayClock;
public IClock ReferenceClock;
private IClock gameplayClock;
[BackgroundDependencyLoader(true)]
private void load(OsuColour colours, GameplayClock clock)
@ -154,10 +157,12 @@ namespace osu.Game.Screens.Play
if (objects == null)
return;
double position = gameplayClock?.CurrentTime ?? Time.Current;
double progress = Math.Min(1, (position - firstHitTime) / (lastHitTime - firstHitTime));
double gameplayTime = gameplayClock?.CurrentTime ?? Time.Current;
double frameStableTime = ReferenceClock?.CurrentTime ?? gameplayTime;
bar.CurrentTime = position;
double progress = Math.Min(1, (frameStableTime - firstHitTime) / (lastHitTime - firstHitTime));
bar.CurrentTime = gameplayTime;
graph.Progress = (int)(graph.ColumnCount * progress);
}
}