diff --git a/Patches/ContextMenuShortcutPatches.cs b/Patches/ContextMenuShortcutPatches.cs index 5171029..a926e84 100644 --- a/Patches/ContextMenuShortcutPatches.cs +++ b/Patches/ContextMenuShortcutPatches.cs @@ -46,9 +46,7 @@ public static class ContextMenuShortcutPatches return; } - if (!Settings.ItemContextBlocksTextInputs.Value && - EventSystem.current?.currentSelectedGameObject != null && - EventSystem.current.currentSelectedGameObject.GetComponent() != null) + if (!Settings.ItemContextBlocksTextInputs.Value && Plugin.TextboxActive()) { return; } diff --git a/Patches/GridWindowButtonsPatch.cs b/Patches/GridWindowButtonsPatch.cs index dc009ae..568a27f 100644 --- a/Patches/GridWindowButtonsPatch.cs +++ b/Patches/GridWindowButtonsPatch.cs @@ -73,6 +73,11 @@ public class GridWindowButtonsPatch : ModulePatch public void Update() { + if (Plugin.TextboxActive()) + { + return; + } + bool isTopWindow = window.transform.GetSiblingIndex() == window.transform.parent.childCount - 1; if (Settings.SnapLeftKeybind.Value.IsDown() && isTopWindow) { diff --git a/Patches/HideoutSearchPatches.cs b/Patches/HideoutSearchPatches.cs index 9dd0c8a..7e5b730 100644 --- a/Patches/HideoutSearchPatches.cs +++ b/Patches/HideoutSearchPatches.cs @@ -223,9 +223,7 @@ public static class HideoutSearchPatches [PatchPrefix] public static bool Prefix(ECommand command, ref InputNode.ETranslateResult __result) { - if (command == ECommand.Enter && - EventSystem.current?.currentSelectedGameObject != null && - EventSystem.current.currentSelectedGameObject.GetComponent() != null) + if (command == ECommand.Enter && Plugin.TextboxActive()) { __result = InputNode.ETranslateResult.Block; return false; diff --git a/Patches/ScrollPatches.cs b/Patches/ScrollPatches.cs index 3093562..cc0876d 100644 --- a/Patches/ScrollPatches.cs +++ b/Patches/ScrollPatches.cs @@ -35,8 +35,7 @@ public static class ScrollPatches private static bool HandleInput(ScrollRect scrollRect) { - if (EventSystem.current?.currentSelectedGameObject != null && - EventSystem.current.currentSelectedGameObject.GetComponent() != null) + if (Plugin.TextboxActive()) { return false; } diff --git a/Plugin.cs b/Plugin.cs index 71abfb2..4d84df8 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -2,6 +2,8 @@ using BepInEx.Bootstrap; using Comfort.Common; using EFT; +using TMPro; +using UnityEngine.EventSystems; namespace UIFixes; @@ -84,6 +86,12 @@ public class Plugin : BaseUnityPlugin return inRaid.HasValue && inRaid.Value; } + public static bool TextboxActive() + { + return EventSystem.current?.currentSelectedGameObject != null && + EventSystem.current.currentSelectedGameObject.GetComponent() != null; + } + private static bool? IsFikaPresent; public static bool FikaPresent()