mirror of
https://github.com/ppy/osu
synced 2025-01-18 20:10:49 +00:00
Apply NRT to HitEventTimingDistributionGraph
This commit is contained in:
parent
ac324c63e2
commit
0755289ec3
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -48,6 +46,12 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly IReadOnlyList<HitEvent> hitEvents;
|
private readonly IReadOnlyList<HitEvent> hitEvents;
|
||||||
|
|
||||||
|
private readonly IDictionary<HitResult, int>[] bins;
|
||||||
|
private double binSize;
|
||||||
|
private double hitOffset;
|
||||||
|
|
||||||
|
private Bar[]? barDrawables;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="HitEventTimingDistributionGraph"/>.
|
/// Creates a new <see cref="HitEventTimingDistributionGraph"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -55,22 +59,15 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
public HitEventTimingDistributionGraph(IReadOnlyList<HitEvent> hitEvents)
|
public HitEventTimingDistributionGraph(IReadOnlyList<HitEvent> hitEvents)
|
||||||
{
|
{
|
||||||
this.hitEvents = hitEvents.Where(e => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows) && e.Result.IsHit()).ToList();
|
this.hitEvents = hitEvents.Where(e => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows) && e.Result.IsHit()).ToList();
|
||||||
|
bins = Enumerable.Range(0, total_timing_distribution_bins).Select(_ => new Dictionary<HitResult, int>()).ToArray<IDictionary<HitResult, int>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private IDictionary<HitResult, int>[] bins;
|
|
||||||
private double binSize;
|
|
||||||
private double hitOffset;
|
|
||||||
|
|
||||||
private Bar[] barDrawables;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
if (hitEvents == null || hitEvents.Count == 0)
|
if (hitEvents.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bins = Enumerable.Range(0, total_timing_distribution_bins).Select(_ => new Dictionary<HitResult, int>()).ToArray<IDictionary<HitResult, int>>();
|
|
||||||
|
|
||||||
binSize = Math.Ceiling(hitEvents.Max(e => Math.Abs(e.TimeOffset)) / timing_distribution_bins);
|
binSize = Math.Ceiling(hitEvents.Max(e => Math.Abs(e.TimeOffset)) / timing_distribution_bins);
|
||||||
|
|
||||||
// Prevent div-by-0 by enforcing a minimum bin size
|
// Prevent div-by-0 by enforcing a minimum bin size
|
||||||
@ -217,11 +214,12 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
private readonly BindableFloat basalHeight;
|
private readonly BindableFloat basalHeight;
|
||||||
private readonly BindableFloat offsetAdjustment;
|
private readonly BindableFloat offsetAdjustment;
|
||||||
|
|
||||||
private Circle[] boxOriginals;
|
private Circle[] boxOriginals = null!;
|
||||||
private Circle boxAdjustment;
|
|
||||||
|
private Circle? boxAdjustment;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuColour colours { get; set; }
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
public Bar(IDictionary<HitResult, int> values, float maxValue, bool isCentre)
|
public Bar(IDictionary<HitResult, int> values, float maxValue, bool isCentre)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user