From d21b7f0050f1da0dd087e5a01e836fff4396afd2 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 13 Oct 2016 13:49:44 -0400 Subject: [PATCH] Fix up song select based on upstream changes --- osu.Game/Beatmaps/Formats/BeatmapDecoder.cs | 2 +- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 1 + osu.Game/GameModes/Play/PlaySongSelect.cs | 16 +++++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index 92f2452484..f376d831cf 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -23,4 +23,4 @@ namespace osu.Game.Beatmaps.Formats public abstract Beatmap Decode(TextReader stream); } -} \ No newline at end of file +} diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 585dff4226..78f05676b7 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -21,6 +21,7 @@ namespace osu.Game.Beatmaps.Formats AddDecoder(@"osu file format v12"); AddDecoder(@"osu file format v11"); AddDecoder(@"osu file format v10"); + AddDecoder(@"osu file format v9"); // TODO: Not sure how far back to go, or differences between versions } diff --git a/osu.Game/GameModes/Play/PlaySongSelect.cs b/osu.Game/GameModes/Play/PlaySongSelect.cs index bdabb8d8dd..edf144db6f 100644 --- a/osu.Game/GameModes/Play/PlaySongSelect.cs +++ b/osu.Game/GameModes/Play/PlaySongSelect.cs @@ -10,16 +10,20 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.GameModes.Backgrounds; using osu.Framework; +using osu.Game.Database; +using osu.Framework.Graphics.Primitives; namespace osu.Game.GameModes.Play { class PlaySongSelect : OsuGameMode { private Bindable playMode; + private BeatmapDatabase beatmaps; // TODO: use currently selected track as bg protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4"); + private ScrollContainer scrollContainer; private FlowContainer setList; private Drawable createSetUI(BeatmapSet bset) @@ -29,7 +33,7 @@ namespace osu.Game.GameModes.Play private void addBeatmapSets() { - var sets = (Game as OsuGame).Beatmaps.GetBeatmapSets(); + var sets = beatmaps.GetBeatmapSets(); foreach (var beatmapSet in sets) setList.Add(createSetUI(beatmapSet)); } @@ -38,15 +42,14 @@ namespace osu.Game.GameModes.Play { Children = new[] { - new ScrollContainer + scrollContainer = new ScrollContainer { - OriginPosition = new OpenTK.Vector2(0, -(Game as OsuGame).Toolbar.Height), Children = new[] { setList = new FlowContainer { Direction = FlowDirection.VerticalOnly, - Padding = new OpenTK.Vector2(25, 25) + Padding = new MarginPadding(25), } } } @@ -61,10 +64,13 @@ namespace osu.Game.GameModes.Play playMode = osu.PlayMode; playMode.ValueChanged += PlayMode_ValueChanged; + beatmaps = osu.Beatmaps; + + scrollContainer.Padding = new MarginPadding { Top = osu.Toolbar.Height }; addBeatmapSets(); - (Game as OsuGame).Beatmaps.BeatmapSetAdded += bset => setList.Add(createSetUI(bset)); + beatmaps.BeatmapSetAdded += bset => setList.Add(createSetUI(bset)); } protected override void Dispose(bool isDisposing)