mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 19:12:59 +08:00
Merge pull request #5205 from UselessToucan/flow_container_insert
Make FlowContainer insertions cleaner
This commit is contained in:
commit
3be5aff82d
@ -92,24 +92,16 @@ namespace osu.Game.Overlays.Changelog
|
||||
});
|
||||
}
|
||||
|
||||
NavigationIconButton left, right;
|
||||
|
||||
fill.AddRange(new[]
|
||||
fill.Insert(-1, new NavigationIconButton(Build.Versions?.Previous)
|
||||
{
|
||||
left = new NavigationIconButton(Build.Versions?.Previous)
|
||||
{
|
||||
Icon = FontAwesome.Solid.ChevronLeft,
|
||||
SelectBuild = b => SelectBuild(b)
|
||||
},
|
||||
right = new NavigationIconButton(Build.Versions?.Next)
|
||||
{
|
||||
Icon = FontAwesome.Solid.ChevronRight,
|
||||
SelectBuild = b => SelectBuild(b)
|
||||
},
|
||||
Icon = FontAwesome.Solid.ChevronLeft,
|
||||
SelectBuild = b => SelectBuild(b)
|
||||
});
|
||||
fill.Insert(1, new NavigationIconButton(Build.Versions?.Next)
|
||||
{
|
||||
Icon = FontAwesome.Solid.ChevronRight,
|
||||
SelectBuild = b => SelectBuild(b)
|
||||
});
|
||||
|
||||
fill.SetLayoutPosition(left, -1);
|
||||
fill.SetLayoutPosition(right, 1);
|
||||
|
||||
return fill;
|
||||
}
|
||||
|
@ -85,10 +85,7 @@ namespace osu.Game.Overlays.Music
|
||||
|
||||
private void addBeatmapSet(BeatmapSetInfo obj) => Schedule(() =>
|
||||
{
|
||||
var newItem = new PlaylistItem(obj) { OnSelect = set => Selected?.Invoke(set) };
|
||||
|
||||
items.Add(newItem);
|
||||
items.SetLayoutPosition(newItem, items.Count - 1);
|
||||
items.Insert(items.Count - 1, new PlaylistItem(obj) { OnSelect = set => Selected?.Invoke(set) });
|
||||
});
|
||||
|
||||
private void removeBeatmapSet(BeatmapSetInfo obj) => Schedule(() =>
|
||||
|
@ -26,8 +26,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
|
||||
public void Add(Notification notification, float position)
|
||||
{
|
||||
notifications.Add(notification);
|
||||
notifications.SetLayoutPosition(notification, position);
|
||||
notifications.Insert((int)position, notification);
|
||||
}
|
||||
|
||||
public IEnumerable<Type> AcceptTypes;
|
||||
|
@ -78,10 +78,8 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
int displayIndex = index;
|
||||
LoadComponentAsync(new DrawableBadge(badges[index]), asyncBadge =>
|
||||
{
|
||||
badgeFlowContainer.Add(asyncBadge);
|
||||
|
||||
// load in stable order regardless of async load order.
|
||||
badgeFlowContainer.SetLayoutPosition(asyncBadge, displayIndex);
|
||||
badgeFlowContainer.Insert(displayIndex, asyncBadge);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -49,8 +49,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
Font = OsuFont.GetFont(size: 11, weight: FontWeight.Regular, italics: true)
|
||||
};
|
||||
|
||||
RightFlowContainer.Add(text);
|
||||
RightFlowContainer.SetLayoutPosition(text, 1);
|
||||
RightFlowContainer.Insert(1, text);
|
||||
|
||||
LeftFlowContainer.Add(new BeatmapMetadataContainer(Score.Beatmap));
|
||||
LeftFlowContainer.Add(new DrawableDate(Score.Date));
|
||||
|
@ -46,8 +46,7 @@ namespace osu.Game.Overlays.Settings
|
||||
if (text == null)
|
||||
{
|
||||
// construct lazily for cases where the label is not needed (may be provided by the Control).
|
||||
Add(text = new OsuSpriteText());
|
||||
FlowContent.SetLayoutPosition(text, -1);
|
||||
FlowContent.Insert(-1, text = new OsuSpriteText());
|
||||
}
|
||||
|
||||
text.Text = value;
|
||||
|
@ -110,8 +110,7 @@ namespace osu.Game.Screens.Select.Options
|
||||
HotKey = hotkey
|
||||
};
|
||||
|
||||
buttonsContainer.Add(button);
|
||||
buttonsContainer.SetLayoutPosition(button, depth);
|
||||
buttonsContainer.Insert((int)depth, button);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user