mirror of
https://github.com/ppy/osu
synced 2025-02-27 16:11:43 +00:00
PaginatedBeatmapContainer.BeganPlayingPreview
This commit is contained in:
parent
640be621ac
commit
6cdfaffcf7
@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||
|
||||
private DirectPanel currentlyPlaying;
|
||||
|
||||
public event Action<DirectGridPanel> BeatmapAdded;
|
||||
public event Action<PaginatedBeatmapContainer> BeganPlayingPreview;
|
||||
|
||||
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, string header, string missing = "None... yet.")
|
||||
: base(user, header, missing)
|
||||
@ -61,16 +61,22 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||
{
|
||||
if (!isPlaying) return;
|
||||
|
||||
BeganPlayingPreview?.Invoke(this);
|
||||
if (currentlyPlaying != null && currentlyPlaying != panel)
|
||||
currentlyPlaying.PreviewPlaying.Value = false;
|
||||
StopPlayingPreview();
|
||||
|
||||
currentlyPlaying = panel;
|
||||
};
|
||||
BeatmapAdded?.Invoke(panel);
|
||||
}
|
||||
};
|
||||
|
||||
Api.Queue(req);
|
||||
}
|
||||
|
||||
public void StopPlayingPreview()
|
||||
{
|
||||
if (currentlyPlaying != null)
|
||||
currentlyPlaying.PreviewPlaying.Value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,16 +26,15 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, "Graveyarded Beatmaps"),
|
||||
};
|
||||
|
||||
foreach (var beatmapContainer in Children.OfType<PaginatedBeatmapContainer>())
|
||||
foreach (var paginatedBeatmapContainer in Children.OfType<PaginatedBeatmapContainer>())
|
||||
{
|
||||
beatmapContainer.BeatmapAdded += panel => panel.PreviewPlaying.ValueChanged += isPlaying =>
|
||||
paginatedBeatmapContainer.BeganPlayingPreview += (BeatmapContainer) =>
|
||||
{
|
||||
if (!isPlaying) return;
|
||||
|
||||
if (currentlyPlaying != null && currentlyPlaying != panel)
|
||||
currentlyPlaying.PreviewPlaying.Value = false;
|
||||
|
||||
currentlyPlaying = panel;
|
||||
foreach (var bc in Children.OfType<PaginatedBeatmapContainer>())
|
||||
{
|
||||
if (bc != BeatmapContainer)
|
||||
bc.StopPlayingPreview();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user