mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 14:12:56 +08:00
Add ability to not add all the items if enum
This commit is contained in:
parent
2bbac7cdfc
commit
144d41f143
@ -31,6 +31,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected virtual float StripWidth() => TabContainer.Children.Sum(c => c.IsPresent ? c.DrawWidth + TabContainer.Spacing.X : 0) - TabContainer.Spacing.X;
|
||||
protected virtual float StripHeight() => 1;
|
||||
|
||||
protected virtual bool AddAllItemsIfEnum => true;
|
||||
|
||||
private static bool isEnumType => typeof(T).IsEnum;
|
||||
|
||||
public OsuTabControl()
|
||||
@ -45,7 +47,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Colour = Color4.White.Opacity(0),
|
||||
});
|
||||
|
||||
if (isEnumType)
|
||||
if (isEnumType && AddAllItemsIfEnum)
|
||||
foreach (var val in (T[])Enum.GetValues(typeof(T)))
|
||||
AddItem(val);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user