2021-03-30 07:07:04 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2021-03-30 07:07:04 +00:00
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Filter;
|
|
|
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
|
|
|
using osu.Game.Screens.Select;
|
|
|
|
using osu.Game.Screens.Select.Filter;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania
|
|
|
|
{
|
|
|
|
public class ManiaFilterCriteria : IRulesetFilterCriteria
|
|
|
|
{
|
|
|
|
private FilterCriteria.OptionalRange<float> keys;
|
|
|
|
|
2021-10-02 15:55:29 +00:00
|
|
|
public bool Matches(BeatmapInfo beatmapInfo)
|
2021-03-30 07:07:04 +00:00
|
|
|
{
|
2022-01-27 06:19:48 +00:00
|
|
|
return !keys.HasFilter || (beatmapInfo.Ruleset.OnlineID == new ManiaRuleset().LegacyID && keys.IsInRange(ManiaBeatmapConverter.GetColumnCountForNonConvert(beatmapInfo)));
|
2021-03-30 07:07:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public bool TryParseCustomKeywordCriteria(string key, Operator op, string value)
|
|
|
|
{
|
|
|
|
switch (key)
|
|
|
|
{
|
|
|
|
case "key":
|
|
|
|
case "keys":
|
|
|
|
return FilterQueryParser.TryUpdateCriteriaRange(ref keys, op, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|