mirror of
https://github.com/osukey/osukey.git
synced 2025-05-20 04:57:38 +09: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();
|
||||||
|
double totalLength = 0;
|
||||||
|
int minScale = 1000;
|
||||||
|
foreach (string part in parts)
|
||||||
|
{
|
||||||
|
if (!tryParseDoubleWithPoint(part.TrimEnd('m', 's', 'h'), out double length))
|
||||||
return false;
|
return false;
|
||||||
|
int scale = getLengthScale(part);
|
||||||
int scale = getLengthScale(val);
|
totalLength += length * scale;
|
||||||
return tryUpdateCriteriaRange(ref criteria.Length, op, length * scale, scale / 2.0);
|
minScale = Math.Min(minScale, scale);
|
||||||
|
}
|
||||||
|
return tryUpdateCriteriaRange(ref criteria.Length, op, totalLength, minScale / 2.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user