mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Add DutyState to Self-Test
This commit is contained in:
parent
34466227ce
commit
f8919da11f
2 changed files with 53 additions and 0 deletions
|
|
@ -0,0 +1,52 @@
|
|||
using Dalamud.Game.DutyState;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
|
||||
|
||||
/// <summary>
|
||||
/// Test setup for the DutyState service class.
|
||||
/// </summary>
|
||||
internal class DutyStateAgingStep : IAgingStep
|
||||
{
|
||||
private bool subscribed = false;
|
||||
private bool hasPassed = false;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Name => "Test DutyState";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public SelfTestStepResult RunStep()
|
||||
{
|
||||
var dutyState = Service<DutyState>.Get();
|
||||
|
||||
ImGui.Text("Enter a duty now...");
|
||||
|
||||
if (!this.subscribed)
|
||||
{
|
||||
dutyState.DutyStarted += this.DutyStateOnDutyStarted;
|
||||
this.subscribed = true;
|
||||
}
|
||||
|
||||
if (this.hasPassed)
|
||||
{
|
||||
dutyState.DutyStarted -= this.DutyStateOnDutyStarted;
|
||||
this.subscribed = false;
|
||||
return SelfTestStepResult.Pass;
|
||||
}
|
||||
|
||||
return SelfTestStepResult.Waiting;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void CleanUp()
|
||||
{
|
||||
var dutyState = Service<DutyState>.Get();
|
||||
|
||||
dutyState.DutyStarted -= this.DutyStateOnDutyStarted;
|
||||
}
|
||||
|
||||
private void DutyStateOnDutyStarted(object? sender, ushort e)
|
||||
{
|
||||
this.hasPassed = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -42,6 +42,7 @@ internal class SelfTestWindow : Window
|
|||
new PartyFinderAgingStep(),
|
||||
new HandledExceptionAgingStep(),
|
||||
new LogoutEventAgingStep(),
|
||||
new DutyStateAgingStep(),
|
||||
};
|
||||
|
||||
private readonly List<(SelfTestStepResult Result, TimeSpan? Duration)> stepResults = new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue