Add GameConfig service

This commit is contained in:
Caraxi 2023-03-12 11:22:34 +10:30
parent 03f33adbce
commit 1f262ce7d5
11 changed files with 6879 additions and 0 deletions

View file

@ -0,0 +1,107 @@
using Dalamud.Game.Config;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
/// <summary>
/// Test of GameConfig.
/// </summary>
internal class GameConfigAgingStep : IAgingStep
{
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;
}
}

View file

@ -42,6 +42,7 @@ internal class SelfTestWindow : Window
new PartyFinderAgingStep(),
new HandledExceptionAgingStep(),
new DutyStateAgingStep(),
new GameConfigAgingStep(),
new LogoutEventAgingStep(),
};