2023-06-23 00:37:25 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2020-08-27 03:20:43 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Ranking.Statistics
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Displays the unstable rate statistic for a given play.
|
|
|
|
|
/// </summary>
|
2022-11-24 13:32:20 +08:00
|
|
|
|
public partial class UnstableRate : SimpleStatisticItem<double?>
|
2020-08-27 03:20:43 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 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)
|
|
|
|
|
: base("Unstable Rate")
|
|
|
|
|
{
|
2021-11-11 20:09:48 +08:00
|
|
|
|
Value = hitEvents.CalculateUnstableRate();
|
2020-08-27 03:20:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-11 20:09:48 +08:00
|
|
|
|
protected override string DisplayValue(double? value) => value == null ? "(not available)" : value.Value.ToString(@"N2");
|
2020-08-27 03:20:43 +08:00
|
|
|
|
}
|
|
|
|
|
}
|