Merge pull request #18963 from peppy/more-placeholder-suggestions

Add difficulty filter reset to song select "no results" suggestions
This commit is contained in:
Dean Herbert
2022-07-01 17:55:23 +09:00
committed by GitHub
2 changed files with 41 additions and 12 deletions

View File

@ -97,6 +97,22 @@ namespace osu.Game.Tests.Visual.SongSelect
AddUntilStep("wait for placeholder visible", () => getPlaceholder()?.State.Value == Visibility.Visible);
}
[Test]
public void TestPlaceholderStarDifficulty()
{
addRulesetImportStep(0);
AddStep("change star filter", () => config.SetValue(OsuSetting.DisplayStarsMinimum, 10.0));
createSongSelect();
AddUntilStep("wait for placeholder visible", () => getPlaceholder()?.State.Value == Visibility.Visible);
AddStep("click link in placeholder", () => getPlaceholder().ChildrenOfType<DrawableLinkCompiler>().First().TriggerClick());
AddUntilStep("star filter reset", () => config.Get<double>(OsuSetting.DisplayStarsMinimum) == 0.0);
AddUntilStep("wait for placeholder visible", () => getPlaceholder()?.State.Value == Visibility.Hidden);
}
[Test]
public void TestPlaceholderConvertSetting()
{

View File

@ -50,7 +50,7 @@ namespace osu.Game.Screens.Select
Masking = true;
CornerRadius = 10;
Width = 300;
Width = 400;
AutoSizeAxes = Axes.Y;
Anchor = Anchor.Centre;
@ -118,22 +118,35 @@ namespace osu.Game.Screens.Select
textFlow.AddParagraph("No beatmaps match your filter criteria!");
textFlow.AddParagraph(string.Empty);
if (string.IsNullOrEmpty(filter?.SearchText))
if (filter?.UserStarDifficulty.HasFilter == true)
{
textFlow.AddParagraph("- Try ");
textFlow.AddLink("removing", () =>
{
config.SetValue(OsuSetting.DisplayStarsMinimum, 0.0);
config.SetValue(OsuSetting.DisplayStarsMaximum, 10.1);
});
string lowerStar = filter.UserStarDifficulty.Min == null ? "∞" : $"{filter.UserStarDifficulty.Min:N1}";
string upperStar = filter.UserStarDifficulty.Max == null ? "∞" : $"{filter.UserStarDifficulty.Max:N1}";
textFlow.AddText($" the {lowerStar}-{upperStar} star difficulty filter.");
}
// TODO: Add realm queries to hint at which ruleset results are available in (and allow clicking to switch).
// TODO: Make this message more certain by ensuring the osu! beatmaps exist before suggesting.
if (filter?.Ruleset.OnlineID > 0 && !filter.AllowConvertedBeatmaps)
if (filter?.Ruleset?.OnlineID > 0 && !filter.AllowConvertedBeatmaps)
{
textFlow.AddParagraph("Beatmaps may be available by ");
textFlow.AddLink("enabling automatic conversion", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true));
textFlow.AddText("!");
textFlow.AddParagraph("- Try");
textFlow.AddLink(" enabling ", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true));
textFlow.AddText("automatic conversion!");
}
}
else
if (!string.IsNullOrEmpty(filter?.SearchText))
{
textFlow.AddParagraph("You can try ");
textFlow.AddParagraph("- Try ");
textFlow.AddLink("searching online", LinkAction.SearchBeatmapSet, filter.SearchText);
textFlow.AddText(" for this query.");
textFlow.AddText($" for \"{filter.SearchText}\".");
}
}