mirror of
https://github.com/ppy/osu.git
synced 2024-12-18 19:43:03 +08:00
Stop preview playback when an overlay is popping out
This commit is contained in:
parent
a24589f583
commit
572c3f5189
@ -102,12 +102,6 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
public void StopPreview()
|
||||
{
|
||||
if (preview.Playing)
|
||||
preview.TriggerOnClick();
|
||||
}
|
||||
|
||||
private class DetailBox : Container
|
||||
{
|
||||
private readonly Container content;
|
||||
|
@ -1,23 +1,24 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.BeatmapSet;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Overlays.BeatmapSet.Scores;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
@ -37,6 +38,7 @@ namespace osu.Game.Overlays
|
||||
private readonly ScrollContainer scroll;
|
||||
|
||||
private BeatmapSetInfo beatmapSet;
|
||||
private PreviewTrackManager previewTrackManager;
|
||||
|
||||
public BeatmapSetInfo BeatmapSet
|
||||
{
|
||||
@ -109,10 +111,11 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(APIAccess api, RulesetStore rulesets)
|
||||
private void load(APIAccess api, RulesetStore rulesets, PreviewTrackManager previewTrackManager)
|
||||
{
|
||||
this.api = api;
|
||||
this.rulesets = rulesets;
|
||||
this.previewTrackManager = previewTrackManager;
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
@ -124,7 +127,7 @@ namespace osu.Game.Overlays
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
header.Details.StopPreview();
|
||||
previewTrackManager.CurrentTrack?.Stop();
|
||||
|
||||
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out).OnComplete(_ => BeatmapSet = null);
|
||||
}
|
||||
|
@ -4,12 +4,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
@ -18,6 +18,7 @@ using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.Direct;
|
||||
using osu.Game.Overlays.SearchableList;
|
||||
using osu.Game.Rulesets;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
@ -176,11 +177,12 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, APIAccess api, RulesetStore rulesets, BeatmapManager beatmaps)
|
||||
private void load(OsuColour colours, APIAccess api, RulesetStore rulesets, BeatmapManager beatmaps, PreviewTrackManager previewTrackManager)
|
||||
{
|
||||
this.api = api;
|
||||
this.rulesets = rulesets;
|
||||
this.beatmaps = beatmaps;
|
||||
this.previewTrackManager = previewTrackManager;
|
||||
|
||||
resultCountsContainer.Colour = colours.Yellow;
|
||||
|
||||
@ -254,6 +256,7 @@ namespace osu.Game.Overlays
|
||||
private readonly Bindable<string> currentQuery = new Bindable<string>();
|
||||
|
||||
private ScheduledDelegate queryChangedDebounce;
|
||||
private PreviewTrackManager previewTrackManager;
|
||||
|
||||
private void updateSearch()
|
||||
{
|
||||
@ -297,6 +300,12 @@ namespace osu.Game.Overlays
|
||||
|
||||
private int distinctCount(List<string> list) => list.Distinct().ToArray().Length;
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
previewTrackManager.CurrentTrack?.Stop();
|
||||
base.PopOut();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
@ -2,14 +2,13 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -18,6 +17,8 @@ using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.Profile;
|
||||
using osu.Game.Overlays.Profile.Sections;
|
||||
using osu.Game.Users;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
@ -30,6 +31,7 @@ namespace osu.Game.Overlays
|
||||
protected ProfileHeader Header;
|
||||
private SectionsContainer<ProfileSection> sectionsContainer;
|
||||
private ProfileTabControl tabs;
|
||||
private PreviewTrackManager previewTrackManager;
|
||||
|
||||
public const float CONTENT_X_MARGIN = 50;
|
||||
|
||||
@ -56,9 +58,10 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(APIAccess api)
|
||||
private void load(APIAccess api, PreviewTrackManager previewTrackManager)
|
||||
{
|
||||
this.api = api;
|
||||
this.previewTrackManager = previewTrackManager;
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
@ -70,6 +73,7 @@ namespace osu.Game.Overlays
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
previewTrackManager.CurrentTrack?.Stop();
|
||||
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user