using Aki.Reflection.Patching; using EFT.InputSystem; using EFT.InventoryLogic; using EFT.UI; using HarmonyLib; using System.Collections.Generic; using System.Linq; using System.Reflection; using UnityEngine; using UnityEngine.UI; namespace UIFixes { internal class InspectWindowResizePatches { private static float SavedPreferredWidth = -1f; private static float SavedPreferredHeight = -1f; // Seems like this is the always the default for ItemSpecificationPanels private const float DefaultPreferredWidth = 670f; private const float DefaultPreferredHeight = 500f; private const string RestoreButtonName = "Restore"; private const float ButtonPadding = 3f; public static void Enable() { new SaveInspectWindowSizePatch().Enable(); new AddInspectWindowButtonsPatch().Enable(); new GrowInspectWindowDescriptionPatch().Enable(); } private class SaveInspectWindowSizePatch : ModulePatch { protected override MethodBase GetTargetMethod() { return AccessTools.Method(typeof(StretchArea), nameof(StretchArea.OnDrag)); } [PatchPostfix] public static void Postfix(LayoutElement ___layoutElement_0) { if (!Settings.RememberInspectSize.Value || ___layoutElement_0.GetComponent() == null) { return; } SavedPreferredWidth = ___layoutElement_0.preferredWidth; SavedPreferredHeight = ___layoutElement_0.preferredHeight; Button resizeButton = ___layoutElement_0.GetComponentsInChildren