mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 16:52:54 +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:
commit
3a202e1a42
@ -88,6 +88,8 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void StopPreview() => preview.Playing.Value = false;
|
||||||
|
|
||||||
private class DetailBox : Container
|
private class DetailBox : Container
|
||||||
{
|
{
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private readonly Container coverContainer;
|
private readonly Container coverContainer;
|
||||||
private readonly OsuSpriteText title, artist;
|
private readonly OsuSpriteText title, artist;
|
||||||
private readonly AuthorInfo author;
|
private readonly AuthorInfo author;
|
||||||
private readonly Details details;
|
public Details Details;
|
||||||
|
|
||||||
private DelayedLoadWrapper cover;
|
private DelayedLoadWrapper cover;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
if (value == beatmapSet) return;
|
if (value == beatmapSet) return;
|
||||||
beatmapSet = value;
|
beatmapSet = value;
|
||||||
|
|
||||||
Picker.BeatmapSet = author.BeatmapSet = details.BeatmapSet = BeatmapSet;
|
Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = BeatmapSet;
|
||||||
title.Text = BeatmapSet.Metadata.Title;
|
title.Text = BeatmapSet.Metadata.Title;
|
||||||
artist.Text = BeatmapSet.Metadata.Artist;
|
artist.Text = BeatmapSet.Metadata.Artist;
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
details = new Details
|
Details = new Details
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
@ -204,7 +204,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
Picker.Beatmap.ValueChanged += b =>
|
Picker.Beatmap.ValueChanged += b =>
|
||||||
{
|
{
|
||||||
details.Beatmap = b;
|
Details.Beatmap = b;
|
||||||
|
|
||||||
if (b.OnlineInfo.HasVideo)
|
if (b.OnlineInfo.HasVideo)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private readonly PlayButton playButton;
|
private readonly PlayButton playButton;
|
||||||
|
|
||||||
private Track preview => playButton.Preview;
|
private Track preview => playButton.Preview;
|
||||||
private Bindable<bool> playing => playButton.Playing;
|
public Bindable<bool> Playing => playButton.Playing;
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet
|
public BeatmapSetInfo BeatmapSet
|
||||||
{
|
{
|
||||||
@ -66,8 +66,8 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Action = () => playing.Value = !playing.Value;
|
Action = () => Playing.Value = !Playing.Value;
|
||||||
playing.ValueChanged += newValue => progress.FadeTo(newValue ? 1 : 0, 100);
|
Playing.ValueChanged += newValue => progress.FadeTo(newValue ? 1 : 0, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -80,7 +80,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (playing.Value && preview != null)
|
if (Playing.Value && preview != null)
|
||||||
{
|
{
|
||||||
progress.Width = (float)(preview.CurrentTime / preview.Length);
|
progress.Width = (float)(preview.CurrentTime / preview.Length);
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
playing.Value = false;
|
Playing.Value = false;
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ namespace osu.Game.Overlays
|
|||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
{
|
{
|
||||||
base.PopOut();
|
base.PopOut();
|
||||||
|
header.Details.StopPreview();
|
||||||
FadeEdgeEffectTo(0, DISAPPEAR_DURATION, Easing.Out);
|
FadeEdgeEffectTo(0, DISAPPEAR_DURATION, Easing.Out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user