mirror of
https://github.com/ppy/osu
synced 2025-01-11 00:29:30 +00:00
Restore keycounter state on replay seek
This commit is contained in:
parent
1d9bf42082
commit
7f3ad37ede
@ -68,7 +68,7 @@ namespace osu.Game.Screens.Play
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
KeyCounter = CreateKeyCounter(offsetClock),
|
||||
KeyCounter = CreateKeyCounter(adjustableClock),
|
||||
HoldToQuit = CreateQuitButton(),
|
||||
}
|
||||
}
|
||||
@ -81,7 +81,11 @@ namespace osu.Game.Screens.Play
|
||||
Progress.Objects = rulesetContainer.Objects;
|
||||
Progress.AudioClock = offsetClock;
|
||||
Progress.AllowSeeking = rulesetContainer.HasReplayLoaded;
|
||||
Progress.OnSeek = pos => adjustableClock.Seek(pos);
|
||||
Progress.OnSeek = pos =>
|
||||
{
|
||||
adjustableClock.Seek(pos);
|
||||
KeyCounter.RestoreKeyCounterState(pos);
|
||||
};
|
||||
|
||||
ModDisplay.Current.BindTo(working.Mods);
|
||||
|
||||
|
@ -46,6 +46,15 @@ namespace osu.Game.Screens.Play
|
||||
key.KeyPressed += () => keyCountersState[key.Name].Add(key.SaveState());
|
||||
}
|
||||
|
||||
public void RestoreKeyCounterState(double time)
|
||||
{
|
||||
foreach (var counter in Children)
|
||||
{
|
||||
var targetState = keyCountersState[counter.Name].LastOrDefault(state => state.CurrentTime <= time);
|
||||
counter.RestoreState(targetState);
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetCount()
|
||||
{
|
||||
foreach (var counter in Children)
|
||||
|
Loading…
Reference in New Issue
Block a user