DockObject.xaml.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using Content.Shared.Shuttles.BUIStates;
  2. using Robust.Client.AutoGenerated;
  3. using Robust.Client.Graphics;
  4. using Robust.Client.UserInterface.Controls;
  5. using Robust.Client.UserInterface.XAML;
  6. namespace Content.Client.Shuttles.UI;
  7. [GenerateTypedNameReferences]
  8. public sealed partial class DockObject : PanelContainer
  9. {
  10. public BoxContainer ContentsContainer => Contents;
  11. public DockObject()
  12. {
  13. RobustXamlLoader.Load(this);
  14. IoCManager.InjectDependencies(this);
  15. PanelOverride = new StyleBoxFlat(new Color(30, 30, 34));
  16. }
  17. public void AddDock(DockingPortState state, ShuttleDockControl dockControl)
  18. {
  19. var viewButton = new Button()
  20. {
  21. Text = Loc.GetString("shuttle-console-view"),
  22. };
  23. viewButton.OnPressed += args =>
  24. {
  25. dockControl.SetViewedDock(state);
  26. };
  27. var container = new BoxContainer()
  28. {
  29. Orientation = BoxContainer.LayoutOrientation.Vertical,
  30. Children =
  31. {
  32. new Label()
  33. {
  34. Text = state.Name,
  35. HorizontalAlignment = HAlignment.Center,
  36. },
  37. viewButton
  38. }
  39. };
  40. DockContainer.AddChild(container);
  41. }
  42. public void SetName(string value)
  43. {
  44. DockedLabel.Text = value;
  45. }
  46. }