ReplayToggleScreenshotModeCommand.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using Content.Client.UserInterface.Systems.Chat;
  2. using Content.Shared.Chat;
  3. using Robust.Client.Replays.Commands;
  4. using Robust.Client.Replays.UI;
  5. using Robust.Client.UserInterface;
  6. using Robust.Shared.Console;
  7. namespace Content.Client.Replay;
  8. public sealed class ReplayToggleScreenshotModeCommand : BaseReplayCommand
  9. {
  10. [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
  11. [Dependency] private readonly ContentReplayPlaybackManager _replayManager = default!;
  12. public override string Command => "replay_toggle_screenshot_mode";
  13. public override void Execute(IConsoleShell shell, string argStr, string[] args)
  14. {
  15. var screen = _userInterfaceManager.ActiveScreen;
  16. if (screen == null)
  17. return;
  18. _replayManager.IsScreenshotMode = !_replayManager.IsScreenshotMode;
  19. var showReplayWidget = _replayManager.IsScreenshotMode;
  20. screen.ShowWidget<ReplayControlWidget>(showReplayWidget);
  21. foreach (var chatBox in _userInterfaceManager.GetUIController<ChatUIController>().Chats)
  22. {
  23. chatBox.ChatInput.Visible = !showReplayWidget;
  24. if (!showReplayWidget)
  25. chatBox.ChatInput.ChannelSelector.Select(ChatSelectChannel.Local);
  26. }
  27. }
  28. }