2023-05-20 13:53:09 +12:00
|
|
|
|
using Content.Client.Administration.Managers;
|
2022-09-14 14:34:48 -07:00
|
|
|
|
using Content.Client.UserInterface.Systems.DecalPlacer;
|
2021-12-11 17:28:16 -06:00
|
|
|
|
using Content.Shared.Administration;
|
2021-02-17 09:39:31 -03:00
|
|
|
|
using Robust.Client.AutoGenerated;
|
2023-05-20 13:53:09 +12:00
|
|
|
|
using Robust.Client.Upload.Commands;
|
2021-02-21 12:38:56 +01:00
|
|
|
|
using Robust.Client.UserInterface;
|
2022-09-14 14:34:48 -07:00
|
|
|
|
using Robust.Client.UserInterface.Controllers.Implementations;
|
2021-02-17 09:39:31 -03:00
|
|
|
|
using Robust.Client.UserInterface.Controls;
|
2021-12-11 23:07:45 -06:00
|
|
|
|
using Robust.Client.UserInterface.XAML;
|
2021-02-17 09:39:31 -03:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
2021-02-17 09:39:31 -03:00
|
|
|
|
{
|
|
|
|
|
|
[GenerateTypedNameReferences]
|
2022-02-08 13:54:41 -07:00
|
|
|
|
public sealed partial class AdminbusTab : Control
|
2021-02-17 09:39:31 -03:00
|
|
|
|
{
|
2022-09-14 20:42:35 -07:00
|
|
|
|
private readonly EntitySpawningUIController _entitySpawningController;
|
|
|
|
|
|
private readonly TileSpawningUIController _tileSpawningController;
|
|
|
|
|
|
private readonly DecalPlacerUIController _decalPlacerController;
|
|
|
|
|
|
|
2021-12-11 23:07:45 -06:00
|
|
|
|
public AdminbusTab()
|
2021-02-17 09:39:31 -03:00
|
|
|
|
{
|
2021-12-11 23:07:45 -06:00
|
|
|
|
RobustXamlLoader.Load(this);
|
|
|
|
|
|
IoCManager.InjectDependencies(this);
|
2022-07-06 14:17:19 +10:00
|
|
|
|
|
2022-09-14 20:42:35 -07:00
|
|
|
|
_entitySpawningController = UserInterfaceManager.GetUIController<EntitySpawningUIController>();
|
|
|
|
|
|
_tileSpawningController = UserInterfaceManager.GetUIController<TileSpawningUIController>();
|
|
|
|
|
|
_decalPlacerController = UserInterfaceManager.GetUIController<DecalPlacerUIController>();
|
|
|
|
|
|
|
2022-07-06 14:17:19 +10:00
|
|
|
|
var adminManager = IoCManager.Resolve<IClientAdminManager>();
|
2023-08-08 03:02:38 +10:00
|
|
|
|
adminManager.AdminStatusUpdated += OnStatusUpdate;
|
2022-07-06 14:17:19 +10:00
|
|
|
|
|
2021-02-17 09:39:31 -03:00
|
|
|
|
// For the SpawnEntitiesButton and SpawnTilesButton we need to do the press manually
|
|
|
|
|
|
// TODO: This will probably need some command check at some point
|
2022-07-06 14:17:19 +10:00
|
|
|
|
SpawnEntitiesButton.OnPressed += SpawnEntitiesButtonOnPressed;
|
2021-02-17 09:39:31 -03:00
|
|
|
|
SpawnTilesButton.OnPressed += SpawnTilesButtonOnOnPressed;
|
2022-02-08 13:54:41 -07:00
|
|
|
|
SpawnDecalsButton.OnPressed += SpawnDecalsButtonOnPressed;
|
2022-07-06 14:17:19 +10:00
|
|
|
|
LoadGamePrototypeButton.OnPressed += LoadGamePrototypeButtonOnPressed;
|
2023-08-08 03:02:38 +10:00
|
|
|
|
LoadGamePrototypeButton.Disabled = !adminManager.CanCommand("loadprototype");
|
|
|
|
|
|
LoadBlueprintsButton.Disabled = !adminManager.CanCommand("loadgrid");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnStatusUpdate()
|
|
|
|
|
|
{
|
|
|
|
|
|
var adminManager = IoCManager.Resolve<IClientAdminManager>();
|
|
|
|
|
|
LoadGamePrototypeButton.Disabled = !adminManager.CanCommand("loadprototype");
|
|
|
|
|
|
LoadBlueprintsButton.Disabled = !adminManager.CanCommand("loadgrid");
|
2021-12-11 17:28:16 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-14 18:43:50 -07:00
|
|
|
|
private void LoadGamePrototypeButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
2021-12-11 17:28:16 -06:00
|
|
|
|
{
|
2022-09-14 18:43:50 -07:00
|
|
|
|
LoadPrototypeCommand.LoadPrototype();
|
2021-02-17 09:39:31 -03:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-06 14:17:19 +10:00
|
|
|
|
private void SpawnEntitiesButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
2021-02-17 09:39:31 -03:00
|
|
|
|
{
|
2022-09-14 20:42:35 -07:00
|
|
|
|
_entitySpawningController.ToggleWindow();
|
2021-02-17 09:39:31 -03:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-07-24 01:38:10 +02:00
|
|
|
|
private void SpawnTilesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
2021-02-17 09:39:31 -03:00
|
|
|
|
{
|
2022-09-14 20:42:35 -07:00
|
|
|
|
_tileSpawningController.ToggleWindow();
|
2021-02-17 09:39:31 -03:00
|
|
|
|
}
|
2022-02-08 13:54:41 -07:00
|
|
|
|
|
|
|
|
|
|
private void SpawnDecalsButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
|
|
|
|
|
{
|
2022-09-14 20:42:35 -07:00
|
|
|
|
_decalPlacerController.ToggleWindow();
|
2022-02-08 13:54:41 -07:00
|
|
|
|
}
|
2021-02-17 09:39:31 -03:00
|
|
|
|
}
|
|
|
|
|
|
}
|