Event-driven dialog queue, story flag command, mod unit tests
Push-based event chains, runtime fixes (single end, goto lifecycle, if, busy box, held delay, empty options, timed/animated/effect actions), the 'flag name value' DSL command, autoplay --dialogs=N, 19 mod unit tests.
This commit is contained in:
1 parent
9f86bdbb0c
commit
bd55716349
86 files changed
+3173
-2181
No files matched your search
@@ -0,0 +1,33 @@
|
||||
namespace Cthangover.Mods.Dialog.Tests
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Cthangover.Core.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Records every <see cref="DialogEndedEvent"/> published on the mod event bus
|
||||
/// between <see cref="Start"/> and <see cref="Stop"/> — the locker id of each, in
|
||||
/// publication order. Tests count how often a queue reported its end.
|
||||
/// </summary>
|
||||
public class DialogEndRecorder
|
||||
{
|
||||
/// <summary>Locker ids of the recorded events (null for a locker-less dialog).</summary>
|
||||
public List<string> LockerIds { get; } = new();
|
||||
|
||||
/// <summary>Subscribes to the event bus.</summary>
|
||||
public void Start()
|
||||
{
|
||||
ModEventBus.Subscribe<DialogEndedEvent>(OnDialogEnded);
|
||||
}
|
||||
|
||||
/// <summary>Unsubscribes; call it in <c>finally</c> so a failed test leaves no handler behind.</summary>
|
||||
public void Stop()
|
||||
{
|
||||
ModEventBus.Unsubscribe<DialogEndedEvent>(OnDialogEnded);
|
||||
}
|
||||
|
||||
private void OnDialogEnded(DialogEndedEvent evt)
|
||||
{
|
||||
LockerIds.Add(evt.LockerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user