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:
parent
3134e14b37
commit
8a9b3f6459
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user