1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 10:22:56 +08:00

Add ability to view converted beatmaps on beatmap set overlay

This commit is contained in:
Joseph Madamba 2023-01-13 16:08:34 -08:00
parent efe6dae672
commit e7ab543799
5 changed files with 15 additions and 3 deletions

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets;
using osuTK;
using osuTK.Graphics;
@ -116,6 +117,9 @@ namespace osu.Game.Beatmaps.Drawables
private Drawable getRulesetIcon()
{
if ((beatmap as APIBeatmap)?.Convert == true)
return rulesets.GetRuleset(0)!.CreateInstance().CreateIcon();
int? onlineID = ruleset.OnlineID;
if (onlineID >= 0 && rulesets.GetRuleset(onlineID.Value)?.CreateInstance() is Ruleset rulesetInstance)

View File

@ -63,6 +63,9 @@ namespace osu.Game.Online.API.Requests.Responses
set => Length = TimeSpan.FromSeconds(value).TotalMilliseconds;
}
[JsonProperty(@"convert")]
public bool Convert { get; set; }
[JsonProperty(@"count_circles")]
public int CircleCount { get; set; }

View File

@ -125,6 +125,9 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"beatmaps")]
public APIBeatmap[] Beatmaps { get; set; } = Array.Empty<APIBeatmap>();
[JsonProperty(@"converts")]
public APIBeatmap[] Converts { get; set; } = Array.Empty<APIBeatmap>();
private BeatmapMetadata metadata => new BeatmapMetadata
{
Title = Title,

View File

@ -168,9 +168,10 @@ namespace osu.Game.Overlays.BeatmapSet
if (BeatmapSet != null)
{
Difficulties.ChildrenEnumerable = BeatmapSet.Beatmaps
Difficulties.ChildrenEnumerable = BeatmapSet.Beatmaps.Concat(BeatmapSet.Converts)
.Where(b => b.Ruleset.MatchesOnlineID(ruleset.Value))
.OrderBy(b => b.StarRating)
.OrderBy(b => !b.Convert)
.ThenBy(b => b.StarRating)
.Select(b => new DifficultySelectorButton(b)
{
State = DifficultySelectorState.NotSelected,

View File

@ -68,11 +68,12 @@ namespace osu.Game.Overlays.BeatmapSet
BeatmapSet.BindValueChanged(setInfo =>
{
int beatmapsCount = setInfo.NewValue?.Beatmaps.Count(b => b.Ruleset.MatchesOnlineID(Value)) ?? 0;
int osuBeatmaps = setInfo.NewValue?.Beatmaps.Count(b => b.Ruleset.OnlineID == 0) ?? 0;
count.Text = beatmapsCount.ToString();
countContainer.FadeTo(beatmapsCount > 0 ? 1 : 0);
Enabled.Value = beatmapsCount > 0;
Enabled.Value = beatmapsCount > 0 || osuBeatmaps > 0;
}, true);
}
}