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;
|
2024-02-22 10:57:18 -05:00
|
|
|
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)
|
2024-01-23 20:40:32 -05:00
|
|
|
: base("Average Aim Error")
|
2024-01-23 16:08:29 -05:00
|
|
|
{
|
2024-02-22 10:57:18 -05:00
|
|
|
Vector2? offsetVector = hitEvents.CalculateAverageAimError();
|
2024-01-23 16:08:29 -05:00
|
|
|
|
2024-02-22 10:57:18 -05:00
|
|
|
Value = offsetVector?.Length;
|
2024-01-23 16:08:29 -05:00
|
|
|
}
|
|
|
|
|
2024-01-23 20:40:32 -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
|
|
|
}
|
|
|
|
}
|