1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:47:28 +08:00

Avoid iteration over NestedHitObjects in silder's Update unless necessary

This commit is contained in:
Dean Herbert 2024-01-05 03:26:58 +09:00
parent 35eff639cb
commit 5cc4a586ac
No known key found for this signature in database

View File

@ -36,6 +36,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private ShakeContainer shakeContainer;
private Vector2? childAnchorPosition;
protected override IEnumerable<Drawable> DimmablePieces => new Drawable[]
{
HeadCircle,
@ -254,10 +256,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
if (DrawSize != Vector2.Zero)
{
var childAnchorPosition = Vector2.Divide(OriginPosition, DrawSize);
foreach (var obj in NestedHitObjects)
obj.RelativeAnchorPosition = childAnchorPosition;
Ball.RelativeAnchorPosition = childAnchorPosition;
Vector2 pos = Vector2.Divide(OriginPosition, DrawSize);
if (pos != childAnchorPosition)
{
childAnchorPosition = pos;
foreach (var obj in NestedHitObjects)
obj.RelativeAnchorPosition = pos;
Ball.RelativeAnchorPosition = pos;
}
}
}