1
0

TabletopWindow.xaml.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using Robust.Client.AutoGenerated;
  2. using Robust.Client.Graphics;
  3. using Robust.Client.UserInterface.Controls;
  4. using Robust.Client.UserInterface.CustomControls;
  5. using Robust.Client.UserInterface.XAML;
  6. using Robust.Shared.Graphics;
  7. using Robust.Shared.Maths;
  8. namespace Content.Client.Tabletop.UI
  9. {
  10. [GenerateTypedNameReferences]
  11. public sealed partial class TabletopWindow : DefaultWindow
  12. {
  13. public TabletopWindow(IEye? eye, Vector2i size)
  14. {
  15. RobustXamlLoader.Load(this);
  16. ScalingVp.Eye = eye;
  17. ScalingVp.ViewportSize = size;
  18. FlipButton.OnButtonUp += Flip;
  19. OpenCentered();
  20. }
  21. private void Flip(BaseButton.ButtonEventArgs args)
  22. {
  23. // Flip the view 180 degrees
  24. if (ScalingVp.Eye is { } eye)
  25. {
  26. eye.Rotation = eye.Rotation.Opposite();
  27. // Flip alignmento of the button
  28. FlipButton.HorizontalAlignment = FlipButton.HorizontalAlignment == HAlignment.Right
  29. ? HAlignment.Left
  30. : HAlignment.Right;
  31. }
  32. }
  33. }
  34. }