tab changing

This commit is contained in:
vulppine
2022-08-18 08:14:18 -07:00
parent 35ba20de17
commit 327314b82f
3 changed files with 15 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ namespace Content.Client.Atmos.Monitor.UI
_window.AtmosAlarmThresholdChanged += OnThresholdChanged; _window.AtmosAlarmThresholdChanged += OnThresholdChanged;
_window.AirAlarmModeChanged += OnAirAlarmModeChanged; _window.AirAlarmModeChanged += OnAirAlarmModeChanged;
_window.ResyncAllRequested += ResyncAllDevices; _window.ResyncAllRequested += ResyncAllDevices;
_window.AirAlarmTabChange += OnTabChanged;
} }
private void ResyncAllDevices() private void ResyncAllDevices()
@@ -52,6 +53,11 @@ namespace Content.Client.Atmos.Monitor.UI
SendMessage(new AirAlarmUpdateAlarmThresholdMessage(address, type, threshold, gas)); SendMessage(new AirAlarmUpdateAlarmThresholdMessage(address, type, threshold, gas));
} }
private void OnTabChanged(AirAlarmTab tab)
{
SendMessage(new AirAlarmTabSetMessage(tab));
}
protected override void UpdateState(BoundUserInterfaceState state) protected override void UpdateState(BoundUserInterfaceState state)
{ {
base.UpdateState(state); base.UpdateState(state);

View File

@@ -32,7 +32,6 @@ namespace Content.Client.Atmos.Monitor.UI
private RichTextLabel _alarmState => CStatusLabel; private RichTextLabel _alarmState => CStatusLabel;
private TabContainer _tabContainer => CTabContainer; private TabContainer _tabContainer => CTabContainer;
private BoxContainer _gasReadout => CGasContainer;
private BoxContainer _ventDevices => CVentContainer; private BoxContainer _ventDevices => CVentContainer;
private BoxContainer _scrubberDevices => CScrubberContainer; private BoxContainer _scrubberDevices => CScrubberContainer;
@@ -61,12 +60,14 @@ namespace Content.Client.Atmos.Monitor.UI
AirAlarmModeChanged!.Invoke((AirAlarmMode) args.Id); AirAlarmModeChanged!.Invoke((AirAlarmMode) args.Id);
}; };
/*
foreach (var gas in Enum.GetValues<Gas>()) foreach (var gas in Enum.GetValues<Gas>())
{ {
var gasLabel = new Label(); var gasLabel = new Label();
_gasReadout.AddChild(gasLabel); _gasReadout.AddChild(gasLabel);
_gasLabels.Add(gas, gasLabel); _gasLabels.Add(gas, gasLabel);
} }
*/
_tabContainer.SetTabTitle(0, Loc.GetString("air-alarm-ui-window-tab-vents")); _tabContainer.SetTabTitle(0, Loc.GetString("air-alarm-ui-window-tab-vents"));
_tabContainer.SetTabTitle(1, Loc.GetString("air-alarm-ui-window-tab-scrubbers")); _tabContainer.SetTabTitle(1, Loc.GetString("air-alarm-ui-window-tab-scrubbers"));

View File

@@ -212,11 +212,18 @@ namespace Content.Server.Atmos.Monitor.Systems
SubscribeLocalEvent<AirAlarmComponent, AirAlarmUpdateAlarmModeMessage>(OnUpdateAlarmMode); SubscribeLocalEvent<AirAlarmComponent, AirAlarmUpdateAlarmModeMessage>(OnUpdateAlarmMode);
SubscribeLocalEvent<AirAlarmComponent, AirAlarmUpdateAlarmThresholdMessage>(OnUpdateThreshold); SubscribeLocalEvent<AirAlarmComponent, AirAlarmUpdateAlarmThresholdMessage>(OnUpdateThreshold);
SubscribeLocalEvent<AirAlarmComponent, AirAlarmUpdateDeviceDataMessage>(OnUpdateDeviceData); SubscribeLocalEvent<AirAlarmComponent, AirAlarmUpdateDeviceDataMessage>(OnUpdateDeviceData);
SubscribeLocalEvent<AirAlarmComponent, AirAlarmTabSetMessage>(OnTabChange);
SubscribeLocalEvent<AirAlarmComponent, BoundUIClosedEvent>(OnClose); SubscribeLocalEvent<AirAlarmComponent, BoundUIClosedEvent>(OnClose);
SubscribeLocalEvent<AirAlarmComponent, ComponentShutdown>(OnShutdown); SubscribeLocalEvent<AirAlarmComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<AirAlarmComponent, InteractHandEvent>(OnInteract); SubscribeLocalEvent<AirAlarmComponent, InteractHandEvent>(OnInteract);
} }
private void OnTabChange(EntityUid uid, AirAlarmComponent component, AirAlarmTabSetMessage msg)
{
component.CurrentTab = msg.Tab;
UpdateUI(uid, component);
}
private void OnPowerChanged(EntityUid uid, AirAlarmComponent component, PowerChangedEvent args) private void OnPowerChanged(EntityUid uid, AirAlarmComponent component, PowerChangedEvent args)
{ {
if (!args.Powered) if (!args.Powered)