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

@@ -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<IGameHud>();
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<EntitySpawningUIController>().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<TileSpawningUIController>().ToggleWindow();
}
public void ToggleDecalsWindow()