mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 20:32:55 +08:00
Fix carousel beatmap set panels applying transforms to difficulties while they are loading
This commit is contained in:
parent
3b98782964
commit
83dbba3cbf
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -40,6 +41,8 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
|
|
||||||
private BeatmapSetInfo beatmapSet;
|
private BeatmapSetInfo beatmapSet;
|
||||||
|
|
||||||
|
private Task beatmapsLoadTask;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager manager { get; set; }
|
private BeatmapManager manager { get; set; }
|
||||||
|
|
||||||
@ -85,7 +88,9 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
base.UpdateItem();
|
base.UpdateItem();
|
||||||
|
|
||||||
Content.Clear();
|
Content.Clear();
|
||||||
|
|
||||||
beatmapContainer = null;
|
beatmapContainer = null;
|
||||||
|
beatmapsLoadTask = null;
|
||||||
|
|
||||||
if (Item == null)
|
if (Item == null)
|
||||||
return;
|
return;
|
||||||
@ -122,11 +127,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
|
|
||||||
MovementContainer.MoveToX(0, 500, Easing.OutExpo);
|
MovementContainer.MoveToX(0, 500, Easing.OutExpo);
|
||||||
|
|
||||||
if (beatmapContainer != null)
|
updateBeatmapYPositions();
|
||||||
{
|
|
||||||
foreach (var beatmap in beatmapContainer)
|
|
||||||
beatmap.MoveToY(0, 800, Easing.OutQuint);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Selected()
|
protected override void Selected()
|
||||||
@ -163,7 +164,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
ChildrenEnumerable = visibleBeatmaps.Select(c => c.CreateDrawableRepresentation())
|
ChildrenEnumerable = visibleBeatmaps.Select(c => c.CreateDrawableRepresentation())
|
||||||
};
|
};
|
||||||
|
|
||||||
LoadComponentAsync(beatmapContainer, loaded =>
|
beatmapsLoadTask = LoadComponentAsync(beatmapContainer, loaded =>
|
||||||
{
|
{
|
||||||
// make sure the pooled target hasn't changed.
|
// make sure the pooled target hasn't changed.
|
||||||
if (beatmapContainer != loaded)
|
if (beatmapContainer != loaded)
|
||||||
@ -173,16 +174,26 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
updateBeatmapYPositions();
|
updateBeatmapYPositions();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void updateBeatmapYPositions()
|
private void updateBeatmapYPositions()
|
||||||
|
{
|
||||||
|
if (beatmapsLoadTask == null || !beatmapsLoadTask.IsCompleted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
float yPos = DrawableCarouselBeatmap.CAROUSEL_BEATMAP_SPACING;
|
||||||
|
|
||||||
|
bool isSelected = Item.State.Value == CarouselItemState.Selected;
|
||||||
|
|
||||||
|
foreach (var panel in beatmapContainer.Children)
|
||||||
{
|
{
|
||||||
float yPos = DrawableCarouselBeatmap.CAROUSEL_BEATMAP_SPACING;
|
if (isSelected)
|
||||||
|
|
||||||
foreach (var panel in beatmapContainer.Children)
|
|
||||||
{
|
{
|
||||||
panel.MoveToY(yPos, 800, Easing.OutQuint);
|
panel.MoveToY(yPos, 800, Easing.OutQuint);
|
||||||
yPos += panel.Item.TotalHeight;
|
yPos += panel.Item.TotalHeight;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
panel.MoveToY(0, 800, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user