1
0

UIExtensions.cs 852 B

1234567891011121314151617181920212223242526
  1. using Content.Client.UserInterface.ControlExtensions;
  2. using Robust.Client.GameObjects;
  3. using Robust.Client.UserInterface;
  4. using Robust.Client.UserInterface.Controls;
  5. using static Robust.Client.UserInterface.Controls.FloatSpinBox;
  6. namespace Content.Client._RMC14.UserInterface;
  7. public static class UIExtensions
  8. {
  9. public static FloatSpinBox CreateDialSpinBox(float value = default, Action<FloatSpinBoxEventArgs>? onValueChanged = null, bool buttons = true, int minWidth = 130)
  10. {
  11. var spinBox = new FloatSpinBox(1, 0) { MinWidth = minWidth };
  12. spinBox.Value = value;
  13. spinBox.OnValueChanged += onValueChanged;
  14. if (!buttons)
  15. {
  16. foreach (var button in spinBox.GetControlOfType<Button>())
  17. {
  18. button.Visible = false;
  19. }
  20. }
  21. return spinBox;
  22. }
  23. }