Make content work with UI engine changes (#10990)

This commit is contained in:
wrexbe
2022-09-04 16:17:05 -07:00
committed by GitHub
parent 292f3de02d
commit 88465961e0
6 changed files with 17 additions and 43 deletions

View File

@@ -49,7 +49,7 @@ namespace Content.Client.Launcher
public event Action<string?>? ConnectFailReasonChanged; public event Action<string?>? ConnectFailReasonChanged;
public event Action<ClientConnectionState>? ConnectionStateChanged; public event Action<ClientConnectionState>? ConnectionStateChanged;
public override void Startup() protected override void Startup()
{ {
_control = new LauncherConnectingGui(this); _control = new LauncherConnectingGui(this);
@@ -61,7 +61,7 @@ namespace Content.Client.Launcher
CurrentPage = Page.Connecting; CurrentPage = Page.Connecting;
} }
public override void Shutdown() protected override void Shutdown()
{ {
_control?.Dispose(); _control?.Dispose();

View File

@@ -50,7 +50,7 @@ namespace Content.Client.Lobby
private ClientGameTicker _gameTicker = default!; private ClientGameTicker _gameTicker = default!;
public override void Startup() protected override void Startup()
{ {
_gameTicker = EntitySystem.Get<ClientGameTicker>(); _gameTicker = EntitySystem.Get<ClientGameTicker>();
_characterSetup = new CharacterSetupGui(_entityManager, _resourceCache, _preferencesManager, _characterSetup = new CharacterSetupGui(_entityManager, _resourceCache, _preferencesManager,
@@ -114,7 +114,7 @@ namespace Content.Client.Lobby
_gameTicker.LobbyLateJoinStatusUpdated += LobbyLateJoinStatusUpdated; _gameTicker.LobbyLateJoinStatusUpdated += LobbyLateJoinStatusUpdated;
} }
public override void Shutdown() protected override void Shutdown()
{ {
_gameTicker.InfoBlobUpdated -= UpdateLobbyUi; _gameTicker.InfoBlobUpdated -= UpdateLobbyUi;
_gameTicker.LobbyStatusUpdated -= LobbyStatusUpdated; _gameTicker.LobbyStatusUpdated -= LobbyStatusUpdated;

View File

@@ -35,7 +35,7 @@ namespace Content.Client.MainMenu
private static readonly Regex IPv6Regex = new(@"\[(.*:.*:.*)](?::(\d+))?"); private static readonly Regex IPv6Regex = new(@"\[(.*:.*:.*)](?::(\d+))?");
/// <inheritdoc /> /// <inheritdoc />
public override void Startup() protected override void Startup()
{ {
_mainMenuControl = new MainMenuControl(_resourceCache, _configurationManager); _mainMenuControl = new MainMenuControl(_resourceCache, _configurationManager);
_userInterfaceManager.StateRoot.AddChild(_mainMenuControl); _userInterfaceManager.StateRoot.AddChild(_mainMenuControl);
@@ -51,7 +51,7 @@ namespace Content.Client.MainMenu
} }
/// <inheritdoc /> /// <inheritdoc />
public override void Shutdown() protected override void Shutdown()
{ {
_client.RunLevelChanged -= RunLevelChanged; _client.RunLevelChanged -= RunLevelChanged;
_netManager.ConnectFailed -= _onConnectFailed; _netManager.ConnectFailed -= _onConnectFailed;

View File

@@ -14,6 +14,8 @@ using Robust.Client.Input;
using Robust.Client.Placement; using Robust.Client.Placement;
using Robust.Client.Placement.Modes; using Robust.Client.Placement.Modes;
using Robust.Client.ResourceManagement; using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers.Implementations;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Input.Binding; using Robust.Shared.Input.Binding;
@@ -47,7 +49,6 @@ namespace Content.Client.Sandbox
{ {
Resizable = false; Resizable = false;
_gameHud = IoCManager.Resolve<IGameHud>(); _gameHud = IoCManager.Resolve<IGameHud>();
Title = Loc.GetString("sandbox-window-title"); Title = Loc.GetString("sandbox-window-title");
var vBox = new BoxContainer var vBox = new BoxContainer
@@ -125,6 +126,7 @@ namespace Content.Client.Sandbox
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IClientAdminManager _adminManager = default!; [Dependency] private readonly IClientAdminManager _adminManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
public bool SandboxAllowed { get; private set; } 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. // TODO: These should check for command perms + be reset if the round is over.
public void ToggleEntitySpawnWindow() public void ToggleEntitySpawnWindow()
{ {
if (_spawnWindow == null) if (!CanSandbox())
{
if (!CanSandbox()) return;
_spawnWindow = new EntitySpawnWindow(_placementManager, PrototypeManager, _resourceCache);
_spawnWindow.OpenToLeft();
return; return;
} _userInterfaceManager.GetUIController<EntitySpawningUIController>().ToggleWindow();
if (_spawnWindow.IsOpen)
{
_spawnWindow.Close();
}
else
{
_spawnWindow.Open();
}
} }
public void ToggleTilesWindow() public void ToggleTilesWindow()
{ {
if (_tilesSpawnWindow == null) if (!CanSandbox())
{
if (!CanSandbox()) return;
_tilesSpawnWindow = new TileSpawnWindow(_tileDefinitionManager, _placementManager, _resourceCache);
_tilesSpawnWindow.OpenToLeft();
return; return;
} _userInterfaceManager.GetUIController<TileSpawningUIController>().ToggleWindow();
if (_tilesSpawnWindow.IsOpen)
{
_tilesSpawnWindow.Close();
}
else
{
_tilesSpawnWindow.Open();
}
} }
public void ToggleDecalsWindow() public void ToggleDecalsWindow()

View File

@@ -44,7 +44,7 @@ namespace Content.Client.Viewport
public MainViewport Viewport { get; private set; } = default!; public MainViewport Viewport { get; private set; } = default!;
public override void Startup() protected override void Startup()
{ {
base.Startup(); base.Startup();
@@ -88,7 +88,7 @@ namespace Content.Client.Viewport
_configurationManager.OnValueChanged(CCVars.HudFpsCounterVisible, (show) => { _fpsCounter.Visible = show; }); _configurationManager.OnValueChanged(CCVars.HudFpsCounterVisible, (show) => { _fpsCounter.Visible = show; });
} }
public override void Shutdown() protected override void Shutdown()
{ {
_overlayManager.RemoveOverlay<ShowHandItemOverlay>(); _overlayManager.RemoveOverlay<ShowHandItemOverlay>();
DisposePresenters(); DisposePresenters();

View File

@@ -34,13 +34,13 @@ namespace Content.Client.Viewport
private ClickableEntityComparer _comparer = default!; private ClickableEntityComparer _comparer = default!;
public override void Startup() protected override void Startup()
{ {
_inputManager.KeyBindStateChanged += OnKeyBindStateChanged; _inputManager.KeyBindStateChanged += OnKeyBindStateChanged;
_comparer = new ClickableEntityComparer(_entityManager); _comparer = new ClickableEntityComparer(_entityManager);
} }
public override void Shutdown() protected override void Shutdown()
{ {
_inputManager.KeyBindStateChanged -= OnKeyBindStateChanged; _inputManager.KeyBindStateChanged -= OnKeyBindStateChanged;
} }