mirror of
https://github.com/ppy/osu
synced 2024-12-27 01:12:45 +00:00
Make PreviewTrack.owner private
This commit is contained in:
parent
5bb6757cbd
commit
9b69e1825d
@ -13,7 +13,7 @@ namespace osu.Game.Audio
|
||||
public class PreviewTrack : Component
|
||||
{
|
||||
public Track Track { get; private set; }
|
||||
public readonly OverlayContainer Owner;
|
||||
private readonly OverlayContainer owner;
|
||||
|
||||
private readonly BeatmapSetInfo beatmapSetInfo;
|
||||
|
||||
@ -23,7 +23,7 @@ namespace osu.Game.Audio
|
||||
public PreviewTrack(BeatmapSetInfo beatmapSetInfo, OverlayContainer owner)
|
||||
{
|
||||
this.beatmapSetInfo = beatmapSetInfo;
|
||||
Owner = owner;
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -38,8 +38,14 @@ namespace osu.Game.Audio
|
||||
Started?.Invoke();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
/// <summary>
|
||||
/// Stop preview playback
|
||||
/// </summary>
|
||||
/// <param name="source">An <see cref="OverlayContainer"/> which is probably the owner of this <see cref="PreviewTrack"/></param>
|
||||
public void Stop(OverlayContainer source = null)
|
||||
{
|
||||
if (source != null && owner != source)
|
||||
return;
|
||||
Track.Stop();
|
||||
Stopped?.Invoke();
|
||||
}
|
||||
|
@ -127,8 +127,7 @@ namespace osu.Game.Overlays
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
if (previewTrackManager.CurrentTrack?.Owner == this)
|
||||
previewTrackManager.CurrentTrack?.Stop();
|
||||
previewTrackManager.CurrentTrack?.Stop(this);
|
||||
|
||||
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out).OnComplete(_ => BeatmapSet = null);
|
||||
}
|
||||
|
@ -302,8 +302,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
if (previewTrackManager.CurrentTrack?.Owner == this)
|
||||
previewTrackManager.CurrentTrack?.Stop();
|
||||
previewTrackManager.CurrentTrack?.Stop(this);
|
||||
base.PopOut();
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ namespace osu.Game.Overlays
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
previewTrackManager.CurrentTrack?.Stop();
|
||||
previewTrackManager.CurrentTrack?.Stop(this);
|
||||
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user