Merge branch 'master' into disallow-beatmap-change

This commit is contained in:
Dean Herbert
2018-06-04 10:53:04 +09:00
committed by GitHub
65 changed files with 1289 additions and 498 deletions

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading;
using OpenTK;
using OpenTK.Input;
using osu.Framework.Allocation;
@ -63,8 +62,6 @@ namespace osu.Game.Screens.Select
private SampleChannel sampleChangeDifficulty;
private SampleChannel sampleChangeBeatmap;
private CancellationTokenSource initialAddSetsTask;
private GameBeatmap beatmap;
private DependencyContainer dependencies;
@ -212,9 +209,7 @@ namespace osu.Game.Screens.Select
sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand");
initialAddSetsTask = new CancellationTokenSource();
Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSets();
Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSetsEnumerable();
Beatmap.DisabledChanged += disabled => Carousel.AllowSelection = !disabled;
Beatmap.ValueChanged += workingBeatmapChanged;
@ -232,7 +227,8 @@ namespace osu.Game.Screens.Select
/// Call to make a selection and perform the default action for this SongSelect.
/// </summary>
/// <param name="beatmap">An optional beatmap to override the current carousel selection.</param>
public void FinaliseSelection(BeatmapInfo beatmap = null)
/// <param name="performStartAction">Whether to trigger <see cref="OnStart"/>.</param>
public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true)
{
// if we have a pending filter operation, we want to run it now.
// it could change selection (ie. if the ruleset has been changed).
@ -248,14 +244,15 @@ namespace osu.Game.Screens.Select
selectionChangedDebounce = null;
}
OnSelectionFinalised();
if (performStartAction)
OnStart();
}
/// <summary>
/// Called when a selection is made.
/// </summary>
/// <returns>If a resultant action occurred that takes the user away from SongSelect.</returns>
protected abstract bool OnSelectionFinalised();
protected abstract bool OnStart();
private ScheduledDelegate selectionChangedDebounce;
@ -400,7 +397,7 @@ namespace osu.Game.Screens.Select
protected override bool OnExiting(Screen next)
{
FinaliseSelection();
FinaliseSelection(performStartAction: false);
beatmapInfoWedge.State = Visibility.Hidden;
@ -422,8 +419,6 @@ namespace osu.Game.Screens.Select
beatmaps.BeatmapHidden -= onBeatmapHidden;
beatmaps.BeatmapRestored -= onBeatmapRestored;
}
initialAddSetsTask?.Cancel();
}
/// <summary>