refactor(net): converge live session state reset
This commit is contained in:
parent
78a9223b65
commit
4f31a5085f
35 changed files with 1460 additions and 83 deletions
|
|
@ -178,6 +178,21 @@ public sealed class CombatState
|
|||
public void Clear()
|
||||
{
|
||||
_healthByGuid.Clear();
|
||||
SetCombatMode(CombatMode.NonCombat);
|
||||
CurrentMode = CombatMode.NonCombat;
|
||||
|
||||
Action<CombatMode>? listeners = CombatModeChanged;
|
||||
if (listeners is null)
|
||||
return;
|
||||
|
||||
List<Exception>? failures = null;
|
||||
foreach (Action<CombatMode> listener in listeners.GetInvocationList())
|
||||
{
|
||||
try { listener(CombatMode.NonCombat); }
|
||||
catch (Exception error) { (failures ??= []).Add(error); }
|
||||
}
|
||||
if (failures is not null)
|
||||
throw new AggregateException(
|
||||
"One or more combat reset observers failed.",
|
||||
failures);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue