Add UI window for loadbp (#9441)

* Add UI window for loadbp

* Perms disabled

* Also teleport button

* wraparound fix

* Review
This commit is contained in:
metalgearsloth
2022-07-06 14:17:19 +10:00
committed by GitHub
parent 0079014691
commit 7e0b49c7bd
6 changed files with 183 additions and 7 deletions

View File

@@ -1,13 +1,11 @@
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.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
namespace Content.Client.Administration.UI.Tabs.AdminbusTab
{
@@ -18,16 +16,20 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
var adminManager = IoCManager.Resolve<IClientAdminManager>();
// 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;
SpawnEntitiesButton.OnPressed += SpawnEntitiesButtonOnPressed;
SpawnTilesButton.OnPressed += SpawnTilesButtonOnOnPressed;
SpawnDecalsButton.OnPressed += SpawnDecalsButtonOnPressed;
LoadGamePrototypeButton.OnPressed += LoadGamePrototypeButtonOnOnPressed;
LoadGamePrototypeButton.Visible = IoCManager.Resolve<IClientAdminManager>().HasFlag(AdminFlags.Query);
LoadGamePrototypeButton.OnPressed += LoadGamePrototypeButtonOnPressed;
LoadGamePrototypeButton.Disabled = !adminManager.HasFlag(AdminFlags.Query);
LoadBlueprintsButton.Disabled = !adminManager.HasFlag(AdminFlags.Mapping);
}
private async void LoadGamePrototypeButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
private async void LoadGamePrototypeButtonOnPressed(BaseButton.ButtonEventArgs obj)
{
var dialogManager = IoCManager.Resolve<IFileDialogManager>();
var loadManager = IoCManager.Resolve<IGamePrototypeLoadManager>();
@@ -42,7 +44,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
loadManager.SendGamePrototype(proto);
}
private void SpawnEntitiesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
private void SpawnEntitiesButtonOnPressed(BaseButton.ButtonEventArgs obj)
{
EntitySystem.Get<SandboxSystem>().ToggleEntitySpawnWindow();
}