Files
tbd-station-14/Content.Client/Administration/UI/Tabs/AdminbusTab/AdminbusTab.xaml.cs
Paul Ritter e74301a856 refactors adminmenu a timid amount (#5095)
Co-authored-by: Paul <ritter.paul1+git@googlemail.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-11-10 23:26:25 +11:00

46 lines
1.8 KiB
C#

using Content.Client.Administration.Managers;
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.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
namespace Content.Client.Administration.UI.Tabs.AdminbusTab
{
[GenerateTypedNameReferences]
public partial class AdminbusTab : Control
{
private EntitySpawnWindow? _entitySpawnWindow;
private TileSpawnWindow? _tileSpawnWindow;
protected override void EnteredTree()
{
// For the SpawnEntitiesButton and SpawnTilesButton we need to do the press manually
// TODO: This will probably need some command check at some point
SpawnEntitiesButton.OnPressed += SpawnEntitiesButtonOnOnPressed;
SpawnTilesButton.OnPressed += SpawnTilesButtonOnOnPressed;
}
private void SpawnEntitiesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
_entitySpawnWindow ??= new EntitySpawnWindow(IoCManager.Resolve<IPlacementManager>(),
IoCManager.Resolve<IPrototypeManager>(),
IoCManager.Resolve<IResourceCache>());
EntitySystem.Get<AdminSystem>().OpenCommand(_entitySpawnWindow);
}
private void SpawnTilesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
_tileSpawnWindow ??= new TileSpawnWindow(IoCManager.Resolve<ITileDefinitionManager>(),
IoCManager.Resolve<IPlacementManager>(),
IoCManager.Resolve<IResourceCache>());
EntitySystem.Get<AdminSystem>().OpenCommand(_tileSpawnWindow);
}
}
}