mirror of
https://github.com/ppy/osu
synced 2025-02-08 22:27:14 +00:00
Remove rewinded keycounter states
This commit is contained in:
parent
3134e14b37
commit
8a9b3f6459
@ -152,6 +152,15 @@ namespace osu.Game.Screens.Play
|
||||
RestoreState(Clock.CurrentTime);
|
||||
}
|
||||
|
||||
public void RestoreState(double time) => CountPresses = states.LastOrDefault(state => state.Time <= time)?.Count ?? 0;
|
||||
public void RestoreState(double time)
|
||||
{
|
||||
var targetState = states.LastOrDefault(state => state.Time <= time);
|
||||
var targetIndex = states.IndexOf(targetState);
|
||||
|
||||
states.RemoveRange(targetIndex + 1, states.Count - (targetIndex + 1));
|
||||
|
||||
lastState = targetState;
|
||||
CountPresses = targetState?.Count ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user