mirror of
https://github.com/osukey/osukey.git
synced 2025-05-24 23:17:25 +09:00
Make FlowContainer insertion cleaner
This commit is contained in:
parent
9e5ba5c796
commit
0c95dff3d6
@ -88,25 +88,17 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationIconButton left, right;
|
fill.Insert(-1, new NavigationIconButton(Build.Versions?.Previous)
|
||||||
|
|
||||||
fill.AddRange(new[]
|
|
||||||
{
|
|
||||||
left = new NavigationIconButton(Build.Versions?.Previous)
|
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.Solid.ChevronLeft,
|
Icon = FontAwesome.Solid.ChevronLeft,
|
||||||
SelectBuild = b => SelectBuild(b)
|
SelectBuild = b => SelectBuild(b)
|
||||||
},
|
});
|
||||||
right = new NavigationIconButton(Build.Versions?.Next)
|
fill.Insert(1, new NavigationIconButton(Build.Versions?.Next)
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.Solid.ChevronRight,
|
Icon = FontAwesome.Solid.ChevronRight,
|
||||||
SelectBuild = b => SelectBuild(b)
|
SelectBuild = b => SelectBuild(b)
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
fill.SetLayoutPosition(left, -1);
|
|
||||||
fill.SetLayoutPosition(right, 1);
|
|
||||||
|
|
||||||
return fill;
|
return fill;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,10 +85,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
|
|
||||||
private void addBeatmapSet(BeatmapSetInfo obj) => Schedule(() =>
|
private void addBeatmapSet(BeatmapSetInfo obj) => Schedule(() =>
|
||||||
{
|
{
|
||||||
var newItem = new PlaylistItem(obj) { OnSelect = set => Selected?.Invoke(set) };
|
items.Insert(items.Count - 1, new PlaylistItem(obj) { OnSelect = set => Selected?.Invoke(set) });
|
||||||
|
|
||||||
items.Add(newItem);
|
|
||||||
items.SetLayoutPosition(newItem, items.Count - 1);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
private void removeBeatmapSet(BeatmapSetInfo obj) => Schedule(() =>
|
private void removeBeatmapSet(BeatmapSetInfo obj) => Schedule(() =>
|
||||||
|
@ -78,10 +78,8 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
int displayIndex = index;
|
int displayIndex = index;
|
||||||
LoadComponentAsync(new DrawableBadge(badges[index]), asyncBadge =>
|
LoadComponentAsync(new DrawableBadge(badges[index]), asyncBadge =>
|
||||||
{
|
{
|
||||||
badgeFlowContainer.Add(asyncBadge);
|
|
||||||
|
|
||||||
// load in stable order regardless of async load order.
|
// 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)
|
Font = OsuFont.GetFont(size: 11, weight: FontWeight.Regular, italics: true)
|
||||||
};
|
};
|
||||||
|
|
||||||
RightFlowContainer.Add(text);
|
RightFlowContainer.Insert(1, text);
|
||||||
RightFlowContainer.SetLayoutPosition(text, 1);
|
|
||||||
|
|
||||||
LeftFlowContainer.Add(new BeatmapMetadataContainer(Score.Beatmap));
|
LeftFlowContainer.Add(new BeatmapMetadataContainer(Score.Beatmap));
|
||||||
LeftFlowContainer.Add(new DrawableDate(Score.Date));
|
LeftFlowContainer.Add(new DrawableDate(Score.Date));
|
||||||
|
@ -46,8 +46,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
if (text == null)
|
if (text == null)
|
||||||
{
|
{
|
||||||
// construct lazily for cases where the label is not needed (may be provided by the Control).
|
// construct lazily for cases where the label is not needed (may be provided by the Control).
|
||||||
Add(text = new OsuSpriteText());
|
FlowContent.Insert(-1, text = new OsuSpriteText());
|
||||||
FlowContent.SetLayoutPosition(text, -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
text.Text = value;
|
text.Text = value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user