Make the admin set OOC and LOOC buttons a toggle (#7152)

This commit is contained in:
Javier Guardia Fernández
2022-03-16 22:58:35 +01:00
committed by GitHub
parent 995c02169e
commit 8ee1503861
3 changed files with 39 additions and 5 deletions

View File

@@ -1,10 +1,44 @@
using Robust.Client.AutoGenerated;
using Content.Shared.CCVar;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration;
namespace Content.Client.Administration.UI.Tabs
{
[GenerateTypedNameReferences]
public sealed partial class ServerTab : Control
{
[Dependency] private readonly IConfigurationManager _config = default!;
public ServerTab()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_config.OnValueChanged(CCVars.OocEnabled, OocEnabledChanged, true);
_config.OnValueChanged(CCVars.LoocEnabled, LoocEnabledChanged, true);
}
private void OocEnabledChanged(bool value)
{
SetOocButton.Pressed = value;
}
private void LoocEnabledChanged(bool value)
{
SetLoocButton.Pressed = value;
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
_config.UnsubValueChanged(CCVars.OocEnabled, OocEnabledChanged);
_config.UnsubValueChanged(CCVars.LoocEnabled, LoocEnabledChanged);
}
}
}
}