Lock UI on hook failure

This commit is contained in:
RisaDev
2024-02-04 22:56:31 +03:00
parent 205f60480c
commit 6aa64e43ef
3 changed files with 38 additions and 18 deletions

View File

@@ -16,6 +16,7 @@ public class PluginStateBlock
private readonly PluginConfiguration _configuration;
private readonly GameStateService _gameStateService;
private readonly FantasiaPlusDetectService _fantasiaPlusDetectService;
private readonly HookingService _hookingService;
private static Vector4 normalColor = new Vector4(1, 1, 1, 1);
private static Vector4 warnColor = new Vector4(1, 0.5f, 0, 1);
@@ -25,12 +26,14 @@ public class PluginStateBlock
BoneEditorPanel boneEditorPanel,
PluginConfiguration configuration,
GameStateService gameStateService,
FantasiaPlusDetectService fantasiaPlusDetectService)
FantasiaPlusDetectService fantasiaPlusDetectService,
HookingService hookingService)
{
_boneEditorPanel = boneEditorPanel;
_configuration = configuration;
_gameStateService = gameStateService;
_fantasiaPlusDetectService = fantasiaPlusDetectService;
_hookingService = hookingService;
}
public void Draw(float yPos)
@@ -38,7 +41,12 @@ public class PluginStateBlock
var severity = PluginStateSeverity.Normal;
string? message = null;
if (_fantasiaPlusDetectService.IsFantasiaPlusInstalled)
if(_hookingService.RenderHookFailed || _hookingService.MovementHookFailed)
{
severity = PluginStateSeverity.Error;
message = $"Detected failure in game hooks. Customize+ disabled.";
}
else if (_fantasiaPlusDetectService.IsFantasiaPlusInstalled)
{
severity = PluginStateSeverity.Error;
message = $"Fantasia+ detected. The plugin is disabled until Fantasia+ is disabled and the game is restarted.";