Turn SandboxManager into a system (#6867)

This commit is contained in:
metalgearsloth
2022-02-24 11:00:30 +11:00
committed by GitHub
parent ec30db79f8
commit bee627ac6a
13 changed files with 193 additions and 267 deletions

View File

@@ -1,17 +1,12 @@
using System.IO;
using Content.Client.Administration.Managers;
using Content.Client.Decals.UI;
using Content.Client.Sandbox;
using Content.Shared.Administration;
using Robust.Client.AutoGenerated;
using Robust.Client.Placement;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
namespace Content.Client.Administration.UI.Tabs.AdminbusTab
@@ -19,10 +14,6 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
[GenerateTypedNameReferences]
public sealed partial class AdminbusTab : Control
{
private EntitySpawnWindow? _entitySpawnWindow;
private TileSpawnWindow? _tileSpawnWindow;
private DecalPlacerWindow? _decalPlacerWindow;
public AdminbusTab()
{
RobustXamlLoader.Load(this);
@@ -53,38 +44,17 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
private void SpawnEntitiesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
//FIXME: WE SHOULDN'T NEED TO CHECK FOR DISPOSED
if (_entitySpawnWindow == null || _entitySpawnWindow.Disposed)
{
_entitySpawnWindow = new EntitySpawnWindow(IoCManager.Resolve<IPlacementManager>(),
IoCManager.Resolve<IPrototypeManager>(),
IoCManager.Resolve<IResourceCache>());
}
EntitySystem.Get<AdminSystem>().OpenCommand(_entitySpawnWindow);
EntitySystem.Get<SandboxSystem>().ToggleEntitySpawnWindow();
}
private void SpawnTilesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
//FIXME: WE SHOULDN'T NEED TO CHECK FOR DISPOSED
if (_tileSpawnWindow == null || _tileSpawnWindow.Disposed)
{
_tileSpawnWindow = new TileSpawnWindow(IoCManager.Resolve<ITileDefinitionManager>(),
IoCManager.Resolve<IPlacementManager>(),
IoCManager.Resolve<IResourceCache>());
}
EntitySystem.Get<AdminSystem>().OpenCommand(_tileSpawnWindow);
EntitySystem.Get<SandboxSystem>().ToggleTilesWindow();
}
private void SpawnDecalsButtonOnPressed(BaseButton.ButtonEventArgs obj)
{
if (_decalPlacerWindow == null || _decalPlacerWindow.Disposed)
{
_decalPlacerWindow = new DecalPlacerWindow(IoCManager.Resolve<IPrototypeManager>());
}
EntitySystem.Get<AdminSystem>().OpenCommand(_decalPlacerWindow);
EntitySystem.Get<SandboxSystem>().ToggleDecalsWindow();
}
}
}