diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index c069197f94..fad5c56d43 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -76,21 +76,22 @@ namespace osu.Game.Tests.Visual.Online { overlay.ShowBeatmapSet(new BeatmapSetInfo { + OnlineBeatmapSetID = 1235, Metadata = new BeatmapMetadata { - Title = @"Lachryma ", - Artist = @"Kaneko Chiharu", - Source = @"SOUND VOLTEX III GRAVITY WARS", - Tags = @"sdvx grace the 5th kac original song contest konami bemani", + Title = @"an awesome beatmap", + Artist = @"naru narusegawa", + Source = @"hinata sou", + Tags = @"test tag tag more tag", Author = new User { - Username = @"Fresh Chicken", - Id = 3984370, + Username = @"BanchoBot", + Id = 3, }, }, OnlineInfo = new BeatmapSetOnlineInfo { - Preview = @"https://b.ppy.sh/preview/415886.mp3", + Preview = @"https://b.ppy.sh/preview/12345.mp3", PlayCount = 681380, FavouriteCount = 356, Submitted = new DateTime(2016, 2, 10), @@ -237,7 +238,7 @@ namespace osu.Game.Tests.Visual.Online }, }, }, - }, false); + }); }); downloadAssert(true); @@ -250,6 +251,7 @@ namespace osu.Game.Tests.Visual.Online { overlay.ShowBeatmapSet(new BeatmapSetInfo { + OnlineBeatmapSetID = 1234, Metadata = new BeatmapMetadata { Title = @"Soumatou Labyrinth", @@ -415,7 +417,7 @@ namespace osu.Game.Tests.Visual.Online }, }, }, - }, false); + }); }); downloadAssert(false); diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 821840ef95..19f6a3f692 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -31,8 +31,6 @@ namespace osu.Game.Overlays private RulesetStore rulesets; - private readonly OsuScrollContainer scroll; - private readonly Bindable beatmapSet = new Bindable(); // receive input outside our bounds so we can trigger a close event on ourselves. @@ -40,6 +38,7 @@ namespace osu.Game.Overlays public BeatmapSetOverlay() { + OsuScrollContainer scroll; Info info; ScoresContainer scores; @@ -76,6 +75,8 @@ namespace osu.Game.Overlays { info.Beatmap = b.NewValue; scores.Beatmap = b.NewValue; + + scroll.ScrollToStart(); }; } @@ -119,18 +120,14 @@ namespace osu.Game.Overlays Show(); } - public void ShowBeatmapSet(BeatmapSetInfo set, bool refetch = true) + /// + /// Show an already fully-populated beatmap set. + /// + /// The set to show. + public void ShowBeatmapSet(BeatmapSetInfo set) { - // Re-fetching is the correct way forward. - if (refetch) - FetchAndShowBeatmapSet(set?.OnlineBeatmapSetID ?? 0); - else - { - beatmapSet.Value = set; - Show(); - } - - scroll.ScrollTo(0); + beatmapSet.Value = set; + Show(); } } } diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index c918a84ab0..584b25f83f 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -45,6 +46,8 @@ namespace osu.Game.Overlays.Direct protected DirectPanel(BeatmapSetInfo setInfo) { + Debug.Assert(setInfo.OnlineBeatmapSetID != null); + SetInfo = setInfo; } @@ -119,12 +122,11 @@ namespace osu.Game.Overlays.Direct protected override bool OnClick(ClickEvent e) { - ShowInformation(); + Debug.Assert(SetInfo.OnlineBeatmapSetID != null); + beatmapSetOverlay?.FetchAndShowBeatmapSet(SetInfo.OnlineBeatmapSetID.Value); return true; } - protected void ShowInformation() => beatmapSetOverlay?.ShowBeatmapSet(SetInfo); - protected override void LoadComplete() { base.LoadComplete();