feat(progression): Profile aggregate (slice 4)
best times only improve; achievement unlock announces on the transition only, so popup/Steam subscribers cannot double-fire; statistics are increase-only (IncrementStat took any int). RelockAchievement is console-only and documented as not reaching Steam - a Steam achievement cannot be un-earned, so the disagreement is permanent and deliberate. refactor: extract EventLog, composed by both aggregates now that the duplication actually exists. 34 tests.
This commit is contained in:
19
progression/EventLog.cs
Normal file
19
progression/EventLog.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace Mr.BrickAdventures.Progression;
|
||||
|
||||
/// <summary>
|
||||
/// Collects the events an aggregate raises until someone drains them. Composed rather than
|
||||
/// inherited — aggregates own one, they are not a kind of it.
|
||||
/// </summary>
|
||||
internal sealed class EventLog
|
||||
{
|
||||
private readonly List<ProgressionEvent> _events = new();
|
||||
|
||||
public void Raise(ProgressionEvent @event) => _events.Add(@event);
|
||||
|
||||
public IReadOnlyList<ProgressionEvent> Drain()
|
||||
{
|
||||
var drained = _events.ToList();
|
||||
_events.Clear();
|
||||
return drained;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user