mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 11:42:56 +08:00
Add multiple units support in search length criteria
This commit is contained in:
parent
8f2287b968
commit
a5a8fac66f
@ -312,11 +312,18 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private static bool tryUpdateLengthRange(FilterCriteria criteria, Operator op, string val)
|
private static bool tryUpdateLengthRange(FilterCriteria criteria, Operator op, string val)
|
||||||
{
|
{
|
||||||
if (!tryParseDoubleWithPoint(val.TrimEnd('m', 's', 'h'), out double length))
|
string[] parts = Regex.Split(val, @"(?<=[msh])").Where(x => x.Length > 0).ToArray();
|
||||||
return false;
|
double totalLength = 0;
|
||||||
|
int minScale = 1000;
|
||||||
int scale = getLengthScale(val);
|
foreach (string part in parts)
|
||||||
return tryUpdateCriteriaRange(ref criteria.Length, op, length * scale, scale / 2.0);
|
{
|
||||||
|
if (!tryParseDoubleWithPoint(part.TrimEnd('m', 's', 'h'), out double length))
|
||||||
|
return false;
|
||||||
|
int scale = getLengthScale(part);
|
||||||
|
totalLength += length * scale;
|
||||||
|
minScale = Math.Min(minScale, scale);
|
||||||
|
}
|
||||||
|
return tryUpdateCriteriaRange(ref criteria.Length, op, totalLength, minScale / 2.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user