Files
ss14-wega/Content.Client/Shuttles/UI/IFFConsoleWindow.xaml.cs
EchoOfNothing ee2f1da8c2 Merge IFF controls into one control. Make syndicate IFF turned off by default. (#42104)
* Merge IFF controls into one control.

* Implement logic to hide IFF of sydicate IFF console on map load. Add hideOnInit property to IFFConsoleComponent

* DataField

---------

Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
2025-12-27 14:18:45 +00:00

55 lines
1.6 KiB
C#

using Content.Client.Computer;
using Content.Client.UserInterface.Controls;
using Content.Shared.Shuttles.BUIStates;
using Content.Shared.Shuttles.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.Shuttles.UI;
[GenerateTypedNameReferences]
public sealed partial class IFFConsoleWindow : FancyWindow,
IComputerWindow<IFFConsoleBoundUserInterfaceState>
{
private readonly ButtonGroup _showIFFButtonGroup = new();
public event Action<bool>? ShowIFF;
public IFFConsoleWindow()
{
RobustXamlLoader.Load(this);
ShowIFFOffButton.Group = _showIFFButtonGroup;
ShowIFFOnButton.Group = _showIFFButtonGroup;
ShowIFFOnButton.OnPressed += args => ShowIFFPressed(true);
ShowIFFOffButton.OnPressed += args => ShowIFFPressed(false);
}
private void ShowIFFPressed(bool pressed)
{
ShowIFF?.Invoke(pressed);
}
public void UpdateState(IFFConsoleBoundUserInterfaceState state)
{
if ((state.AllowedFlags & IFFFlags.HideLabel) != 0x0 || (state.AllowedFlags & IFFFlags.Hide) != 0x0)
{
ShowIFFOffButton.Disabled = false;
ShowIFFOnButton.Disabled = false;
if ((state.Flags & IFFFlags.HideLabel) != 0x0 || (state.Flags & IFFFlags.Hide) != 0x0)
{
ShowIFFOffButton.Pressed = true;
}
else
{
ShowIFFOnButton.Pressed = true;
}
}
else
{
ShowIFFOffButton.Disabled = true;
ShowIFFOnButton.Disabled = true;
}
}
}