1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 13:22:55 +08:00

Merge pull request #1373 from EVAST9919/beatmap-preview-fix

Fix audio preview still playing after closing the beatmap overlay
This commit is contained in:
Dean Herbert 2017-10-30 16:31:47 +09:00 committed by GitHub
commit 3a202e1a42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 9 deletions

View File

@ -88,6 +88,8 @@ namespace osu.Game.Overlays.BeatmapSet
};
}
public void StopPreview() => preview.Playing.Value = false;
private class DetailBox : Container
{
private readonly Container content;

View File

@ -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)
{

View File

@ -26,7 +26,7 @@ namespace osu.Game.Overlays.BeatmapSet
private readonly PlayButton playButton;
private Track preview => playButton.Preview;
private Bindable<bool> playing => playButton.Playing;
public Bindable<bool> 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);
}

View File

@ -98,6 +98,7 @@ namespace osu.Game.Overlays
protected override void PopOut()
{
base.PopOut();
header.Details.StopPreview();
FadeEdgeEffectTo(0, DISAPPEAR_DURATION, Easing.Out);
}