mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Add ability to view converted beatmaps on beatmap set overlay
This commit is contained in:
@ -13,6 +13,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
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;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -116,6 +117,9 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
|
|
||||||
private Drawable getRulesetIcon()
|
private Drawable getRulesetIcon()
|
||||||
{
|
{
|
||||||
|
if ((beatmap as APIBeatmap)?.Convert == true)
|
||||||
|
return rulesets.GetRuleset(0)!.CreateInstance().CreateIcon();
|
||||||
|
|
||||||
int? onlineID = ruleset.OnlineID;
|
int? onlineID = ruleset.OnlineID;
|
||||||
|
|
||||||
if (onlineID >= 0 && rulesets.GetRuleset(onlineID.Value)?.CreateInstance() is Ruleset rulesetInstance)
|
if (onlineID >= 0 && rulesets.GetRuleset(onlineID.Value)?.CreateInstance() is Ruleset rulesetInstance)
|
||||||
|
@ -63,6 +63,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
set => Length = TimeSpan.FromSeconds(value).TotalMilliseconds;
|
set => Length = TimeSpan.FromSeconds(value).TotalMilliseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonProperty(@"convert")]
|
||||||
|
public bool Convert { get; set; }
|
||||||
|
|
||||||
[JsonProperty(@"count_circles")]
|
[JsonProperty(@"count_circles")]
|
||||||
public int CircleCount { get; set; }
|
public int CircleCount { get; set; }
|
||||||
|
|
||||||
|
@ -125,6 +125,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
[JsonProperty(@"beatmaps")]
|
[JsonProperty(@"beatmaps")]
|
||||||
public APIBeatmap[] Beatmaps { get; set; } = Array.Empty<APIBeatmap>();
|
public APIBeatmap[] Beatmaps { get; set; } = Array.Empty<APIBeatmap>();
|
||||||
|
|
||||||
|
[JsonProperty(@"converts")]
|
||||||
|
public APIBeatmap[] Converts { get; set; } = Array.Empty<APIBeatmap>();
|
||||||
|
|
||||||
private BeatmapMetadata metadata => new BeatmapMetadata
|
private BeatmapMetadata metadata => new BeatmapMetadata
|
||||||
{
|
{
|
||||||
Title = Title,
|
Title = Title,
|
||||||
|
@ -168,9 +168,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
if (BeatmapSet != null)
|
if (BeatmapSet != null)
|
||||||
{
|
{
|
||||||
Difficulties.ChildrenEnumerable = BeatmapSet.Beatmaps
|
Difficulties.ChildrenEnumerable = BeatmapSet.Beatmaps.Concat(BeatmapSet.Converts)
|
||||||
.Where(b => b.Ruleset.MatchesOnlineID(ruleset.Value))
|
.Where(b => b.Ruleset.MatchesOnlineID(ruleset.Value))
|
||||||
.OrderBy(b => b.StarRating)
|
.OrderBy(b => !b.Convert)
|
||||||
|
.ThenBy(b => b.StarRating)
|
||||||
.Select(b => new DifficultySelectorButton(b)
|
.Select(b => new DifficultySelectorButton(b)
|
||||||
{
|
{
|
||||||
State = DifficultySelectorState.NotSelected,
|
State = DifficultySelectorState.NotSelected,
|
||||||
|
@ -68,11 +68,12 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
BeatmapSet.BindValueChanged(setInfo =>
|
BeatmapSet.BindValueChanged(setInfo =>
|
||||||
{
|
{
|
||||||
int beatmapsCount = setInfo.NewValue?.Beatmaps.Count(b => b.Ruleset.MatchesOnlineID(Value)) ?? 0;
|
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();
|
count.Text = beatmapsCount.ToString();
|
||||||
countContainer.FadeTo(beatmapsCount > 0 ? 1 : 0);
|
countContainer.FadeTo(beatmapsCount > 0 ? 1 : 0);
|
||||||
|
|
||||||
Enabled.Value = beatmapsCount > 0;
|
Enabled.Value = beatmapsCount > 0 || osuBeatmaps > 0;
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user