mirror of https://github.com/ppy/osu
Merge pull request #2607 from jorolf/badge-ordering
Ensure profile badges are ordered correctly
This commit is contained in:
commit
d5c42d74ba
|
@ -107,13 +107,20 @@ public void ShowBadges(Badge[] badges)
|
||||||
visibleBadge = 0;
|
visibleBadge = 0;
|
||||||
|
|
||||||
badgeFlowContainer.Clear();
|
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,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
}, badgeFlowContainer.Add);
|
}, asyncBadge =>
|
||||||
|
{
|
||||||
|
badgeFlowContainer.Add(asyncBadge);
|
||||||
|
|
||||||
|
// load in stable order regardless of async load order.
|
||||||
|
badgeFlowContainer.SetLayoutPosition(asyncBadge, displayIndex);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue