mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-02-14 19:30:01 +01:00
* 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>
55 lines
1.6 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|