diff --git a/osu.Game/Overlays/BeatmapSet/Details.cs b/osu.Game/Overlays/BeatmapSet/Details.cs index 2fd0a55d9e..128ea7d2d3 100644 --- a/osu.Game/Overlays/BeatmapSet/Details.cs +++ b/osu.Game/Overlays/BeatmapSet/Details.cs @@ -88,6 +88,8 @@ namespace osu.Game.Overlays.BeatmapSet }; } + public void StopPreview() => preview.Playing.Value = false; + private class DetailBox : Container { private readonly Container content; diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index a93ccbf704..d4514cbaed 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.BeatmapSet private readonly Container coverContainer; private readonly OsuSpriteText title, artist; private readonly AuthorInfo author; - private readonly Details details; + public Details Details; private DelayedLoadWrapper cover; @@ -42,7 +42,7 @@ namespace osu.Game.Overlays.BeatmapSet if (value == beatmapSet) return; beatmapSet = value; - Picker.BeatmapSet = author.BeatmapSet = details.BeatmapSet = BeatmapSet; + Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = BeatmapSet; title.Text = BeatmapSet.Metadata.Title; artist.Text = BeatmapSet.Metadata.Artist; @@ -192,7 +192,7 @@ namespace osu.Game.Overlays.BeatmapSet }, }, }, - details = new Details + Details = new Details { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, @@ -204,7 +204,7 @@ namespace osu.Game.Overlays.BeatmapSet Picker.Beatmap.ValueChanged += b => { - details.Beatmap = b; + Details.Beatmap = b; if (b.OnlineInfo.HasVideo) { diff --git a/osu.Game/Overlays/BeatmapSet/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/PreviewButton.cs index f77a1f4a0a..52edd1714f 100644 --- a/osu.Game/Overlays/BeatmapSet/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/PreviewButton.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays.BeatmapSet private readonly PlayButton playButton; private Track preview => playButton.Preview; - private Bindable playing => playButton.Playing; + public Bindable Playing => playButton.Playing; public BeatmapSetInfo BeatmapSet { @@ -66,8 +66,8 @@ namespace osu.Game.Overlays.BeatmapSet }, }; - Action = () => playing.Value = !playing.Value; - playing.ValueChanged += newValue => progress.FadeTo(newValue ? 1 : 0, 100); + Action = () => Playing.Value = !Playing.Value; + Playing.ValueChanged += newValue => progress.FadeTo(newValue ? 1 : 0, 100); } [BackgroundDependencyLoader] @@ -80,7 +80,7 @@ namespace osu.Game.Overlays.BeatmapSet { base.Update(); - if (playing.Value && preview != null) + if (Playing.Value && preview != null) { progress.Width = (float)(preview.CurrentTime / preview.Length); } @@ -88,7 +88,7 @@ namespace osu.Game.Overlays.BeatmapSet protected override void Dispose(bool isDisposing) { - playing.Value = false; + Playing.Value = false; base.Dispose(isDisposing); } diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index a60429f737..ddd146bcb6 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -98,6 +98,7 @@ namespace osu.Game.Overlays protected override void PopOut() { base.PopOut(); + header.Details.StopPreview(); FadeEdgeEffectTo(0, DISAPPEAR_DURATION, Easing.Out); }