Dalamud/Dalamud/Interface/Internal/Windows/SelfTest/Steps/GameConfigSelfTestStep.cs
2025-04-08 22:21:04 +02:00

107 lines
2.6 KiB
C#

using Dalamud.Bindings.ImGui;
using Dalamud.Game.Config;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test of GameConfig.
/// </summary>
internal class GameConfigSelfTestStep : ISelfTestStep
{
private bool started;
private bool isStartedLegacy;
private bool isSwitchedLegacy;
private bool isSwitchedStandard;
/// <inheritdoc/>
public string Name => "Test GameConfig";
/// <inheritdoc/>
public SelfTestStepResult RunStep()
{
var gameConfig = Service<GameConfig>.Get();
if (!gameConfig.UiControl.TryGetBool("MoveMode", out var isLegacy))
{
return SelfTestStepResult.Fail;
}
if (!this.started)
{
this.started = true;
this.isStartedLegacy = isLegacy;
return SelfTestStepResult.Waiting;
}
if (this.isStartedLegacy)
{
if (!this.isSwitchedStandard)
{
if (!isLegacy)
{
this.isSwitchedStandard = true;
}
else
{
ImGui.Text("Switch Movement Type to Standard");
}
return SelfTestStepResult.Waiting;
}
if (!this.isSwitchedLegacy)
{
if (isLegacy)
{
this.isSwitchedLegacy = true;
}
else
{
ImGui.Text("Switch Movement Type to Legacy");
}
return SelfTestStepResult.Waiting;
}
}
else
{
if (!this.isSwitchedLegacy)
{
if (isLegacy)
{
this.isSwitchedLegacy = true;
}
else
{
ImGui.Text("Switch Movement Type to Legacy");
}
return SelfTestStepResult.Waiting;
}
if (!this.isSwitchedStandard)
{
if (!isLegacy)
{
this.isSwitchedStandard = true;
}
else
{
ImGui.Text("Switch Movement Type to Standard");
}
return SelfTestStepResult.Waiting;
}
}
return SelfTestStepResult.Pass;
}
/// <inheritdoc/>
public void CleanUp()
{
this.isSwitchedLegacy = false;
this.isSwitchedStandard = false;
this.started = false;
}
}