1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-13 10:37:19 +08:00

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
1.2 KiB
C#
Raw Normal View History

2024-01-23 16:08:29 -05:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Game.Rulesets.Osu.Scoring;
2024-01-23 16:08:29 -05:00
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Ranking.Statistics;
using osuTK;
namespace osu.Game.Rulesets.Osu.Statistics
{
/// <summary>
2024-01-23 23:48:12 -05:00
/// Displays the aim error statistic for a given play.
2024-01-23 16:08:29 -05:00
/// </summary>
public partial class AverageAimError : SimpleStatisticItem<double?>
{
/// <summary>
/// Creates and computes an <see cref="AverageHitError"/> statistic.
/// </summary>
2024-01-23 23:48:12 -05:00
/// <param name="hitEvents">Sequence of <see cref="HitEvent"/>s to calculate the aim error based on.</param>
2024-01-23 16:08:29 -05:00
public AverageAimError(IEnumerable<HitEvent> hitEvents)
: base("Average Aim Error")
2024-01-23 16:08:29 -05:00
{
Vector2? offsetVector = hitEvents.CalculateAverageAimError();
2024-01-23 16:08:29 -05:00
Value = offsetVector?.Length;
2024-01-23 16:08:29 -05:00
}
protected override string DisplayValue(double? value) => value == null ? "(not available)" : $"{Math.Abs(value.Value):N2} osu! pixels from center";
2024-01-23 16:08:29 -05:00
}
}