1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-22 07:36:05 +08:00

Address unstable rate calculations as a list for marginal gains

This commit is contained in:
Dean Herbert 2024-11-25 19:24:58 +09:00
parent 605fe71f46
commit 33d725e889
No known key found for this signature in database
4 changed files with 4 additions and 6 deletions

View File

@ -20,7 +20,8 @@ namespace osu.Game.Tests.NonVisual.Ranking
public void TestDistributedHits()
{
var events = Enumerable.Range(-5, 11)
.Select(t => new HitEvent(t - 5, 1.0, HitResult.Great, new HitObject(), null, null));
.Select(t => new HitEvent(t - 5, 1.0, HitResult.Great, new HitObject(), null, null))
.ToList();
var unstableRate = new UnstableRate(events);

View File

@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Scoring
/// A non-null <see langword="double"/> value if unstable rate could be calculated,
/// and <see langword="null"/> if unstable rate cannot be calculated due to <paramref name="hitEvents"/> being empty.
/// </returns>
public static double? CalculateUnstableRate(this IEnumerable<HitEvent> hitEvents)
public static double? CalculateUnstableRate(this IReadOnlyList<HitEvent> hitEvents)
{
Debug.Assert(hitEvents.All(ev => ev.GameplayRate != null));

View File

@ -44,9 +44,6 @@ namespace osu.Game.Screens.Play.HUD
DrawableCount.FadeTo(e.NewValue ? 1 : alpha_when_invalid, 1000, Easing.OutQuint));
}
private bool changesUnstableRate(JudgementResult judgement)
=> judgement.HitObject.HitWindows != HitWindows.Empty && judgement.IsHit;
protected override void LoadComplete()
{
base.LoadComplete();

View File

@ -15,7 +15,7 @@ namespace osu.Game.Screens.Ranking.Statistics
/// Creates and computes an <see cref="UnstableRate"/> statistic.
/// </summary>
/// <param name="hitEvents">Sequence of <see cref="HitEvent"/>s to calculate the unstable rate based on.</param>
public UnstableRate(IEnumerable<HitEvent> hitEvents)
public UnstableRate(IReadOnlyList<HitEvent> hitEvents)
: base("Unstable Rate")
{
Value = hitEvents.CalculateUnstableRate();