HotbarGui.xaml.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using Content.Shared.Hands.Components;
  2. using Robust.Client.AutoGenerated;
  3. using Robust.Client.UserInterface.Controls;
  4. using Robust.Client.UserInterface.XAML;
  5. namespace Content.Client.UserInterface.Systems.Hotbar.Widgets;
  6. [GenerateTypedNameReferences]
  7. public sealed partial class HotbarGui : UIWidget
  8. {
  9. public HotbarGui()
  10. {
  11. RobustXamlLoader.Load(this);
  12. StatusPanelRight.SetSide(HandUILocation.Right);
  13. StatusPanelLeft.SetSide(HandUILocation.Left);
  14. var hotbarController = UserInterfaceManager.GetUIController<HotbarUIController>();
  15. hotbarController.Setup(HandContainer);
  16. LayoutContainer.SetGrowVertical(this, LayoutContainer.GrowDirection.Begin);
  17. }
  18. public void UpdatePanelEntityLeft(EntityUid? entity)
  19. {
  20. StatusPanelLeft.Update(entity);
  21. }
  22. public void UpdatePanelEntityRight(EntityUid? entity)
  23. {
  24. StatusPanelRight.Update(entity);
  25. }
  26. public void SetHighlightHand(HandUILocation? hand)
  27. {
  28. StatusPanelLeft.UpdateHighlight(hand is HandUILocation.Left);
  29. StatusPanelRight.UpdateHighlight(hand is HandUILocation.Right);
  30. }
  31. public void UpdateStatusVisibility(bool left, bool right)
  32. {
  33. StatusPanelLeft.Visible = left;
  34. StatusPanelRight.Visible = right;
  35. }
  36. }