1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 03:47:26 +08:00

Merge pull request #2607 from jorolf/badge-ordering

Ensure profile badges are ordered correctly
This commit is contained in:
Dean Herbert 2018-06-08 21:28:36 +09:00 committed by GitHub
commit d5c42d74ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,13 +107,20 @@ namespace osu.Game.Overlays.Profile.Header
visibleBadge = 0;
badgeFlowContainer.Clear();
foreach (var badge in badges)
for (var index = 0; index < badges.Length; index++)
{
LoadComponentAsync(new DrawableBadge(badge)
int displayIndex = index;
LoadComponentAsync(new DrawableBadge(badges[index])
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
}, badgeFlowContainer.Add);
}, asyncBadge =>
{
badgeFlowContainer.Add(asyncBadge);
// load in stable order regardless of async load order.
badgeFlowContainer.SetLayoutPosition(asyncBadge, displayIndex);
});
}
}