diff --git a/Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml.cs b/Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml.cs index 57ad482e02f..344a71a470d 100644 --- a/Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml.cs +++ b/Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml.cs @@ -31,7 +31,6 @@ public sealed partial class AtmosAlertsComputerWindow : FancyWindow private AtmosAlertsComputerEntry[]? _airAlarms = null; private AtmosAlertsComputerEntry[]? _fireAlarms = null; - private AtmosAlertsComputerEntry[]? _gaslocks = null; // Frontier private IEnumerable? _allAlarms = null; private IEnumerable? _activeAlarms = null; @@ -195,7 +194,6 @@ public void UpdateUI(EntityCoordinates? consoleCoords, AtmosAlertsComputerEntry[ // Retain alarm data for use inbetween updates _airAlarms = airAlarms; _fireAlarms = fireAlarms; - _gaslocks = gaslocks; // Frontier _allAlarms = airAlarms.Concat(fireAlarms); _allAlarms = airAlarms.Concat(gaslocks); // Frontier @@ -288,7 +286,7 @@ public void UpdateUI(EntityCoordinates? consoleCoords, AtmosAlertsComputerEntry[ } // Frontier: gaslocks - for (int index = 0; index < gaslocks.Count(); index++) + for (var index = 0; index < gaslocks.Length; index++) { var entry = gaslocks.ElementAt(index); UpdateGaslockUIEntry(entry, index, GaslocksTable, console, focusGaslockData); @@ -470,7 +468,7 @@ private void UpdateGaslockUIEntry(AtmosAlertsComputerEntry entry, int index, Con newEntryContainer.SendUndockAction += SendGaslockUndockAction; // On click - newEntryContainer.FocusButton.OnButtonUp += args => + newEntryContainer.FocusButton.OnButtonUp += _ => { if (_trackedEntity == newEntryContainer.NetEntity) { @@ -502,7 +500,7 @@ private void UpdateGaslockUIEntry(AtmosAlertsComputerEntry entry, int index, Con // Update values and UI elements var tableChild = table.GetChild(index); - if (tableChild is not AtmosAlarmGaslockEntryContainer) + if (tableChild is not AtmosAlarmGaslockEntryContainer entryContainer) { table.RemoveChild(tableChild); UpdateGaslockUIEntry(entry, index, table, console, focusData); @@ -510,8 +508,6 @@ private void UpdateGaslockUIEntry(AtmosAlertsComputerEntry entry, int index, Con return; } - var entryContainer = (AtmosAlarmGaslockEntryContainer)tableChild; - entryContainer.UpdateEntry(entry, entry.NetEntity == _trackedEntity, focusData); } // End Frontier: separate UpdateUI function for gaslocks @@ -520,26 +516,27 @@ private void UpdateConsoleTable(AtmosAlertsComputerComponent console, Control ta { foreach (var tableChild in table.Children) { - // Frontier: multiple type checks - if (tableChild is AtmosAlarmEntryContainer) + switch (tableChild) { - var entryContainer = (AtmosAlarmEntryContainer)tableChild; - - if (entryContainer.NetEntity != currTrackedEntity) - entryContainer.RemoveAsFocus(); - - else if (entryContainer.NetEntity == currTrackedEntity) - entryContainer.SetAsFocus(); - } - else if (tableChild is AtmosAlarmGaslockEntryContainer) - { - var entryContainer = (AtmosAlarmGaslockEntryContainer)tableChild; + // Frontier: multiple type checks + case AtmosAlarmEntryContainer entry: + { + if (entry.NetEntity != currTrackedEntity) + entry.RemoveAsFocus(); - if (entryContainer.NetEntity != currTrackedEntity) - entryContainer.RemoveAsFocus(); + else if (entry.NetEntity == currTrackedEntity) + entry.SetAsFocus(); + break; + } + case AtmosAlarmGaslockEntryContainer gaslockEntry: + { + if (gaslockEntry.NetEntity != currTrackedEntity) + gaslockEntry.RemoveAsFocus(); - else if (entryContainer.NetEntity == currTrackedEntity) - entryContainer.SetAsFocus(); + else if (gaslockEntry.NetEntity == currTrackedEntity) + gaslockEntry.SetAsFocus(); + break; + } } // End Frontier } @@ -671,14 +668,13 @@ private bool TryGetNextScrollPosition([NotNullWhen(true)] out float? nextScrollP foreach (var control in container.Children) { - if (control == null) // Frontier: move type checks down - continue; - - if (control is AtmosAlarmEntryContainer && ((AtmosAlarmEntryContainer)control).NetEntity == _trackedEntity) // Frontier: add type check + // Frontier - Move type checks down + if (control is AtmosAlarmEntryContainer entry && entry.NetEntity == _trackedEntity) return true; - if (control is AtmosAlarmGaslockEntryContainer && ((AtmosAlarmGaslockEntryContainer)control).NetEntity == _trackedEntity) // Frontier - return true; // Frontier + // Frontier - Add gaslock check + if (control is AtmosAlarmGaslockEntryContainer gaslockEntry && gaslockEntry.NetEntity == _trackedEntity) + return true; nextScrollPosition += control.Height; } diff --git a/Content.Client/_NF/Atmos/BUI/GasSaleConsoleBoundUserInterface.cs b/Content.Client/_NF/Atmos/BUI/GasSaleConsoleBoundUserInterface.cs index f50ab1059ae..c08d3d13ed2 100644 --- a/Content.Client/_NF/Atmos/BUI/GasSaleConsoleBoundUserInterface.cs +++ b/Content.Client/_NF/Atmos/BUI/GasSaleConsoleBoundUserInterface.cs @@ -5,15 +5,11 @@ namespace Content.Client._NF.Atmos.BUI; -public sealed class GasSaleConsoleBoundUserInterface : BoundUserInterface +public sealed class GasSaleConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : BoundUserInterface(owner, uiKey) { [ViewVariables] private GasSaleMenu? _menu; - public GasSaleConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) - { - } - protected override void Open() { base.Open(); diff --git a/Content.Client/_NF/Atmos/Consoles/AtmosAlarmGaslockEntryContainer.xaml b/Content.Client/_NF/Atmos/Consoles/AtmosAlarmGaslockEntryContainer.xaml index bd4b8613787..6899c324643 100644 --- a/Content.Client/_NF/Atmos/Consoles/AtmosAlarmGaslockEntryContainer.xaml +++ b/Content.Client/_NF/Atmos/Consoles/AtmosAlarmGaslockEntryContainer.xaml @@ -1,31 +1,35 @@ + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" + Orientation="Vertical" HorizontalExpand="True" Margin="0 0 0 3"> - - + - + @@ -33,41 +37,57 @@ - + - - + -