From 6da092ab30215db25a9e322e53879aad8348820c Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 19 Oct 2016 14:02:03 -0400 Subject: [PATCH] Fix additional bugs, tweak L+F --- osu.Game/Database/BeatmapDatabase.cs | 9 +++-- osu.Game/Database/BeatmapInfo.cs | 2 +- osu.Game/GameModes/Play/BeatmapGroup.cs | 12 +++++- osu.Game/GameModes/Play/PlaySongSelect.cs | 45 ++++++++++++++--------- 4 files changed, 45 insertions(+), 23 deletions(-) diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 4d980283f6..553bba6cb8 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -56,13 +56,13 @@ namespace osu.Game.Database var beatmapSet = new BeatmapSetInfo { BeatmapSetID = metadata.BeatmapSetID, + Beatmaps = new List(), Path = path, Hash = hash, }; - beatmapSet.Metadata = metadata; - connection.Insert(beatmapSet); connection.Insert(metadata); - var maps = new List(); + beatmapSet.Metadata = metadata; + connection.Insert(beatmapSet); using (var reader = ArchiveReader.GetReader(storage, path)) { string[] mapNames = reader.ReadBeatmaps(); @@ -73,9 +73,10 @@ namespace osu.Game.Database var decoder = BeatmapDecoder.GetDecoder(stream); Beatmap beatmap = decoder.Decode(stream); beatmap.BeatmapInfo.Path = name; + beatmap.BeatmapInfo.BeatmapSetID = beatmapSet.BeatmapSetID; // TODO: Diff beatmap metadata with set metadata and leave it here if necessary beatmap.BeatmapInfo.Metadata = null; - maps.Add(beatmap.BeatmapInfo); + beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo); connection.Insert(beatmap.BeatmapInfo); } } diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index 996a887e77..874b6e3f8a 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -11,7 +11,7 @@ namespace osu.Game.Database { [PrimaryKey] public int BeatmapID { get; set; } - [ForeignKey(typeof(BeatmapSetInfo)), NotNull] + [ForeignKey(typeof(BeatmapSetInfo))] public int BeatmapSetID { get; set; } [ManyToOne] public BeatmapSetInfo BeatmapSet { get; set; } diff --git a/osu.Game/GameModes/Play/BeatmapGroup.cs b/osu.Game/GameModes/Play/BeatmapGroup.cs index 280952e58b..955fa656ac 100644 --- a/osu.Game/GameModes/Play/BeatmapGroup.cs +++ b/osu.Game/GameModes/Play/BeatmapGroup.cs @@ -24,6 +24,7 @@ namespace osu.Game.GameModes.Play public event Action SetSelected; public event Action BeatmapSelected; public BeatmapSetInfo BeatmapSet; + private BeatmapSetBox setBox; private FlowContainer topContainer; private FlowContainer difficulties; private bool collapsed; @@ -48,6 +49,11 @@ namespace osu.Game.GameModes.Play topContainer.Remove(difficulties); else topContainer.Add(difficulties); + setBox.BorderColour = new Color4( + setBox.BorderColour.R, + setBox.BorderColour.G, + setBox.BorderColour.B, + collapsed ? 0 : 255); } } @@ -64,7 +70,7 @@ namespace osu.Game.GameModes.Play RelativeSizeAxes = Axes.X, Size = new Vector2(1, 0), Direction = FlowDirection.VerticalOnly, - Children = new[] { new BeatmapSetBox(beatmapSet) } + Children = new[] { setBox = new BeatmapSetBox(beatmapSet) } } }; difficulties = new FlowContainer // Deliberately not added to children @@ -96,6 +102,10 @@ namespace osu.Game.GameModes.Play this.beatmapSet = beatmapSet; RelativeSizeAxes = Axes.X; Size = new Vector2(1, 0); + Masking = true; + CornerRadius = 5; + BorderThickness = 2; + BorderColour = new Color4(221, 255, 255, 0); Children = new Drawable[] { new Box diff --git a/osu.Game/GameModes/Play/PlaySongSelect.cs b/osu.Game/GameModes/Play/PlaySongSelect.cs index 78bd4408b6..8b8dbcab77 100644 --- a/osu.Game/GameModes/Play/PlaySongSelect.cs +++ b/osu.Game/GameModes/Play/PlaySongSelect.cs @@ -56,30 +56,41 @@ namespace osu.Game.GameModes.Play public PlaySongSelect() { - const float backgroundWidth = 0.6f; - const float backgroundSlant = 25; + const float scrollWidth = 500; Children = new Drawable[] { - new Box + new Container { RelativeSizeAxes = Axes.Both, - Size = new Vector2(backgroundWidth, 0.5f), - Colour = new Color4(0, 0, 0, 0.5f), - }, - new Box - { - RelativeSizeAxes = Axes.Both, - RelativePositionAxes = Axes.Y, - Size = new Vector2(backgroundWidth, 0.5f), - Position = new Vector2(0, 0.5f), - Colour = new Color4(0, 0, 0, 0.5f), + Size = new Vector2(1), + Padding = new MarginPadding { Right = scrollWidth - 100 }, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Size = new Vector2(1, 0.5f), + Colour = new Color4(0, 0, 0, 0.5f), + Shear = new Vector2(0.15f, 0), + }, + new Box + { + RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.Both, + Size = new Vector2(1, 0.5f), + Position = new Vector2(0, 0.5f), + Colour = new Color4(0, 0, 0, 0.5f), + // TODO: Figure out the inverse shear problem + //Shear = new Vector2(-0.15f, 0), + }, + } }, scrollContainer = new ScrollContainer { - RelativeSizeAxes = Axes.Both, - RelativePositionAxes = Axes.Both, - Size = new Vector2(0.5f, 1), - Position = new Vector2(0.5f, 0), + RelativeSizeAxes = Axes.Y, + Size = new Vector2(scrollWidth, 1), + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, Children = new Drawable[] { setList = new FlowContainer