1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-15 22:27:46 +08:00

Only construct the adjustment portion of bars when required

This commit is contained in:
Dean Herbert 2022-03-04 15:01:54 +09:00
parent 2785218b79
commit 8c7b1e0aa8

View File

@ -211,7 +211,7 @@ namespace osu.Game.Screens.Ranking.Statistics
private readonly float maxValue;
private readonly Circle boxOriginal;
private readonly Circle boxAdjustment;
private Circle boxAdjustment;
private const float minimum_height = 0.05f;
@ -233,16 +233,6 @@ namespace osu.Game.Screens.Ranking.Statistics
Colour = isCentre ? Color4.White : Color4Extensions.FromHex("#66FFCC"),
Height = minimum_height,
},
boxAdjustment = new Circle
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Colour = Color4.Yellow,
Blending = BlendingParameters.Additive,
Alpha = 0.6f,
Height = 0,
},
};
}
@ -260,6 +250,20 @@ namespace osu.Game.Screens.Ranking.Statistics
public void UpdateOffset(float adjustment)
{
if (boxAdjustment == null)
{
AddInternal(boxAdjustment = new Circle
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Colour = Color4.Yellow,
Blending = BlendingParameters.Additive,
Alpha = 0.6f,
Height = 0,
});
}
boxAdjustment.ResizeHeightTo(Math.Clamp(adjustment / maxValue, 0.05f, 1), duration, Easing.OutQuint);
}
}