mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Merge pull request #15286 from peppy/use-beatmap-interfaces-more-uncontested
Update `PreviewTrackManager` to use `IBeatmapSetInfo`
This commit is contained in:
commit
1b7745f283
@ -224,7 +224,7 @@ namespace osu.Game.Tests.Visual.Components
|
|||||||
|
|
||||||
public new PreviewTrack CurrentTrack => base.CurrentTrack;
|
public new PreviewTrack CurrentTrack => base.CurrentTrack;
|
||||||
|
|
||||||
protected override TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, ITrackStore trackStore) => new TestPreviewTrack(beatmapSetInfo, trackStore);
|
protected override TrackManagerPreviewTrack CreatePreviewTrack(IBeatmapSetInfo beatmapSetInfo, ITrackStore trackStore) => new TestPreviewTrack(beatmapSetInfo, trackStore);
|
||||||
|
|
||||||
public override bool UpdateSubTree()
|
public override bool UpdateSubTree()
|
||||||
{
|
{
|
||||||
@ -240,7 +240,7 @@ namespace osu.Game.Tests.Visual.Components
|
|||||||
|
|
||||||
public new Track Track => base.Track;
|
public new Track Track => base.Track;
|
||||||
|
|
||||||
public TestPreviewTrack(BeatmapSetInfo beatmapSetInfo, ITrackStore trackManager)
|
public TestPreviewTrack(IBeatmapSetInfo beatmapSetInfo, ITrackStore trackManager)
|
||||||
: base(beatmapSetInfo, trackManager)
|
: base(beatmapSetInfo, trackManager)
|
||||||
{
|
{
|
||||||
this.trackManager = trackManager;
|
this.trackManager = trackManager;
|
||||||
|
@ -43,11 +43,11 @@ namespace osu.Game.Audio
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves a <see cref="PreviewTrack"/> for a <see cref="BeatmapSetInfo"/>.
|
/// Retrieves a <see cref="PreviewTrack"/> for a <see cref="IBeatmapSetInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="beatmapSetInfo">The <see cref="BeatmapSetInfo"/> to retrieve the preview track for.</param>
|
/// <param name="beatmapSetInfo">The <see cref="IBeatmapSetInfo"/> to retrieve the preview track for.</param>
|
||||||
/// <returns>The playable <see cref="PreviewTrack"/>.</returns>
|
/// <returns>The playable <see cref="PreviewTrack"/>.</returns>
|
||||||
public PreviewTrack Get(BeatmapSetInfo beatmapSetInfo)
|
public PreviewTrack Get(IBeatmapSetInfo beatmapSetInfo)
|
||||||
{
|
{
|
||||||
var track = CreatePreviewTrack(beatmapSetInfo, trackStore);
|
var track = CreatePreviewTrack(beatmapSetInfo, trackStore);
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ namespace osu.Game.Audio
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the <see cref="TrackManagerPreviewTrack"/>.
|
/// Creates the <see cref="TrackManagerPreviewTrack"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, ITrackStore trackStore) =>
|
protected virtual TrackManagerPreviewTrack CreatePreviewTrack(IBeatmapSetInfo beatmapSetInfo, ITrackStore trackStore) =>
|
||||||
new TrackManagerPreviewTrack(beatmapSetInfo, trackStore);
|
new TrackManagerPreviewTrack(beatmapSetInfo, trackStore);
|
||||||
|
|
||||||
public class TrackManagerPreviewTrack : PreviewTrack
|
public class TrackManagerPreviewTrack : PreviewTrack
|
||||||
@ -99,10 +99,10 @@ namespace osu.Game.Audio
|
|||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
public IPreviewTrackOwner Owner { get; private set; }
|
public IPreviewTrackOwner Owner { get; private set; }
|
||||||
|
|
||||||
private readonly BeatmapSetInfo beatmapSetInfo;
|
private readonly IBeatmapSetInfo beatmapSetInfo;
|
||||||
private readonly ITrackStore trackManager;
|
private readonly ITrackStore trackManager;
|
||||||
|
|
||||||
public TrackManagerPreviewTrack(BeatmapSetInfo beatmapSetInfo, ITrackStore trackManager)
|
public TrackManagerPreviewTrack(IBeatmapSetInfo beatmapSetInfo, ITrackStore trackManager)
|
||||||
{
|
{
|
||||||
this.beatmapSetInfo = beatmapSetInfo;
|
this.beatmapSetInfo = beatmapSetInfo;
|
||||||
this.trackManager = trackManager;
|
this.trackManager = trackManager;
|
||||||
@ -114,7 +114,7 @@ namespace osu.Game.Audio
|
|||||||
Logger.Log($"A {nameof(PreviewTrack)} was created without a containing {nameof(IPreviewTrackOwner)}. An owner should be added for correct behaviour.");
|
Logger.Log($"A {nameof(PreviewTrack)} was created without a containing {nameof(IPreviewTrackOwner)}. An owner should be added for correct behaviour.");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Track GetTrack() => trackManager.Get($"https://b.ppy.sh/preview/{beatmapSetInfo?.OnlineBeatmapSetID}.mp3");
|
protected override Track GetTrack() => trackManager.Get($"https://b.ppy.sh/preview/{beatmapSetInfo.OnlineID}.mp3");
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PreviewTrackStore : AudioCollectionManager<AdjustableAudioComponent>, ITrackStore
|
private class PreviewTrackStore : AudioCollectionManager<AdjustableAudioComponent>, ITrackStore
|
||||||
|
Loading…
x
Reference in New Issue
Block a user