1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00

Remove rewinded keycounter states

This commit is contained in:
Roman Kapustin 2018-08-15 22:18:48 +03:00
parent 3134e14b37
commit 8a9b3f6459

View File

@ -152,6 +152,15 @@ namespace osu.Game.Screens.Play
RestoreState(Clock.CurrentTime); 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;
}
} }
} }