mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 17:32:54 +08:00
Merge pull request #8242 from peppy/always-apply-ruleset-filter
Apply ruleset filter in all cases (even when bypassing filter for selection purposes)
This commit is contained in:
commit
8b8d0b962d
@ -436,6 +436,9 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
changeRuleset(0);
|
changeRuleset(0);
|
||||||
|
|
||||||
|
// used for filter check below
|
||||||
|
AddStep("allow convert display", () => config.Set(OsuSetting.ShowConvertedBeatmaps, true));
|
||||||
|
|
||||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmap != null);
|
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmap != null);
|
||||||
|
|
||||||
AddStep("set filter text", () => songSelect.FilterControl.ChildrenOfType<SearchTextBox>().First().Text = "nonono");
|
AddStep("set filter text", () => songSelect.FilterControl.ChildrenOfType<SearchTextBox>().First().Text = "nonono");
|
||||||
@ -446,16 +449,28 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
BeatmapInfo target = null;
|
BeatmapInfo target = null;
|
||||||
|
|
||||||
|
int targetRuleset = differentRuleset ? 1 : 0;
|
||||||
|
|
||||||
AddStep("select beatmap externally", () =>
|
AddStep("select beatmap externally", () =>
|
||||||
{
|
{
|
||||||
target = manager.GetAllUsableBeatmapSets().Where(b => b.Beatmaps.Any(bi => bi.RulesetID == (differentRuleset ? 1 : 0)))
|
target = manager.GetAllUsableBeatmapSets()
|
||||||
.ElementAt(5).Beatmaps.First();
|
.Where(b => b.Beatmaps.Any(bi => bi.RulesetID == targetRuleset))
|
||||||
|
.ElementAt(5).Beatmaps.First(bi => bi.RulesetID == targetRuleset);
|
||||||
|
|
||||||
Beatmap.Value = manager.GetWorkingBeatmap(target);
|
Beatmap.Value = manager.GetWorkingBeatmap(target);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmap != null);
|
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmap != null);
|
||||||
|
|
||||||
|
AddAssert("selected only shows expected ruleset (plus converts)", () =>
|
||||||
|
{
|
||||||
|
var selectedPanel = songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().First(s => s.Item.State.Value == CarouselItemState.Selected);
|
||||||
|
|
||||||
|
// special case for converts checked here.
|
||||||
|
return selectedPanel.ChildrenOfType<DrawableCarouselBeatmapSet.FilterableDifficultyIcon>().All(i =>
|
||||||
|
i.IsFiltered || i.Item.Beatmap.Ruleset.ID == targetRuleset || i.Item.Beatmap.Ruleset.ID == 0);
|
||||||
|
});
|
||||||
|
|
||||||
AddUntilStep("carousel has correct", () => songSelect.Carousel.SelectedBeatmap?.OnlineBeatmapID == target.OnlineBeatmapID);
|
AddUntilStep("carousel has correct", () => songSelect.Carousel.SelectedBeatmap?.OnlineBeatmapID == target.OnlineBeatmapID);
|
||||||
AddUntilStep("game has correct", () => Beatmap.Value.BeatmapInfo.OnlineBeatmapID == target.OnlineBeatmapID);
|
AddUntilStep("game has correct", () => Beatmap.Value.BeatmapInfo.OnlineBeatmapID == target.OnlineBeatmapID);
|
||||||
|
|
||||||
|
@ -25,18 +25,18 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
{
|
{
|
||||||
base.Filter(criteria);
|
base.Filter(criteria);
|
||||||
|
|
||||||
if (Beatmap.BeatmapSet?.Equals(criteria.SelectedBeatmapSet) == true)
|
|
||||||
{
|
|
||||||
// bypass filtering for selected beatmap
|
|
||||||
Filtered.Value = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool match =
|
bool match =
|
||||||
criteria.Ruleset == null ||
|
criteria.Ruleset == null ||
|
||||||
Beatmap.RulesetID == criteria.Ruleset.ID ||
|
Beatmap.RulesetID == criteria.Ruleset.ID ||
|
||||||
(Beatmap.RulesetID == 0 && criteria.Ruleset.ID > 0 && criteria.AllowConvertedBeatmaps);
|
(Beatmap.RulesetID == 0 && criteria.Ruleset.ID > 0 && criteria.AllowConvertedBeatmaps);
|
||||||
|
|
||||||
|
if (Beatmap.BeatmapSet?.Equals(criteria.SelectedBeatmapSet) == true)
|
||||||
|
{
|
||||||
|
// only check ruleset equality or convertability for selected beatmap
|
||||||
|
Filtered.Value = !match;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
match &= !criteria.StarDifficulty.HasFilter || criteria.StarDifficulty.IsInRange(Beatmap.StarDifficulty);
|
match &= !criteria.StarDifficulty.HasFilter || criteria.StarDifficulty.IsInRange(Beatmap.StarDifficulty);
|
||||||
match &= !criteria.ApproachRate.HasFilter || criteria.ApproachRate.IsInRange(Beatmap.BaseDifficulty.ApproachRate);
|
match &= !criteria.ApproachRate.HasFilter || criteria.ApproachRate.IsInRange(Beatmap.BaseDifficulty.ApproachRate);
|
||||||
match &= !criteria.DrainRate.HasFilter || criteria.DrainRate.IsInRange(Beatmap.BaseDifficulty.DrainRate);
|
match &= !criteria.DrainRate.HasFilter || criteria.DrainRate.IsInRange(Beatmap.BaseDifficulty.DrainRate);
|
||||||
|
@ -205,7 +205,9 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
{
|
{
|
||||||
private readonly BindableBool filtered = new BindableBool();
|
private readonly BindableBool filtered = new BindableBool();
|
||||||
|
|
||||||
private readonly CarouselBeatmap item;
|
public bool IsFiltered => filtered.Value;
|
||||||
|
|
||||||
|
public readonly CarouselBeatmap Item;
|
||||||
|
|
||||||
public FilterableDifficultyIcon(CarouselBeatmap item)
|
public FilterableDifficultyIcon(CarouselBeatmap item)
|
||||||
: base(item.Beatmap)
|
: base(item.Beatmap)
|
||||||
@ -214,13 +216,13 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
filtered.ValueChanged += isFiltered => Schedule(() => this.FadeTo(isFiltered.NewValue ? 0.1f : 1, 100));
|
filtered.ValueChanged += isFiltered => Schedule(() => this.FadeTo(isFiltered.NewValue ? 0.1f : 1, 100));
|
||||||
filtered.TriggerChange();
|
filtered.TriggerChange();
|
||||||
|
|
||||||
this.item = item;
|
Item = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
if (!filtered.Value)
|
if (!filtered.Value)
|
||||||
item.State.Value = CarouselItemState.Selected;
|
Item.State.Value = CarouselItemState.Selected;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user