mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 04:13:00 +08:00
Standardise and simplify the amount of beatmap information passed around song select.
This commit is contained in:
parent
ccb00aeb94
commit
4cf2dd90d6
@ -26,12 +26,12 @@ namespace osu.Game.Beatmaps.Drawable
|
||||
/// </summary>
|
||||
public Action<BeatmapGroup, BeatmapInfo> SelectionChanged;
|
||||
|
||||
private BeatmapSetInfo beatmapSet;
|
||||
public BeatmapSetHeader Header;
|
||||
|
||||
private BeatmapGroupState state;
|
||||
|
||||
public List<BeatmapPanel> BeatmapPanels;
|
||||
private WorkingBeatmap beatmap;
|
||||
|
||||
public BeatmapGroupState State
|
||||
{
|
||||
@ -65,11 +65,11 @@ namespace osu.Game.Beatmaps.Drawable
|
||||
}
|
||||
}
|
||||
|
||||
public BeatmapGroup(BeatmapSetInfo beatmapSet, WorkingBeatmap working)
|
||||
public BeatmapGroup(WorkingBeatmap beatmap)
|
||||
{
|
||||
this.beatmapSet = beatmapSet;
|
||||
this.beatmap = beatmap;
|
||||
|
||||
Header = new BeatmapSetHeader(beatmapSet, working)
|
||||
Header = new BeatmapSetHeader(beatmap)
|
||||
{
|
||||
GainedSelection = headerGainedSelection,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
@ -77,7 +77,7 @@ namespace osu.Game.Beatmaps.Drawable
|
||||
Origin = Anchor.TopRight,
|
||||
};
|
||||
|
||||
BeatmapPanels = beatmapSet.Beatmaps.Select(b => new BeatmapPanel(b)
|
||||
BeatmapPanels = beatmap.BeatmapSetInfo.Beatmaps.Select(b => new BeatmapPanel(b)
|
||||
{
|
||||
GainedSelection = panelGainedSelection,
|
||||
Anchor = Anchor.TopRight,
|
||||
|
@ -21,17 +21,18 @@ namespace osu.Game.Beatmaps.Drawable
|
||||
class BeatmapSetHeader : Panel
|
||||
{
|
||||
public Action<BeatmapSetHeader> GainedSelection;
|
||||
private BeatmapSetInfo beatmapSet;
|
||||
private SpriteText title, artist;
|
||||
private OsuConfigManager config;
|
||||
private Bindable<bool> preferUnicode;
|
||||
|
||||
public BeatmapSetHeader(BeatmapSetInfo beatmapSet, WorkingBeatmap working)
|
||||
private Bindable<bool> preferUnicode;
|
||||
private WorkingBeatmap beatmap;
|
||||
|
||||
public BeatmapSetHeader(WorkingBeatmap beatmap)
|
||||
{
|
||||
this.beatmapSet = beatmapSet;
|
||||
this.beatmap = beatmap;
|
||||
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
{
|
||||
new PanelBackground(working)
|
||||
new PanelBackground(beatmap)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
@ -45,7 +46,7 @@ namespace osu.Game.Beatmaps.Drawable
|
||||
title = new SpriteText
|
||||
{
|
||||
Font = @"Exo2.0-BoldItalic",
|
||||
Text = beatmapSet.Metadata.Title,
|
||||
Text = beatmap.BeatmapSetInfo.Metadata.Title,
|
||||
TextSize = 22,
|
||||
Shadow = true,
|
||||
},
|
||||
@ -53,7 +54,7 @@ namespace osu.Game.Beatmaps.Drawable
|
||||
{
|
||||
Margin = new MarginPadding { Top = -1 },
|
||||
Font = @"Exo2.0-SemiBoldItalic",
|
||||
Text = beatmapSet.Metadata.Artist,
|
||||
Text = beatmap.BeatmapSetInfo.Metadata.Artist,
|
||||
TextSize = 17,
|
||||
Shadow = true,
|
||||
},
|
||||
@ -89,8 +90,8 @@ namespace osu.Game.Beatmaps.Drawable
|
||||
}
|
||||
private void preferUnicode_changed(object sender, EventArgs e)
|
||||
{
|
||||
title.Text = config.GetUnicodeString(beatmapSet.Metadata.Title, beatmapSet.Metadata.TitleUnicode);
|
||||
artist.Text = config.GetUnicodeString(beatmapSet.Metadata.Artist, beatmapSet.Metadata.ArtistUnicode);
|
||||
title.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Title, beatmap.BeatmapSetInfo.Metadata.TitleUnicode);
|
||||
artist.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Artist, beatmap.BeatmapSetInfo.Metadata.ArtistUnicode);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -346,6 +346,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
base.OnBeatmapChanged(beatmap);
|
||||
|
||||
//todo: change background in selectionChanged instead; support per-difficulty backgrounds.
|
||||
changeBackground(beatmap);
|
||||
|
||||
selectBeatmap(beatmap.BeatmapInfo);
|
||||
@ -389,9 +390,9 @@ namespace osu.Game.Screens.Select
|
||||
beatmapSet.Beatmaps.ForEach(b => database.GetChildren(b));
|
||||
beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.BaseDifficulty.OverallDifficulty).ToList();
|
||||
|
||||
var working = database.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault());
|
||||
var beatmap = database.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault());
|
||||
|
||||
var group = new BeatmapGroup(beatmapSet, working) { SelectionChanged = selectionChanged };
|
||||
var group = new BeatmapGroup(beatmap) { SelectionChanged = selectionChanged };
|
||||
|
||||
//for the time being, let's completely load the difficulty panels in the background.
|
||||
//this likely won't scale so well, but allows us to completely async the loading flow.
|
||||
|
Loading…
Reference in New Issue
Block a user