mirror of
https://github.com/ppy/osu
synced 2024-12-27 17:32:56 +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 class PreviewTrack : Component
|
||||||
{
|
{
|
||||||
public Track Track { get; private set; }
|
public Track Track { get; private set; }
|
||||||
public readonly OverlayContainer Owner;
|
private readonly OverlayContainer owner;
|
||||||
|
|
||||||
private readonly BeatmapSetInfo beatmapSetInfo;
|
private readonly BeatmapSetInfo beatmapSetInfo;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ namespace osu.Game.Audio
|
|||||||
public PreviewTrack(BeatmapSetInfo beatmapSetInfo, OverlayContainer owner)
|
public PreviewTrack(BeatmapSetInfo beatmapSetInfo, OverlayContainer owner)
|
||||||
{
|
{
|
||||||
this.beatmapSetInfo = beatmapSetInfo;
|
this.beatmapSetInfo = beatmapSetInfo;
|
||||||
Owner = owner;
|
this.owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -38,8 +38,14 @@ namespace osu.Game.Audio
|
|||||||
Started?.Invoke();
|
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();
|
Track.Stop();
|
||||||
Stopped?.Invoke();
|
Stopped?.Invoke();
|
||||||
}
|
}
|
||||||
|
@ -127,8 +127,7 @@ namespace osu.Game.Overlays
|
|||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
{
|
{
|
||||||
base.PopOut();
|
base.PopOut();
|
||||||
if (previewTrackManager.CurrentTrack?.Owner == this)
|
previewTrackManager.CurrentTrack?.Stop(this);
|
||||||
previewTrackManager.CurrentTrack?.Stop();
|
|
||||||
|
|
||||||
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out).OnComplete(_ => BeatmapSet = null);
|
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out).OnComplete(_ => BeatmapSet = null);
|
||||||
}
|
}
|
||||||
|
@ -302,8 +302,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
{
|
{
|
||||||
if (previewTrackManager.CurrentTrack?.Owner == this)
|
previewTrackManager.CurrentTrack?.Stop(this);
|
||||||
previewTrackManager.CurrentTrack?.Stop();
|
|
||||||
base.PopOut();
|
base.PopOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ namespace osu.Game.Overlays
|
|||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
{
|
{
|
||||||
base.PopOut();
|
base.PopOut();
|
||||||
previewTrackManager.CurrentTrack?.Stop();
|
previewTrackManager.CurrentTrack?.Stop(this);
|
||||||
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out);
|
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user