1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 17:53:21 +08:00

Merge remote-tracking branch 'origin/master' into backgrounded-beatmap-status-lookups

# Conflicts:
#	osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
This commit is contained in:
smoogipoo 2019-06-12 17:24:16 +09:00
commit 243cd517ad
4 changed files with 20 additions and 8 deletions

View File

@ -138,7 +138,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{
createSongSelect();
changeRuleset(2);
importForRuleset(0);
addRulesetImportStep(0);
AddUntilStep("no selection", () => songSelect.Carousel.SelectedBeatmap == null);
}
@ -147,8 +147,8 @@ namespace osu.Game.Tests.Visual.SongSelect
{
createSongSelect();
changeRuleset(2);
importForRuleset(2);
importForRuleset(1);
addRulesetImportStep(2);
addRulesetImportStep(1);
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmap.RulesetID == 2);
changeRuleset(1);

View File

@ -10,11 +10,14 @@ namespace osu.Game.Overlays.Settings
{
private OsuCheckbox checkbox;
private string labelText;
protected override Drawable CreateControl() => checkbox = new OsuCheckbox();
public override string LabelText
{
set => checkbox.LabelText = value;
get => labelText;
set => checkbox.LabelText = labelText = value;
}
}
}

View File

@ -152,9 +152,12 @@ namespace osu.Game.Screens.Select
{
Schedule(() =>
{
int? previouslySelectedID = null;
CarouselBeatmapSet existingSet = beatmapSets.FirstOrDefault(b => b.BeatmapSet.ID == beatmapSet.ID);
bool hadSelection = existingSet?.State?.Value == CarouselItemState.Selected;
// If the selected beatmap is about to be removed, store its ID so it can be re-selected if required
if (existingSet?.State?.Value == CarouselItemState.Selected)
previouslySelectedID = selectedBeatmap?.Beatmap.ID;
var newSet = createCarouselSet(beatmapSet);
@ -172,8 +175,8 @@ namespace osu.Game.Screens.Select
applyActiveCriteria(false, false);
//check if we can/need to maintain our current selection.
if (hadSelection)
select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == selectedBeatmap?.Beatmap.ID) ?? newSet);
if (previouslySelectedID != null)
select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == previouslySelectedID) ?? newSet);
itemsCache.Invalidate();
Schedule(() => BeatmapSetsChanged?.Invoke());

View File

@ -595,11 +595,17 @@ namespace osu.Game.Screens.Select
{
bindBindables();
// If a selection was already obtained, do not attempt to update the selected beatmap.
if (Carousel.SelectedBeatmapSet != null)
return;
// Attempt to select the current beatmap on the carousel, if it is valid to be selected.
if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false && Beatmap.Value.BeatmapSetInfo?.Protected == false
&& Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false))
return;
if (Carousel.SelectedBeatmapSet == null && !Carousel.SelectNextRandom())
// If the current active beatmap could not be selected, select a new random beatmap.
if (!Carousel.SelectNextRandom())
{
// in the case random selection failed, we want to trigger selectionChanged
// to show the dummy beatmap (we have nothing else to display).