Recycle slider paths when the parenting slider dies

This commit is contained in:
smoogipoo
2019-07-16 18:19:13 +09:00
parent 1ec8790ad2
commit a9286fee07
4 changed files with 36 additions and 7 deletions

View File

@ -13,7 +13,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
public const float DEFAULT_BORDER_SIZE = 1;
private readonly SliderPath path;
private SliderPath path;
protected Path Path => path;
public float PathRadius
@ -77,6 +78,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
InternalChild = path = new SliderPath();
}
/// <summary>
/// Initialises a new <see cref="SliderPath"/>, releasing all resources retained by the old one.
/// </summary>
public void RecyclePath()
{
InternalChild = path = new SliderPath
{
Position = path.Position,
PathRadius = path.PathRadius,
AccentColour = path.AccentColour,
BorderColour = path.BorderColour,
BorderSize = path.BorderSize,
Vertices = path.Vertices
};
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => path.ReceivePositionalInputAt(screenSpacePos);
/// <summary>