1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-17 21:13:01 +08:00

Remove unnecessary customisation settings in DifficultySpectrumDisplay

This commit is contained in:
Dean Herbert
2025-03-19 16:32:17 +09:00
Unverified
parent e51b666f5c
commit cfb14fbca6
4 changed files with 12 additions and 73 deletions
@@ -15,8 +15,6 @@ namespace osu.Game.Tests.Visual.Beatmaps
{
public partial class TestSceneDifficultySpectrumDisplay : OsuTestScene
{
private DifficultySpectrumDisplay display;
private static APIBeatmapSet createBeatmapSetWith(params (int rulesetId, double stars)[] difficulties) => new APIBeatmapSet
{
Beatmaps = difficulties.Select(difficulty => new APIBeatmap
@@ -78,32 +76,9 @@ namespace osu.Game.Tests.Visual.Beatmaps
createDisplay(beatmapSet);
}
[Test]
public void TestAdjustableDotSize()
{
var beatmapSet = createBeatmapSetWith(
(rulesetId: 0, stars: 2.0),
(rulesetId: 3, stars: 2.3),
(rulesetId: 0, stars: 3.2),
(rulesetId: 1, stars: 4.3),
(rulesetId: 0, stars: 5.6));
createDisplay(beatmapSet);
AddStep("change dot dimensions", () =>
{
display.DotSize = new Vector2(8, 12);
display.DotSpacing = 2;
});
AddStep("change dot dimensions back", () =>
{
display.DotSize = new Vector2(4, 8);
display.DotSpacing = 1;
});
}
private void createDisplay(IBeatmapSetInfo beatmapSetInfo) => AddStep("create spectrum display", () => Child = display = new DifficultySpectrumDisplay(beatmapSetInfo)
private void createDisplay(IBeatmapSetInfo beatmapSetInfo) => AddStep("create spectrum display", () => Child = new DifficultySpectrumDisplay
{
BeatmapSet = beatmapSetInfo,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(3)
@@ -36,11 +36,11 @@ namespace osu.Game.Beatmaps.Drawables.Cards
Origin = Anchor.CentreLeft,
TextSize = 13f
},
new DifficultySpectrumDisplay(beatmapSet)
new DifficultySpectrumDisplay
{
BeatmapSet = beatmapSet,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
DotSize = new Vector2(5, 10)
}
}
};
@@ -18,34 +18,6 @@ namespace osu.Game.Beatmaps.Drawables
{
public partial class DifficultySpectrumDisplay : CompositeDrawable
{
private Vector2 dotSize = new Vector2(4, 8);
public Vector2 DotSize
{
get => dotSize;
set
{
dotSize = value;
if (IsLoaded)
updateDisplay();
}
}
private float dotSpacing = 1;
public float DotSpacing
{
get => dotSpacing;
set
{
dotSpacing = value;
if (IsLoaded)
updateDisplay();
}
}
private IBeatmapSetInfo? beatmapSet;
public IBeatmapSetInfo? BeatmapSet
@@ -60,9 +32,10 @@ namespace osu.Game.Beatmaps.Drawables
}
}
private readonly FillFlowContainer<RulesetDifficultyGroup> flow;
private FillFlowContainer<RulesetDifficultyGroup> flow = null!;
public DifficultySpectrumDisplay(IBeatmapSetInfo? beatmapSet = null)
[BackgroundDependencyLoader]
private void load()
{
AutoSizeAxes = Axes.Both;
@@ -72,8 +45,6 @@ namespace osu.Game.Beatmaps.Drawables
Spacing = new Vector2(10, 0),
Direction = FillDirection.Horizontal,
};
BeatmapSet = beatmapSet;
}
protected override void LoadComplete()
@@ -94,10 +65,7 @@ namespace osu.Game.Beatmaps.Drawables
foreach (var rulesetGrouping in beatmapSet.Beatmaps.GroupBy(beatmap => beatmap.Ruleset).OrderBy(group => group.Key))
{
flow.Add(new RulesetDifficultyGroup(rulesetGrouping.Key.OnlineID, rulesetGrouping, collapsed, dotSize)
{
Spacing = new Vector2(DotSpacing, 0f),
});
flow.Add(new RulesetDifficultyGroup(rulesetGrouping.Key.OnlineID, rulesetGrouping, collapsed));
}
}
@@ -106,14 +74,12 @@ namespace osu.Game.Beatmaps.Drawables
private readonly int rulesetId;
private readonly IEnumerable<IBeatmapInfo> beatmapInfos;
private readonly bool collapsed;
private readonly Vector2 dotSize;
public RulesetDifficultyGroup(int rulesetId, IEnumerable<IBeatmapInfo> beatmapInfos, bool collapsed, Vector2 dotSize)
public RulesetDifficultyGroup(int rulesetId, IEnumerable<IBeatmapInfo> beatmapInfos, bool collapsed)
{
this.rulesetId = rulesetId;
this.beatmapInfos = beatmapInfos;
this.collapsed = collapsed;
this.dotSize = dotSize;
}
[BackgroundDependencyLoader]
@@ -133,7 +99,7 @@ namespace osu.Game.Beatmaps.Drawables
if (!collapsed)
{
foreach (var beatmapInfo in beatmapInfos.OrderBy(bi => bi.StarRating))
Add(new DifficultyDot(beatmapInfo.StarRating, dotSize));
Add(new DifficultyDot(beatmapInfo.StarRating));
}
else
{
@@ -153,10 +119,10 @@ namespace osu.Game.Beatmaps.Drawables
{
private readonly double starDifficulty;
public DifficultyDot(double starDifficulty, Vector2 dotSize)
public DifficultyDot(double starDifficulty)
{
this.starDifficulty = starDifficulty;
Size = dotSize;
Size = new Vector2(5, 10);
}
[BackgroundDependencyLoader]
@@ -106,8 +106,6 @@ namespace osu.Game.Screens.SelectV2
},
difficultiesDisplay = new DifficultySpectrumDisplay
{
DotSize = new Vector2(5, 10),
DotSpacing = 2,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},