mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Move metrics to beatmap set
This commit is contained in:
@ -87,6 +87,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Cover = @"https://assets.ppy.sh/beatmaps/415886/covers/cover.jpg?1465651778",
|
Cover = @"https://assets.ppy.sh/beatmaps/415886/covers/cover.jpg?1465651778",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() },
|
||||||
Beatmaps = new List<BeatmapInfo>
|
Beatmaps = new List<BeatmapInfo>
|
||||||
{
|
{
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
@ -111,7 +112,6 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
@ -138,7 +138,6 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
@ -165,7 +164,6 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
@ -192,7 +190,6 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
@ -219,7 +216,6 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
@ -258,6 +254,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Cover = @"https://assets.ppy.sh/beatmaps/625493/covers/cover.jpg?1499167472",
|
Cover = @"https://assets.ppy.sh/beatmaps/625493/covers/cover.jpg?1499167472",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() },
|
||||||
Beatmaps = new List<BeatmapInfo>
|
Beatmaps = new List<BeatmapInfo>
|
||||||
{
|
{
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
@ -282,7 +279,6 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
@ -309,7 +305,6 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
@ -336,7 +331,6 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
@ -363,7 +357,6 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
@ -390,7 +383,6 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
|
@ -32,6 +32,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
AddStep("all metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
AddStep("all metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
||||||
{
|
{
|
||||||
|
BeatmapSetInfo =
|
||||||
|
{
|
||||||
|
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
||||||
|
},
|
||||||
BeatmapInfo =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
Version = "All Metrics",
|
Version = "All Metrics",
|
||||||
@ -50,7 +54,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
StarDifficulty = 5.3f,
|
StarDifficulty = 5.3f,
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
@ -60,6 +63,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
AddStep("all except source", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
AddStep("all except source", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
||||||
{
|
{
|
||||||
|
BeatmapSetInfo =
|
||||||
|
{
|
||||||
|
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
||||||
|
},
|
||||||
BeatmapInfo =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
Version = "All Metrics",
|
Version = "All Metrics",
|
||||||
@ -77,7 +84,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
StarDifficulty = 5.3f,
|
StarDifficulty = 5.3f,
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
@ -86,6 +92,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
AddStep("ratings", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
AddStep("ratings", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
||||||
{
|
{
|
||||||
|
BeatmapSetInfo =
|
||||||
|
{
|
||||||
|
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
||||||
|
},
|
||||||
BeatmapInfo =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
Version = "Only Ratings",
|
Version = "Only Ratings",
|
||||||
@ -101,11 +111,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
OverallDifficulty = 6,
|
OverallDifficulty = 6,
|
||||||
ApproachRate = 6,
|
ApproachRate = 6,
|
||||||
},
|
},
|
||||||
StarDifficulty = 4.8f,
|
StarDifficulty = 4.8f
|
||||||
Metrics = new BeatmapMetrics
|
|
||||||
{
|
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -23,6 +23,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
AddStep("all metrics", () => details.Beatmap = new BeatmapInfo
|
AddStep("all metrics", () => details.Beatmap = new BeatmapInfo
|
||||||
{
|
{
|
||||||
|
BeatmapSet = new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
||||||
|
},
|
||||||
Version = "All Metrics",
|
Version = "All Metrics",
|
||||||
Metadata = new BeatmapMetadata
|
Metadata = new BeatmapMetadata
|
||||||
{
|
{
|
||||||
@ -39,7 +43,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
StarDifficulty = 5.3f,
|
StarDifficulty = 5.3f,
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
@ -47,6 +50,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
AddStep("all except source", () => details.Beatmap = new BeatmapInfo
|
AddStep("all except source", () => details.Beatmap = new BeatmapInfo
|
||||||
{
|
{
|
||||||
|
BeatmapSet = new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
||||||
|
},
|
||||||
Version = "All Metrics",
|
Version = "All Metrics",
|
||||||
Metadata = new BeatmapMetadata
|
Metadata = new BeatmapMetadata
|
||||||
{
|
{
|
||||||
@ -62,7 +69,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
StarDifficulty = 5.3f,
|
StarDifficulty = 5.3f,
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
@ -70,6 +76,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
AddStep("ratings", () => details.Beatmap = new BeatmapInfo
|
AddStep("ratings", () => details.Beatmap = new BeatmapInfo
|
||||||
{
|
{
|
||||||
|
BeatmapSet = new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
||||||
|
},
|
||||||
Version = "Only Ratings",
|
Version = "Only Ratings",
|
||||||
Metadata = new BeatmapMetadata
|
Metadata = new BeatmapMetadata
|
||||||
{
|
{
|
||||||
@ -84,10 +94,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
ApproachRate = 6,
|
ApproachRate = 6,
|
||||||
},
|
},
|
||||||
StarDifficulty = 4.8f,
|
StarDifficulty = 4.8f,
|
||||||
Metrics = new BeatmapMetrics
|
|
||||||
{
|
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("fails retries", () => details.Beatmap = new BeatmapInfo
|
AddStep("fails retries", () => details.Beatmap = new BeatmapInfo
|
||||||
@ -129,7 +135,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
ApproachRate = 6.5f,
|
ApproachRate = 6.5f,
|
||||||
},
|
},
|
||||||
StarDifficulty = 1.97f,
|
StarDifficulty = 1.97f,
|
||||||
Metrics = new BeatmapMetrics(),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("null beatmap", () => details.Beatmap = null);
|
AddStep("null beatmap", () => details.Beatmap = null);
|
||||||
|
@ -270,7 +270,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
},
|
},
|
||||||
Metrics = new BeatmapMetrics
|
Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
|
@ -7,15 +7,10 @@ using Newtonsoft.Json;
|
|||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Beatmap metrics based on acculumated online data from community plays.
|
/// Beatmap metrics based on accumulated online data from community plays.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BeatmapMetrics
|
public class BeatmapMetrics
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Total vote counts of user ratings on a scale of 0..10 where 0 is unused (probably will be fixed at API?).
|
|
||||||
/// </summary>
|
|
||||||
public int[] Ratings { get; set; } = Array.Empty<int>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Points of failure on a relative time scale (usually 0..100).
|
/// Points of failure on a relative time scale (usually 0..100).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -32,6 +32,9 @@ namespace osu.Game.Beatmaps
|
|||||||
[NotMapped]
|
[NotMapped]
|
||||||
public BeatmapSetOnlineInfo OnlineInfo { get; set; }
|
public BeatmapSetOnlineInfo OnlineInfo { get; set; }
|
||||||
|
|
||||||
|
[NotMapped]
|
||||||
|
public BeatmapSetMetrics Metrics { get; set; }
|
||||||
|
|
||||||
public double MaxStarDifficulty => Beatmaps?.Max(b => b.StarDifficulty) ?? 0;
|
public double MaxStarDifficulty => Beatmaps?.Max(b => b.StarDifficulty) ?? 0;
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
|
17
osu.Game/Beatmaps/BeatmapSetMetrics.cs
Normal file
17
osu.Game/Beatmaps/BeatmapSetMetrics.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// 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 Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps
|
||||||
|
{
|
||||||
|
public class BeatmapSetMetrics
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Total vote counts of user ratings on a scale of 0..10 where 0 is unused (probably will be fixed at API?).
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("ratings")]
|
||||||
|
public int[] Ratings { get; set; } = Array.Empty<int>();
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
using System;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
@ -19,9 +20,12 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int[] Ratings { get; set; } = Array.Empty<int>();
|
||||||
|
|
||||||
//and other metrics in the beatmap set.
|
//and other metrics in the beatmap set.
|
||||||
|
// Todo: What
|
||||||
[JsonProperty(@"beatmapset")]
|
[JsonProperty(@"beatmapset")]
|
||||||
private BeatmapMetrics beatmapSet
|
private BeatmapSetMetrics beatmapSet
|
||||||
{
|
{
|
||||||
set => Ratings = value.Ratings;
|
set => Ratings = value.Ratings;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
[JsonProperty(@"last_updated")]
|
[JsonProperty(@"last_updated")]
|
||||||
private DateTimeOffset lastUpdated { get; set; }
|
private DateTimeOffset lastUpdated { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"ratings")]
|
||||||
|
private int[] ratings { get; set; }
|
||||||
|
|
||||||
[JsonProperty(@"user_id")]
|
[JsonProperty(@"user_id")]
|
||||||
private long creatorId
|
private long creatorId
|
||||||
{
|
{
|
||||||
@ -70,6 +73,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
OnlineBeatmapSetID = OnlineBeatmapSetID,
|
OnlineBeatmapSetID = OnlineBeatmapSetID,
|
||||||
Metadata = this,
|
Metadata = this,
|
||||||
Status = Status,
|
Status = Status,
|
||||||
|
Metrics = new BeatmapSetMetrics { Ratings = ratings },
|
||||||
OnlineInfo = new BeatmapSetOnlineInfo
|
OnlineInfo = new BeatmapSetOnlineInfo
|
||||||
{
|
{
|
||||||
Covers = covers,
|
Covers = covers,
|
||||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
ratings.Metrics = Beatmap?.Metrics;
|
ratings.Metrics = Beatmap?.BeatmapSet?.Metrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Details()
|
public Details()
|
||||||
|
@ -18,6 +18,7 @@ using osu.Game.Screens.Select.Details;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
@ -181,9 +182,10 @@ namespace osu.Game.Screens.Select
|
|||||||
tags.Text = Beatmap?.Metadata?.Tags;
|
tags.Text = Beatmap?.Metadata?.Tags;
|
||||||
|
|
||||||
// metrics may have been previously fetched
|
// metrics may have been previously fetched
|
||||||
if (Beatmap?.Metrics != null)
|
// Todo:
|
||||||
|
if (Beatmap?.BeatmapSet?.Metrics != null)
|
||||||
{
|
{
|
||||||
updateMetrics(Beatmap.Metrics);
|
updateMetrics(new APIBeatmapMetrics { Ratings = Beatmap.BeatmapSet.Metrics.Ratings });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,22 +212,19 @@ namespace osu.Game.Screens.Select
|
|||||||
updateMetrics();
|
updateMetrics();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMetrics(BeatmapMetrics metrics = null)
|
private void updateMetrics(APIBeatmapMetrics metrics = null)
|
||||||
{
|
{
|
||||||
var hasRatings = metrics?.Ratings?.Any() ?? false;
|
var hasRatings = metrics?.Ratings?.Any() ?? false;
|
||||||
var hasRetriesFails = (metrics?.Retries?.Any() ?? false) && (metrics.Fails?.Any() ?? false);
|
var hasRetriesFails = (metrics?.Retries?.Any() ?? false) && (metrics.Fails?.Any() ?? false);
|
||||||
|
|
||||||
if (hasRatings)
|
if (hasRatings)
|
||||||
{
|
{
|
||||||
ratings.Metrics = metrics;
|
ratings.Metrics = new BeatmapSetMetrics { Ratings = metrics.Ratings };
|
||||||
ratingsContainer.FadeIn(transition_duration);
|
ratingsContainer.FadeIn(transition_duration);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ratings.Metrics = new BeatmapMetrics
|
ratings.Metrics = new BeatmapSetMetrics { Ratings = new int[10] };
|
||||||
{
|
|
||||||
Ratings = new int[10],
|
|
||||||
};
|
|
||||||
ratingsContainer.FadeTo(0.25f, transition_duration);
|
ratingsContainer.FadeTo(0.25f, transition_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
private readonly Container graphContainer;
|
private readonly Container graphContainer;
|
||||||
private readonly BarGraph graph;
|
private readonly BarGraph graph;
|
||||||
|
|
||||||
private BeatmapMetrics metrics;
|
private BeatmapSetMetrics metrics;
|
||||||
|
|
||||||
public BeatmapMetrics Metrics
|
public BeatmapSetMetrics Metrics
|
||||||
{
|
{
|
||||||
get => metrics;
|
get => metrics;
|
||||||
set
|
set
|
||||||
|
Reference in New Issue
Block a user