1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-31 15:03:21 +08:00

Move pool item preparation / cleanup duties to Carousel

This commit is contained in:
Dean Herbert 2025-01-24 19:02:31 +09:00
parent 2d46da1520
commit 0164a2e4dc
No known key found for this signature in database

View File

@ -540,11 +540,13 @@ namespace osu.Game.Screens.SelectV2
{
var c = (ICarouselPanel)panel;
// panel in the process of expiring, ignore it.
if (c.Item == null)
continue;
if (panel.Depth != c.DrawYPosition)
scroll.Panels.ChangeChildDepth(panel, (float)c.DrawYPosition);
Debug.Assert(c.Item != null);
if (c.DrawYPosition != c.Item.CarouselYPosition)
c.DrawYPosition = Interpolation.DampContinuously(c.DrawYPosition, c.Item.CarouselYPosition, 50, Time.Elapsed);
@ -631,7 +633,9 @@ namespace osu.Game.Screens.SelectV2
if (drawable is not ICarouselPanel carouselPanel)
throw new InvalidOperationException($"Carousel panel drawables must implement {typeof(ICarouselPanel)}");
carouselPanel.DrawYPosition = item.CarouselYPosition;
carouselPanel.Item = item;
scroll.Add(drawable);
}
@ -650,6 +654,12 @@ namespace osu.Game.Screens.SelectV2
{
panel.FinishTransforms();
panel.Expire();
var carouselPanel = (ICarouselPanel)panel;
carouselPanel.Item = null;
carouselPanel.Selected.Value = false;
carouselPanel.KeyboardSelected.Value = false;
}
#endregion