1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 17:02:55 +08:00

Merge pull request #249 from ColdVolcano/preview-time

Add Preview Time on selection of beatmap
This commit is contained in:
Dean Herbert 2016-12-16 08:42:14 +09:00 committed by GitHub
commit d39da80b1b

View File

@ -279,20 +279,23 @@ namespace osu.Game.Screens.Select
/// </summary>
private void selectionChanged(BeatmapGroup group, BeatmapInfo beatmap)
{
bool beatmapSetChange = false;
if (!beatmap.Equals(Beatmap?.BeatmapInfo))
{
if (beatmap.BeatmapSetID == Beatmap?.BeatmapInfo.BeatmapSetID)
sampleChangeDifficulty.Play();
else
{
sampleChangeBeatmap.Play();
beatmapSetChange = true;
}
Beatmap = database.GetWorkingBeatmap(beatmap, Beatmap);
}
ensurePlayingSelected();
ensurePlayingSelected(beatmapSetChange);
}
private async Task ensurePlayingSelected()
private async Task ensurePlayingSelected(bool preview = false)
{
AudioTrack track = null;
@ -303,6 +306,8 @@ namespace osu.Game.Screens.Select
if (track != null)
{
trackManager.SetExclusive(track);
if (preview)
track.Seek(Beatmap.Beatmap.Metadata.PreviewTime);
track.Start();
}
});