mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 07:22:54 +08:00
Rename BeatmapMetrics
to APIFailTimes
This commit is contained in:
parent
4969ab0599
commit
2c308f3008
@ -98,7 +98,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
SliderCount = 12,
|
||||
PlayCount = 222,
|
||||
PassCount = 21,
|
||||
Metrics = new BeatmapMetrics
|
||||
FailTimes = new APIFailTimes
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
@ -176,7 +176,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
SliderCount = 45,
|
||||
PlayCount = 567,
|
||||
PassCount = 89,
|
||||
Metrics = new BeatmapMetrics
|
||||
FailTimes = new APIFailTimes
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
@ -206,7 +206,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
BaseDifficulty = new BeatmapDifficulty(),
|
||||
OnlineInfo = new APIBeatmap
|
||||
{
|
||||
Metrics = new BeatmapMetrics
|
||||
FailTimes = new APIFailTimes
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
@ -292,7 +292,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
},
|
||||
OnlineInfo = new APIBeatmap
|
||||
{
|
||||
Metrics = new BeatmapMetrics
|
||||
FailTimes = new APIFailTimes
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(j => j % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(j => j % 12 - 6).ToArray(),
|
||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
OnlineInfo = new APIBeatmap
|
||||
{
|
||||
Metrics = new BeatmapMetrics
|
||||
FailTimes = new APIFailTimes
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(_ => RNG.Next(10)).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(_ => RNG.Next(10)).ToArray(),
|
||||
|
@ -60,16 +60,16 @@ namespace osu.Game.Tests.Visual.Online
|
||||
var secondBeatmap = createBeatmap();
|
||||
|
||||
AddStep("set first set", () => successRate.BeatmapInfo = firstBeatmap);
|
||||
AddAssert("ratings set", () => successRate.Graph.Metrics == firstBeatmap.Metrics);
|
||||
AddAssert("ratings set", () => successRate.Graph.FailTimes == firstBeatmap.FailTimes);
|
||||
|
||||
AddStep("set second set", () => successRate.BeatmapInfo = secondBeatmap);
|
||||
AddAssert("ratings set", () => successRate.Graph.Metrics == secondBeatmap.Metrics);
|
||||
AddAssert("ratings set", () => successRate.Graph.FailTimes == secondBeatmap.FailTimes);
|
||||
|
||||
static BeatmapInfo createBeatmap() => new BeatmapInfo
|
||||
{
|
||||
OnlineInfo = new APIBeatmap
|
||||
{
|
||||
Metrics = new BeatmapMetrics
|
||||
FailTimes = new APIFailTimes
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(_ => RNG.Next(10)).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(_ => RNG.Next(10)).ToArray(),
|
||||
@ -85,7 +85,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
OnlineInfo = new APIBeatmap
|
||||
{
|
||||
Metrics = new BeatmapMetrics
|
||||
FailTimes = new APIFailTimes
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).ToArray(),
|
||||
}
|
||||
@ -102,7 +102,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
OnlineInfo = new APIBeatmap
|
||||
{
|
||||
Metrics = new BeatmapMetrics(),
|
||||
FailTimes = new APIFailTimes(),
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
StarDifficulty = 5.3f,
|
||||
OnlineInfo = new APIBeatmap
|
||||
{
|
||||
Metrics = new BeatmapMetrics
|
||||
FailTimes = new APIFailTimes
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
@ -92,7 +92,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
StarDifficulty = 5.3f,
|
||||
OnlineInfo = new APIBeatmap
|
||||
{
|
||||
Metrics = new BeatmapMetrics
|
||||
FailTimes = new APIFailTimes
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
@ -151,7 +151,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
StarDifficulty = 2.91f,
|
||||
OnlineInfo = new APIBeatmap
|
||||
{
|
||||
Metrics = new BeatmapMetrics
|
||||
FailTimes = new APIFailTimes
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Beatmaps
|
||||
/// <summary>
|
||||
/// Beatmap metrics based on accumulated online data from community plays.
|
||||
/// </summary>
|
||||
public class BeatmapMetrics
|
||||
public class APIFailTimes
|
||||
{
|
||||
/// <summary>
|
||||
/// Points of failure on a relative time scale (usually 0..100).
|
@ -216,7 +216,7 @@ namespace osu.Game.Beatmaps
|
||||
public int PassCount => OnlineInfo.PassCount;
|
||||
|
||||
[JsonIgnore]
|
||||
public BeatmapMetrics Metrics => OnlineInfo.Metrics;
|
||||
public APIFailTimes FailTimes => OnlineInfo.FailTimes;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
@ -35,6 +35,6 @@ namespace osu.Game.Beatmaps
|
||||
/// </summary>
|
||||
public int PassCount { get; }
|
||||
|
||||
BeatmapMetrics? Metrics { get; }
|
||||
APIFailTimes? FailTimes { get; }
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
public string DifficultyName { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty(@"failtimes")]
|
||||
public BeatmapMetrics? Metrics { get; set; }
|
||||
public APIFailTimes? FailTimes { get; set; }
|
||||
|
||||
[JsonProperty(@"max_combo")]
|
||||
public int? MaxCombo { get; set; }
|
||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
successRate.Length = rate;
|
||||
percentContainer.ResizeWidthTo(successRate.Length, 250, Easing.InOutCubic);
|
||||
|
||||
Graph.Metrics = beatmapInfo?.Metrics;
|
||||
Graph.FailTimes = beatmapInfo?.FailTimes;
|
||||
}
|
||||
|
||||
public SuccessRate()
|
||||
|
@ -43,7 +43,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private BeatmapInfo beatmapInfo;
|
||||
|
||||
private BeatmapMetrics metrics;
|
||||
private APIFailTimes failTimes;
|
||||
|
||||
private int[] ratings;
|
||||
|
||||
public BeatmapInfo BeatmapInfo
|
||||
@ -55,7 +56,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
beatmapInfo = value;
|
||||
|
||||
metrics = beatmapInfo?.OnlineInfo?.Metrics;
|
||||
failTimes = beatmapInfo?.OnlineInfo?.FailTimes;
|
||||
ratings = beatmapInfo?.BeatmapSet?.Ratings;
|
||||
|
||||
Scheduler.AddOnce(updateStatistics);
|
||||
@ -182,7 +183,7 @@ namespace osu.Game.Screens.Select
|
||||
tags.Text = BeatmapInfo?.Metadata?.Tags;
|
||||
|
||||
// metrics may have been previously fetched
|
||||
if (ratings != null && metrics != null)
|
||||
if (ratings != null && failTimes != null)
|
||||
{
|
||||
updateMetrics();
|
||||
return;
|
||||
@ -208,7 +209,7 @@ namespace osu.Game.Screens.Select
|
||||
return;
|
||||
|
||||
ratings = res.BeatmapSet?.Ratings;
|
||||
metrics = res.Metrics;
|
||||
failTimes = res.FailTimes;
|
||||
|
||||
updateMetrics();
|
||||
});
|
||||
@ -232,7 +233,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private void updateMetrics()
|
||||
{
|
||||
var hasMetrics = (metrics?.Retries?.Any() ?? false) || (metrics?.Fails?.Any() ?? false);
|
||||
var hasMetrics = (failTimes?.Retries?.Any() ?? false) || (failTimes?.Fails?.Any() ?? false);
|
||||
|
||||
if (ratings?.Any() ?? false)
|
||||
{
|
||||
@ -248,12 +249,12 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
if (hasMetrics)
|
||||
{
|
||||
failRetryGraph.Metrics = metrics;
|
||||
failRetryGraph.FailTimes = failTimes;
|
||||
failRetryContainer.FadeIn(transition_duration);
|
||||
}
|
||||
else
|
||||
{
|
||||
failRetryGraph.Metrics = new BeatmapMetrics
|
||||
failRetryGraph.FailTimes = new APIFailTimes
|
||||
{
|
||||
Fails = new int[100],
|
||||
Retries = new int[100],
|
||||
|
@ -16,19 +16,19 @@ namespace osu.Game.Screens.Select.Details
|
||||
{
|
||||
private readonly BarGraph retryGraph, failGraph;
|
||||
|
||||
private BeatmapMetrics metrics;
|
||||
private APIFailTimes failTimes;
|
||||
|
||||
public BeatmapMetrics Metrics
|
||||
public APIFailTimes FailTimes
|
||||
{
|
||||
get => metrics;
|
||||
get => failTimes;
|
||||
set
|
||||
{
|
||||
if (value == metrics) return;
|
||||
if (value == failTimes) return;
|
||||
|
||||
metrics = value;
|
||||
failTimes = value;
|
||||
|
||||
var retries = Metrics?.Retries ?? Array.Empty<int>();
|
||||
var fails = Metrics?.Fails ?? Array.Empty<int>();
|
||||
var retries = FailTimes?.Retries ?? Array.Empty<int>();
|
||||
var fails = FailTimes?.Fails ?? Array.Empty<int>();
|
||||
var retriesAndFails = sumRetriesAndFails(retries, fails);
|
||||
|
||||
float maxValue = retriesAndFails.Any() ? retriesAndFails.Max() : 0;
|
||||
|
Loading…
Reference in New Issue
Block a user