1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:12:57 +08:00

Move converted beatmap icons logic locally

This commit is contained in:
Joseph Madamba 2023-01-15 14:17:46 -08:00
parent b733f46c6f
commit ae49e724e4
2 changed files with 3 additions and 7 deletions

View File

@ -13,7 +13,6 @@ 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;
@ -117,9 +116,6 @@ 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)

View File

@ -170,7 +170,7 @@ namespace osu.Game.Overlays.BeatmapSet
.Where(b => b.Ruleset.MatchesOnlineID(ruleset.Value)) .Where(b => b.Ruleset.MatchesOnlineID(ruleset.Value))
.OrderBy(b => !b.Convert) .OrderBy(b => !b.Convert)
.ThenBy(b => b.StarRating) .ThenBy(b => b.StarRating)
.Select(b => new DifficultySelectorButton(b) .Select(b => new DifficultySelectorButton(b, b.Convert ? new RulesetInfo { OnlineID = 0 } : null)
{ {
State = DifficultySelectorState.NotSelected, State = DifficultySelectorState.NotSelected,
OnHovered = beatmap => OnHovered = beatmap =>
@ -254,7 +254,7 @@ namespace osu.Game.Overlays.BeatmapSet
} }
} }
public DifficultySelectorButton(APIBeatmap beatmapInfo) public DifficultySelectorButton(APIBeatmap beatmapInfo, IRulesetInfo? ruleset)
{ {
Beatmap = beatmapInfo; Beatmap = beatmapInfo;
Size = new Vector2(size); Size = new Vector2(size);
@ -273,7 +273,7 @@ namespace osu.Game.Overlays.BeatmapSet
Alpha = 0.5f Alpha = 0.5f
} }
}, },
icon = new DifficultyIcon(beatmapInfo) icon = new DifficultyIcon(beatmapInfo, ruleset)
{ {
ShowTooltip = false, ShowTooltip = false,
Current = { Value = new StarDifficulty(beatmapInfo.StarRating, 0) }, Current = { Value = new StarDifficulty(beatmapInfo.StarRating, 0) },