mirror of https://github.com/ppy/osu
Fix audio preview still playing after closing the beatmap overlay
This commit is contained in:
parent
b82f3fc710
commit
e8f85a08b8
|
@ -88,6 +88,8 @@ public Details()
|
|||
};
|
||||
}
|
||||
|
||||
public void StopPreview() => preview.Playing.Value = false;
|
||||
|
||||
private class DetailBox : Container
|
||||
{
|
||||
private readonly Container content;
|
||||
|
|
|
@ -27,7 +27,7 @@ public class Header : Container
|
|||
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 @@ public BeatmapSetInfo 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 @@ public Header()
|
|||
},
|
||||
},
|
||||
},
|
||||
details = new Details
|
||||
Details = new Details
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
|
@ -204,7 +204,7 @@ public Header()
|
|||
|
||||
Picker.Beatmap.ValueChanged += b =>
|
||||
{
|
||||
details.Beatmap = b;
|
||||
Details.Beatmap = b;
|
||||
|
||||
if (b.OnlineInfo.HasVideo)
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@ public class PreviewButton : OsuClickableContainer
|
|||
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 @@ public PreviewButton()
|
|||
},
|
||||
};
|
||||
|
||||
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 @@ protected override void Update()
|
|||
{
|
||||
base.Update();
|
||||
|
||||
if (playing.Value && preview != null)
|
||||
if (Playing.Value && preview != null)
|
||||
{
|
||||
progress.Width = (float)(preview.CurrentTime / preview.Length);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ protected override void Update()
|
|||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
playing.Value = false;
|
||||
Playing.Value = false;
|
||||
base.Dispose(isDisposing);
|
||||
}
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ protected override void PopIn()
|
|||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
header.Details.StopPreview();
|
||||
FadeEdgeEffectTo(0, DISAPPEAR_DURATION, Easing.Out);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue