* Use new Subs.CVar helper Removes manual config OnValueChanged calls, removes need to remember to manually unsubscribe. This both reduces boilerplate and fixes many issues where subscriptions weren't removed on entity system shutdown. * Fix a bunch of warnings * More warning fixes * Use new DateTime serializer to get rid of ISerializationHooks in changelog code. * Get rid of some more ISerializationHooks for enums * And a little more * Apply suggestions from code review Co-authored-by: 0x6273 <0x40@keemail.me> --------- Co-authored-by: 0x6273 <0x40@keemail.me>
44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using System.Numerics;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
|
|
namespace Content.Client.UserInterface.Controls
|
|
{
|
|
[GenerateTypedNameReferences]
|
|
[Virtual]
|
|
public partial class SplitBar : BoxContainer
|
|
{
|
|
public Vector2 MinBarSize = new(24, 0);
|
|
|
|
public SplitBar()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
DisposeAllChildren();
|
|
}
|
|
|
|
public void AddEntry(float amount, Color color, string? tooltip = null)
|
|
{
|
|
AddChild(new PanelContainer
|
|
{
|
|
ToolTip = tooltip,
|
|
HorizontalExpand = true,
|
|
SizeFlagsStretchRatio = amount,
|
|
MouseFilter = MouseFilterMode.Stop,
|
|
PanelOverride = new StyleBoxFlat
|
|
{
|
|
BackgroundColor = color,
|
|
PaddingLeft = 2f,
|
|
PaddingRight = 2f,
|
|
},
|
|
MinSize = MinBarSize
|
|
});
|
|
}
|
|
}
|
|
}
|