UI changes
This commit is contained in:
@@ -20,9 +20,14 @@
|
||||
<!-- Right column (address, device total) -->
|
||||
<BoxContainer Orientation="Horizontal" Margin="0 0 2 0" HorizontalExpand="True">
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
|
||||
<Label Text="{Loc 'air-alarm-ui-window-address-label'}" HorizontalExpand="True"/>
|
||||
<Label Text="{Loc 'air-alarm-ui-window-device-count-label'}" HorizontalExpand="True"/>
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
|
||||
<Label Name="CDeviceAddress" HorizontalAlignment="Right" HorizontalExpand="True" Margin="0 0 4 0" />
|
||||
<Label Name="CDeviceTotal" HorizontalAlignment="Right" HorizontalExpand="True" Margin="0 0 4 0" />
|
||||
</BoxContainer>
|
||||
<Button Name="CResyncButton" Text="{Loc 'air-alarm-ui-window-resync-devices-label'}" HorizontalExpand="True" />
|
||||
</BoxContainer>
|
||||
|
||||
</BoxContainer>
|
||||
@@ -39,30 +44,8 @@
|
||||
<!-- Sensors -->
|
||||
<ScrollContainer VerticalExpand="True">
|
||||
<BoxContainer Name="CSensorContainer" Orientation="Vertical"/>
|
||||
<!-- <BoxContainer Orientation="Vertical" VerticalExpand="True">
|
||||
<BoxContainer Name="CPressureThreshold" Orientation="Vertical" Margin="2 0 2 0" />
|
||||
<BoxContainer Name="CTemperatureThreshold" Orientation="Vertical" Margin="2 0 2 0" />
|
||||
<Collapsible Orientation="Vertical">
|
||||
<CollapsibleHeading Title="Gases" />
|
||||
<CollapsibleBody Margin="4 2 4 2">
|
||||
<BoxContainer Name="CGasThresholdContainer" Orientation="Vertical" Margin="2 0 2 0" />
|
||||
</CollapsibleBody>
|
||||
</Collapsible>
|
||||
</BoxContainer> -->
|
||||
</ScrollContainer>
|
||||
</TabContainer>
|
||||
|
||||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="0 0 0 2">
|
||||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
|
||||
<Label Text="{Loc 'air-alarm-ui-window-address-label'}" HorizontalExpand="True"/>
|
||||
<Label Name="CDeviceAddress" HorizontalAlignment="Right" HorizontalExpand="True" Margin="0 0 4 0" />
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
|
||||
<Label Text="{Loc 'air-alarm-ui-window-device-count-label'}" HorizontalExpand="True"/>
|
||||
<Label Name="CDeviceTotal" HorizontalAlignment="Right" HorizontalExpand="True" Margin="0 0 4 0" />
|
||||
</BoxContainer>
|
||||
<Button Name="CResyncButton" Text="{Loc 'air-alarm-ui-window-resync-devices-label'}" HorizontalExpand="True" />
|
||||
</BoxContainer>
|
||||
<!-- Mode buttons -->
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<Label Text="{Loc 'air-alarm-ui-window-mode-label'}" Margin="0 0 2 0" />
|
||||
|
||||
@@ -58,15 +58,6 @@ namespace Content.Client.Atmos.Monitor.UI
|
||||
AirAlarmModeChanged!.Invoke((AirAlarmMode) args.Id);
|
||||
};
|
||||
|
||||
/*
|
||||
foreach (var gas in Enum.GetValues<Gas>())
|
||||
{
|
||||
var gasLabel = new Label();
|
||||
_gasReadout.AddChild(gasLabel);
|
||||
_gasLabels.Add(gas, gasLabel);
|
||||
}
|
||||
*/
|
||||
|
||||
_tabContainer.SetTabTitle(0, Loc.GetString("air-alarm-ui-window-tab-vents"));
|
||||
_tabContainer.SetTabTitle(1, Loc.GetString("air-alarm-ui-window-tab-scrubbers"));
|
||||
_tabContainer.SetTabTitle(2, Loc.GetString("air-alarm-ui-window-tab-sensors"));
|
||||
@@ -82,12 +73,16 @@ namespace Content.Client.Atmos.Monitor.UI
|
||||
_pumps.Clear();
|
||||
_scrubberDevices.RemoveAllChildren();
|
||||
_scrubbers.Clear();
|
||||
CSensorContainer.RemoveAllChildren();
|
||||
_sensors.Clear();
|
||||
ResyncAllRequested!.Invoke();
|
||||
};
|
||||
}
|
||||
|
||||
public void UpdateState(AirAlarmUIState state)
|
||||
{
|
||||
_address.Text = state.Address;
|
||||
_deviceTotal.Text = $"{state.DeviceCount}";
|
||||
_pressure.SetMarkup(Loc.GetString("air-alarm-ui-window-pressure", ("pressure", $"{state.PressureAverage:0.##}")));
|
||||
_temperature.SetMarkup(Loc.GetString("air-alarm-ui-window-temperature", ("tempC", $"{TemperatureHelpers.KelvinToCelsius(state.TemperatureAverage):0.#}"), ("temperature", $"{state.TemperatureAverage:0.##}")));
|
||||
_alarmState.SetMarkup(Loc.GetString("air-alarm-ui-window-alarm-state", ("state", $"{state.AlarmType}")));
|
||||
@@ -100,24 +95,6 @@ namespace Content.Client.Atmos.Monitor.UI
|
||||
_tabContainer.CurrentTab = (int) state.Tab;
|
||||
}
|
||||
|
||||
public void SetAddress(string address)
|
||||
{
|
||||
_address.Text = address;
|
||||
}
|
||||
|
||||
/*
|
||||
public void UpdateGasData(ref AirAlarmAirData state)
|
||||
{
|
||||
_pressure.SetMarkup(Loc.GetString("air-alarm-ui-window-pressure", ("pressure", $"{state.Pressure:0.##}")));
|
||||
_temperature.SetMarkup(Loc.GetString("air-alarm-ui-window-temperature", ("tempC", $"{TemperatureHelpers.KelvinToCelsius(state.Temperature ?? 0):0.#}"), ("temperature", $"{state.Temperature:0.##}")));
|
||||
_alarmState.SetMarkup(Loc.GetString("air-alarm-ui-window-alarm-state", ("state", $"{state.AlarmState}")));
|
||||
|
||||
if (state.Gases != null)
|
||||
foreach (var (gas, amount) in state.Gases)
|
||||
_gasLabels[gas].Text = Loc.GetString("air-alarm-ui-gases", ("gas", $"{gas}"), ("amount", $"{amount:0.####}"), ("percentage", $"{(amount / state.TotalMoles):0.##}"));
|
||||
}
|
||||
*/
|
||||
|
||||
public void UpdateModeSelector(AirAlarmMode mode)
|
||||
{
|
||||
_modes.SelectId((int) mode);
|
||||
@@ -170,56 +147,6 @@ namespace Content.Client.Atmos.Monitor.UI
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
_deviceTotal.Text = $"{_pumps.Count + _scrubbers.Count}";
|
||||
}
|
||||
|
||||
/*
|
||||
public void UpdateThreshold(ref AirAlarmUpdateAlarmThresholdMessage message)
|
||||
{
|
||||
switch (message.Type)
|
||||
{
|
||||
case AtmosMonitorThresholdType.Pressure:
|
||||
if (_pressureThresholdControl == null)
|
||||
{
|
||||
_pressureThresholdControl = new ThresholdControl(Loc.GetString("air-alarm-ui-thresholds-pressure-title"), message.Threshold, message.Type);
|
||||
_pressureThresholdControl.ThresholdDataChanged += AtmosAlarmThresholdChanged!.Invoke;
|
||||
_pressureThreshold.AddChild(_pressureThresholdControl);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pressureThresholdControl.UpdateThresholdData(message.Threshold);
|
||||
}
|
||||
|
||||
break;
|
||||
case AtmosMonitorThresholdType.Temperature:
|
||||
if (_temperatureThresholdControl == null)
|
||||
{
|
||||
_temperatureThresholdControl = new ThresholdControl(Loc.GetString("air-alarm-ui-thresholds-temperature-title"), message.Threshold, message.Type);
|
||||
_temperatureThresholdControl.ThresholdDataChanged += AtmosAlarmThresholdChanged!.Invoke;
|
||||
_temperatureThreshold.AddChild(_temperatureThresholdControl);
|
||||
}
|
||||
else
|
||||
{
|
||||
_temperatureThresholdControl.UpdateThresholdData(message.Threshold);
|
||||
}
|
||||
|
||||
break;
|
||||
case AtmosMonitorThresholdType.Gas:
|
||||
if (_gasThresholdControls.TryGetValue((Gas) message.Gas!, out var control))
|
||||
{
|
||||
control.UpdateThresholdData(message.Threshold);
|
||||
break;
|
||||
}
|
||||
|
||||
var gasThreshold = new ThresholdControl(Loc.GetString($"air-alarm-ui-thresholds-gas-title", ("gas", $"{(Gas) message.Gas!}")), message.Threshold, AtmosMonitorThresholdType.Gas, (Gas) message.Gas!, 100);
|
||||
gasThreshold.ThresholdDataChanged += AtmosAlarmThresholdChanged!.Invoke;
|
||||
_gasThresholdControls.Add((Gas) message.Gas!, gasThreshold);
|
||||
_gasThreshold.AddChild(gasThreshold);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
<BoxContainer xmlns="https://spacestation14.io"
|
||||
xmlns:widgets="clr-namespace:Content.Client.Atmos.Monitor.UI.Widgets">
|
||||
<BoxContainer xmlns="https://spacestation14.io">
|
||||
<Collapsible Orientation="Vertical">
|
||||
<CollapsibleHeading Name="SensorAddress" />
|
||||
<CollapsibleBody>
|
||||
<BoxContainer Orientation="Vertical">
|
||||
<BoxContainer Orientation="Vertical" Margin="0 0 2 0" HorizontalExpand="True">
|
||||
<Label Text="{Loc 'air-alarm-ui-window-pressure-label'}" />
|
||||
<Label Text="{Loc 'air-alarm-ui-window-temperature-label'}" />
|
||||
<Label Text="{Loc 'air-alarm-ui-window-alarm-state-label'}" />
|
||||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
|
||||
<BoxContainer Orientation="Vertical" Margin="0 0 2 0" HorizontalExpand="True">
|
||||
<Label Text="{Loc 'air-alarm-ui-window-pressure-label'}" />
|
||||
<Label Text="{Loc 'air-alarm-ui-window-temperature-label'}" />
|
||||
<Label Text="{Loc 'air-alarm-ui-window-alarm-state-label'}" />
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
|
||||
<RichTextLabel Name="PressureLabel" />
|
||||
<RichTextLabel Name="TemperatureLabel" />
|
||||
<RichTextLabel Name="AlarmStateLabel" />
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
|
||||
<RichTextLabel Name="PressureLabel" />
|
||||
<RichTextLabel Name="TemperatureLabel" />
|
||||
<RichTextLabel Name="AlarmStateLabel" />
|
||||
</BoxContainer>
|
||||
<BoxContainer Name="GasContainer" Margin="0 0 2 0"/>
|
||||
<BoxContainer Name="GasContainer" Orientation="Vertical" Margin="0 0 2 0"/>
|
||||
<Collapsible Orientation="Vertical" Margin="2">
|
||||
<CollapsibleHeading Title="{Loc 'air-alarm-ui-sensor-thresholds'}" />
|
||||
<CollapsibleBody>
|
||||
<BoxContainer Orientation="Vertical">
|
||||
<Control Name="PressureThresholdContainer" />
|
||||
<Control Name="TemperatureThresholdContainer" />
|
||||
<BoxContainer Name="GasThresholds" Orientation="Vertical" />
|
||||
<Control Name="PressureThresholdContainer" Margin="2 0 2 0" />
|
||||
<Control Name="TemperatureThresholdContainer" Margin="2 0 2 0" />
|
||||
<Collapsible Orientation="Vertical">
|
||||
<CollapsibleHeading Title="{Loc 'air-alarm-ui-sensor-gases'}" />
|
||||
<CollapsibleBody Margin="4 2 4 2">
|
||||
<BoxContainer Name="GasThresholds" Orientation="Vertical" Margin="2 0 2 0" />
|
||||
</CollapsibleBody>
|
||||
</Collapsible>
|
||||
</BoxContainer>
|
||||
</CollapsibleBody>
|
||||
</Collapsible>
|
||||
|
||||
@@ -25,7 +25,7 @@ public sealed partial class SensorInfo : BoxContainer
|
||||
|
||||
_address = address;
|
||||
|
||||
SensorAddress.Title = address;
|
||||
SensorAddress.Title = $"{address} : {data.AlarmState}";
|
||||
|
||||
PressureLabel.SetMarkup(Loc.GetString("air-alarm-ui-window-pressure", ("pressure", $"{data.Pressure:0.##}")));
|
||||
TemperatureLabel.SetMarkup(Loc.GetString("air-alarm-ui-window-temperature", ("tempC", $"{TemperatureHelpers.KelvinToCelsius(data.Temperature):0.#}"), ("temperature", $"{data.Temperature:0.##}")));
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
||||
/// <param name="monitor"></param>
|
||||
private void SyncAllSensors(EntityUid uid, AirAlarmComponent? monitor = null)
|
||||
{
|
||||
if (!Resolve(uid, ref monitor) || monitor.CurrentTab != AirAlarmTab.Sensors)
|
||||
if (!Resolve(uid, ref monitor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -528,9 +528,9 @@ namespace Content.Server.Atmos.Monitor.Systems
|
||||
: 0f;
|
||||
}
|
||||
|
||||
public void UpdateUI(EntityUid uid, AirAlarmComponent? alarm = null, AtmosAlarmableComponent? alarmable = null)
|
||||
public void UpdateUI(EntityUid uid, AirAlarmComponent? alarm = null, DeviceNetworkComponent? devNet = null, AtmosAlarmableComponent? alarmable = null)
|
||||
{
|
||||
if (!Resolve(uid, ref alarm, ref alarmable))
|
||||
if (!Resolve(uid, ref alarm, ref devNet, ref alarmable))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -567,10 +567,12 @@ namespace Content.Server.Atmos.Monitor.Systems
|
||||
}
|
||||
}
|
||||
|
||||
var deviceCount = alarm.VentData.Count + alarm.ScrubberData.Count + alarm.SensorData.Count;
|
||||
|
||||
_uiSystem.TrySetUiState(
|
||||
uid,
|
||||
SharedAirAlarmInterfaceKey.Key,
|
||||
new AirAlarmUIState(pressure, temperature, dataToSend, alarm.CurrentMode, alarm.CurrentTab, alarmable.HighestNetworkState));
|
||||
new AirAlarmUIState(devNet.Address, deviceCount, pressure, temperature, dataToSend, alarm.CurrentMode, alarm.CurrentTab, alarmable.HighestNetworkState));
|
||||
}
|
||||
|
||||
private const float _delay = 8f;
|
||||
|
||||
@@ -37,8 +37,10 @@ namespace Content.Shared.Atmos.Monitor.Components
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class AirAlarmUIState : BoundUserInterfaceState
|
||||
{
|
||||
public AirAlarmUIState(float pressureAverage, float temperatureAverage, Dictionary<string, IAtmosDeviceData> deviceData, AirAlarmMode mode, AirAlarmTab tab, AtmosMonitorAlarmType alarmType)
|
||||
public AirAlarmUIState(string address, int deviceCount, float pressureAverage, float temperatureAverage, Dictionary<string, IAtmosDeviceData> deviceData, AirAlarmMode mode, AirAlarmTab tab, AtmosMonitorAlarmType alarmType)
|
||||
{
|
||||
Address = address;
|
||||
DeviceCount = deviceCount;
|
||||
PressureAverage = pressureAverage;
|
||||
TemperatureAverage = temperatureAverage;
|
||||
DeviceData = deviceData;
|
||||
@@ -47,6 +49,8 @@ namespace Content.Shared.Atmos.Monitor.Components
|
||||
AlarmType = alarmType;
|
||||
}
|
||||
|
||||
public string Address { get; }
|
||||
public int DeviceCount { get; }
|
||||
public float PressureAverage { get; }
|
||||
public float TemperatureAverage { get; }
|
||||
/// <summary>
|
||||
|
||||
@@ -18,10 +18,9 @@ air-alarm-ui-window-pressure = {$pressure} kPa
|
||||
air-alarm-ui-window-temperature = {$tempC} C ({$temperature} K)
|
||||
air-alarm-ui-window-alarm-state = {$state}
|
||||
|
||||
air-alarm-ui-window-tab-gas = Gases
|
||||
air-alarm-ui-window-tab-vents = Vents
|
||||
air-alarm-ui-window-tab-scrubbers = Scrubbers
|
||||
air-alarm-ui-sensor-thresholds = Thresholds
|
||||
air-alarm-ui-window-tab-sensors = Sensors
|
||||
|
||||
air-alarm-ui-gases = {$gas}: {$amount} mol ({$percentage}%)
|
||||
|
||||
@@ -48,6 +47,8 @@ air-alarm-ui-scrubber-wide-net-label = WideNet
|
||||
|
||||
### Thresholds
|
||||
|
||||
air-alarm-ui-sensor-gases = Gases
|
||||
air-alarm-ui-sensor-thresholds = Thresholds
|
||||
air-alarm-ui-thresholds-pressure-title = Pressure (kPa)
|
||||
air-alarm-ui-thresholds-temperature-title = Temperature (K)
|
||||
air-alarm-ui-thresholds-gas-title = {$gas} (%)
|
||||
|
||||
Reference in New Issue
Block a user