HandButton.cs 779 B

12345678910111213141516171819202122232425262728
  1. using Content.Client.UserInterface.Controls;
  2. using Content.Shared.Hands.Components;
  3. namespace Content.Client.UserInterface.Systems.Hands.Controls;
  4. public sealed class HandButton : SlotControl
  5. {
  6. public HandLocation HandLocation { get; }
  7. public HandButton(string handName, HandLocation handLocation)
  8. {
  9. HandLocation = handLocation;
  10. Name = "hand_" + handName;
  11. SlotName = handName;
  12. SetBackground(handLocation);
  13. }
  14. private void SetBackground(HandLocation handLoc)
  15. {
  16. ButtonTexturePath = handLoc switch
  17. {
  18. HandLocation.Left => "Slots/hand_l",
  19. HandLocation.Middle => "Slots/hand_m",
  20. HandLocation.Right => "Slots/hand_r",
  21. _ => ButtonTexturePath
  22. };
  23. }
  24. }