Fix LoadPrototype admin button (#18802)

This commit is contained in:
metalgearsloth
2023-08-08 03:02:38 +10:00
committed by GitHub
parent 329d75880b
commit 51d7f180e0

View File

@@ -27,6 +27,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
_decalPlacerController = UserInterfaceManager.GetUIController<DecalPlacerUIController>(); _decalPlacerController = UserInterfaceManager.GetUIController<DecalPlacerUIController>();
var adminManager = IoCManager.Resolve<IClientAdminManager>(); var adminManager = IoCManager.Resolve<IClientAdminManager>();
adminManager.AdminStatusUpdated += OnStatusUpdate;
// For the SpawnEntitiesButton and SpawnTilesButton we need to do the press manually // For the SpawnEntitiesButton and SpawnTilesButton we need to do the press manually
// TODO: This will probably need some command check at some point // TODO: This will probably need some command check at some point
@@ -34,8 +35,15 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
SpawnTilesButton.OnPressed += SpawnTilesButtonOnOnPressed; SpawnTilesButton.OnPressed += SpawnTilesButtonOnOnPressed;
SpawnDecalsButton.OnPressed += SpawnDecalsButtonOnPressed; SpawnDecalsButton.OnPressed += SpawnDecalsButtonOnPressed;
LoadGamePrototypeButton.OnPressed += LoadGamePrototypeButtonOnPressed; LoadGamePrototypeButton.OnPressed += LoadGamePrototypeButtonOnPressed;
LoadGamePrototypeButton.Disabled = !adminManager.HasFlag(AdminFlags.Query); LoadGamePrototypeButton.Disabled = !adminManager.CanCommand("loadprototype");
LoadBlueprintsButton.Disabled = !adminManager.HasFlag(AdminFlags.Mapping); LoadBlueprintsButton.Disabled = !adminManager.CanCommand("loadgrid");
}
private void OnStatusUpdate()
{
var adminManager = IoCManager.Resolve<IClientAdminManager>();
LoadGamePrototypeButton.Disabled = !adminManager.CanCommand("loadprototype");
LoadBlueprintsButton.Disabled = !adminManager.CanCommand("loadgrid");
} }
private void LoadGamePrototypeButtonOnPressed(BaseButton.ButtonEventArgs obj) private void LoadGamePrototypeButtonOnPressed(BaseButton.ButtonEventArgs obj)