diff --git a/Content.Client/Launcher/LauncherConnecting.cs b/Content.Client/Launcher/LauncherConnecting.cs index f4ed4b46ae..101a63a800 100644 --- a/Content.Client/Launcher/LauncherConnecting.cs +++ b/Content.Client/Launcher/LauncherConnecting.cs @@ -49,7 +49,7 @@ namespace Content.Client.Launcher public event Action? ConnectFailReasonChanged; public event Action? ConnectionStateChanged; - public override void Startup() + protected override void Startup() { _control = new LauncherConnectingGui(this); @@ -61,7 +61,7 @@ namespace Content.Client.Launcher CurrentPage = Page.Connecting; } - public override void Shutdown() + protected override void Shutdown() { _control?.Dispose(); diff --git a/Content.Client/Lobby/LobbyState.cs b/Content.Client/Lobby/LobbyState.cs index 77bce6d65c..88f940ff28 100644 --- a/Content.Client/Lobby/LobbyState.cs +++ b/Content.Client/Lobby/LobbyState.cs @@ -50,7 +50,7 @@ namespace Content.Client.Lobby private ClientGameTicker _gameTicker = default!; - public override void Startup() + protected override void Startup() { _gameTicker = EntitySystem.Get(); _characterSetup = new CharacterSetupGui(_entityManager, _resourceCache, _preferencesManager, @@ -114,7 +114,7 @@ namespace Content.Client.Lobby _gameTicker.LobbyLateJoinStatusUpdated += LobbyLateJoinStatusUpdated; } - public override void Shutdown() + protected override void Shutdown() { _gameTicker.InfoBlobUpdated -= UpdateLobbyUi; _gameTicker.LobbyStatusUpdated -= LobbyStatusUpdated; diff --git a/Content.Client/MainMenu/MainMenu.cs b/Content.Client/MainMenu/MainMenu.cs index 1769511982..0cb2c48791 100644 --- a/Content.Client/MainMenu/MainMenu.cs +++ b/Content.Client/MainMenu/MainMenu.cs @@ -35,7 +35,7 @@ namespace Content.Client.MainMenu private static readonly Regex IPv6Regex = new(@"\[(.*:.*:.*)](?::(\d+))?"); /// - public override void Startup() + protected override void Startup() { _mainMenuControl = new MainMenuControl(_resourceCache, _configurationManager); _userInterfaceManager.StateRoot.AddChild(_mainMenuControl); @@ -51,7 +51,7 @@ namespace Content.Client.MainMenu } /// - public override void Shutdown() + protected override void Shutdown() { _client.RunLevelChanged -= RunLevelChanged; _netManager.ConnectFailed -= _onConnectFailed; diff --git a/Content.Client/Sandbox/SandboxSystem.cs b/Content.Client/Sandbox/SandboxSystem.cs index fc57fab744..05870e3736 100644 --- a/Content.Client/Sandbox/SandboxSystem.cs +++ b/Content.Client/Sandbox/SandboxSystem.cs @@ -14,6 +14,8 @@ using Robust.Client.Input; using Robust.Client.Placement; using Robust.Client.Placement.Modes; using Robust.Client.ResourceManagement; +using Robust.Client.UserInterface; +using Robust.Client.UserInterface.Controllers.Implementations; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; using Robust.Shared.Input.Binding; @@ -47,7 +49,6 @@ namespace Content.Client.Sandbox { Resizable = false; _gameHud = IoCManager.Resolve(); - Title = Loc.GetString("sandbox-window-title"); var vBox = new BoxContainer @@ -125,6 +126,7 @@ namespace Content.Client.Sandbox [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; [Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IClientAdminManager _adminManager = default!; + [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; public bool SandboxAllowed { get; private set; } @@ -394,44 +396,16 @@ namespace Content.Client.Sandbox // TODO: These should check for command perms + be reset if the round is over. public void ToggleEntitySpawnWindow() { - if (_spawnWindow == null) - { - if (!CanSandbox()) return; - - _spawnWindow = new EntitySpawnWindow(_placementManager, PrototypeManager, _resourceCache); - _spawnWindow.OpenToLeft(); + if (!CanSandbox()) return; - } - - if (_spawnWindow.IsOpen) - { - _spawnWindow.Close(); - } - else - { - _spawnWindow.Open(); - } + _userInterfaceManager.GetUIController().ToggleWindow(); } public void ToggleTilesWindow() { - if (_tilesSpawnWindow == null) - { - if (!CanSandbox()) return; - - _tilesSpawnWindow = new TileSpawnWindow(_tileDefinitionManager, _placementManager, _resourceCache); - _tilesSpawnWindow.OpenToLeft(); + if (!CanSandbox()) return; - } - - if (_tilesSpawnWindow.IsOpen) - { - _tilesSpawnWindow.Close(); - } - else - { - _tilesSpawnWindow.Open(); - } + _userInterfaceManager.GetUIController().ToggleWindow(); } public void ToggleDecalsWindow() diff --git a/Content.Client/Viewport/GameScreen.cs b/Content.Client/Viewport/GameScreen.cs index 44cf9e1b13..a796c788aa 100644 --- a/Content.Client/Viewport/GameScreen.cs +++ b/Content.Client/Viewport/GameScreen.cs @@ -44,7 +44,7 @@ namespace Content.Client.Viewport public MainViewport Viewport { get; private set; } = default!; - public override void Startup() + protected override void Startup() { base.Startup(); @@ -88,7 +88,7 @@ namespace Content.Client.Viewport _configurationManager.OnValueChanged(CCVars.HudFpsCounterVisible, (show) => { _fpsCounter.Visible = show; }); } - public override void Shutdown() + protected override void Shutdown() { _overlayManager.RemoveOverlay(); DisposePresenters(); diff --git a/Content.Client/Viewport/GameScreenBase.cs b/Content.Client/Viewport/GameScreenBase.cs index 94491a659a..a6a39baafa 100644 --- a/Content.Client/Viewport/GameScreenBase.cs +++ b/Content.Client/Viewport/GameScreenBase.cs @@ -34,13 +34,13 @@ namespace Content.Client.Viewport private ClickableEntityComparer _comparer = default!; - public override void Startup() + protected override void Startup() { _inputManager.KeyBindStateChanged += OnKeyBindStateChanged; _comparer = new ClickableEntityComparer(_entityManager); } - public override void Shutdown() + protected override void Shutdown() { _inputManager.KeyBindStateChanged -= OnKeyBindStateChanged; }