1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Fix change in filter behaviour

This commit is contained in:
Dean Herbert 2023-12-05 18:20:27 +09:00
parent 45e499778f
commit 8704dc3505
No known key found for this signature in database
2 changed files with 16 additions and 15 deletions

View File

@ -34,13 +34,17 @@ namespace osu.Game.Beatmaps
foreach (var filter in filters)
{
if (filter.Matches(beatmapInfo.DifficultyName))
return true;
continue;
if (BeatmapMetadataInfoExtensions.Match(beatmapInfo.Metadata, filters))
return true;
if (BeatmapMetadataInfoExtensions.Match(beatmapInfo.Metadata, filter))
continue;
// failed to match a single filter at all - fail the whole match.
return false;
}
return false;
// got through all filters without failing any - pass the whole match.
return true;
}
private static string getVersionString(IBeatmapInfo beatmapInfo) => string.IsNullOrEmpty(beatmapInfo.DifficultyName) ? string.Empty : $"[{beatmapInfo.DifficultyName}]";

View File

@ -21,18 +21,15 @@ namespace osu.Game.Beatmaps
return termsList.ToArray();
}
public static bool Match(IBeatmapMetadataInfo metadataInfo, FilterCriteria.OptionalTextFilter[] filters)
public static bool Match(IBeatmapMetadataInfo metadataInfo, FilterCriteria.OptionalTextFilter filter)
{
foreach (var filter in filters)
{
if (filter.Matches(metadataInfo.Author.Username)) return true;
if (filter.Matches(metadataInfo.Artist)) return true;
if (filter.Matches(metadataInfo.ArtistUnicode)) return true;
if (filter.Matches(metadataInfo.Title)) return true;
if (filter.Matches(metadataInfo.TitleUnicode)) return true;
if (filter.Matches(metadataInfo.Source)) return true;
if (filter.Matches(metadataInfo.Tags)) return true;
}
if (filter.Matches(metadataInfo.Author.Username)) return true;
if (filter.Matches(metadataInfo.Artist)) return true;
if (filter.Matches(metadataInfo.ArtistUnicode)) return true;
if (filter.Matches(metadataInfo.Title)) return true;
if (filter.Matches(metadataInfo.TitleUnicode)) return true;
if (filter.Matches(metadataInfo.Source)) return true;
if (filter.Matches(metadataInfo.Tags)) return true;
return false;
}