1
0

SeparatedChatGameScreen.xaml.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System.Numerics;
  2. using Content.Client.UserInterface.Systems.Chat.Widgets;
  3. using Robust.Client.AutoGenerated;
  4. using Robust.Client.UserInterface.Controls;
  5. using Robust.Client.UserInterface.XAML;
  6. namespace Content.Client.UserInterface.Screens;
  7. [GenerateTypedNameReferences]
  8. public sealed partial class SeparatedChatGameScreen : InGameScreen
  9. {
  10. public SeparatedChatGameScreen()
  11. {
  12. RobustXamlLoader.Load(this);
  13. AutoscaleMaxResolution = new Vector2i(1080, 770);
  14. SetAnchorPreset(ScreenContainer, LayoutPreset.Wide);
  15. SetAnchorPreset(ViewportContainer, LayoutPreset.Wide);
  16. SetAnchorPreset(MainViewport, LayoutPreset.Wide);
  17. SetAnchorAndMarginPreset(Inventory, LayoutPreset.BottomLeft, margin: 5);
  18. SetAnchorAndMarginPreset(TopLeftContainer, LayoutPreset.TopLeft, margin: 10);
  19. SetAnchorAndMarginPreset(Ghost, LayoutPreset.BottomWide, margin: 80);
  20. SetAnchorAndMarginPreset(Hotbar, LayoutPreset.BottomWide, margin: 5);
  21. SetAnchorAndMarginPreset(Alerts, LayoutPreset.CenterRight, margin: 10);
  22. ScreenContainer.OnSplitResizeFinished += () =>
  23. OnChatResized?.Invoke(new Vector2(ScreenContainer.SplitFraction, 0));
  24. ViewportContainer.OnResized += ResizeActionContainer;
  25. }
  26. private void ResizeActionContainer()
  27. {
  28. float indent = 20;
  29. Actions.ActionsContainer.MaxGridWidth = ViewportContainer.Size.X - indent;
  30. }
  31. public override ChatBox ChatBox => GetWidget<ChatBox>()!;
  32. public override void SetChatSize(Vector2 size)
  33. {
  34. ScreenContainer.ResizeMode = SplitContainer.SplitResizeMode.RespectChildrenMinSize;
  35. }
  36. }