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 static 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 float ButtonPadding = 3f; private static Image ButtonBackground; // Nice gray background for the new buttons public static void Enable() { new SaveInspectWindowSizePatch().Enable(); new AddInspectWindowButtonsPatch().Enable(); new GrowInspectWindowDescriptionPatch().Enable(); new LeftRightKeybindsPatch().Enable(); } public 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.transform.Find("Inner/Caption Panel/Restore")?.GetComponent