Remove AlertType and AlertCategory (#27933)

This commit is contained in:
Nemanja
2024-05-23 22:43:04 -04:00
committed by GitHub
parent 594a898260
commit 8a95cb186c
69 changed files with 483 additions and 386 deletions

View File

@@ -4,6 +4,7 @@ using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Input;
using Robust.Shared.Prototypes;
namespace Content.Client.UserInterface.Systems.Alerts.Widgets;
@@ -21,8 +22,10 @@ public sealed partial class AlertsUI : UIWidget
RobustXamlLoader.Load(this);
}
public void SyncControls(AlertsSystem alertsSystem, AlertOrderPrototype? alertOrderPrototype,
IReadOnlyDictionary<AlertKey, AlertState> alertStates)
public void SyncControls(AlertsSystem alertsSystem,
AlertOrderPrototype? alertOrderPrototype,
IReadOnlyDictionary<AlertKey,
AlertState> alertStates)
{
// remove any controls with keys no longer present
if (SyncRemoveControls(alertStates))
@@ -46,7 +49,7 @@ public sealed partial class AlertsUI : UIWidget
_alertControls.Clear();
}
public event EventHandler<AlertType>? AlertPressed;
public event EventHandler<ProtoId<AlertPrototype>>? AlertPressed;
private bool SyncRemoveControls(IReadOnlyDictionary<AlertKey, AlertState> alertStates)
{
@@ -88,7 +91,7 @@ public sealed partial class AlertsUI : UIWidget
}
if (_alertControls.TryGetValue(newAlert.AlertKey, out var existingAlertControl) &&
existingAlertControl.Alert.AlertType == newAlert.AlertType)
existingAlertControl.Alert.ID == newAlert.ID)
{
// key is the same, simply update the existing control severity / cooldown
existingAlertControl.SetSeverity(alertState.Severity);
@@ -155,6 +158,6 @@ public sealed partial class AlertsUI : UIWidget
if (args.Event.Function != EngineKeyFunctions.UIClick)
return;
AlertPressed?.Invoke(this, control.Alert.AlertType);
AlertPressed?.Invoke(this, control.Alert.ID);
}
}