diff --git a/Patches/ContextMenuPatches.cs b/Patches/ContextMenuPatches.cs index a3239bd..04d66e5 100644 --- a/Patches/ContextMenuPatches.cs +++ b/Patches/ContextMenuPatches.cs @@ -239,6 +239,8 @@ namespace UIFixes public static void Postfix() { CurrentInsuranceInteractions = null; + CurrentRepairInteractions = null; + CreatedButtonInteractionId = null; } } } diff --git a/Patches/FixTooltipPatches.cs b/Patches/FixTooltipPatches.cs index e3bdf8e..6aeff33 100644 --- a/Patches/FixTooltipPatches.cs +++ b/Patches/FixTooltipPatches.cs @@ -43,23 +43,27 @@ namespace UIFixes public static void Postfix(GridItemView __instance, TextMeshProUGUI ___ItemValue, PointerEventsProxy ____valuePointerEventsProxy, QuestItemViewPanel ____questsItemViewPanel) { // Add hover events to the correct place - HoverTrigger trigger = ___ItemValue.GetOrAddComponent(); - trigger.OnHoverStart += eventData => __instance.method_31(); - trigger.OnHoverEnd += eventData => + HoverTrigger trigger = ___ItemValue.GetComponent(); + if (trigger == null) { - __instance.method_32(); - __instance.ShowTooltip(); - }; + trigger = ___ItemValue.gameObject.AddComponent(); + trigger.OnHoverStart += eventData => __instance.method_31(); + trigger.OnHoverEnd += eventData => + { + __instance.method_32(); + __instance.ShowTooltip(); + }; - // Need a child component for some reason, copying how the quest item tooltip does it - Transform hover = ____questsItemViewPanel?.transform.Find("Hover"); - if (hover != null) - { - UnityEngine.Object.Instantiate(hover, trigger.transform, false); + // Need a child component for some reason, copying how the quest item tooltip does it + Transform hover = ____questsItemViewPanel?.transform.Find("Hover"); + if (hover != null) + { + UnityEngine.Object.Instantiate(hover, trigger.transform, false); + } + + // Remove old hover handler that covered the whole info panel + UnityEngine.Object.Destroy(____valuePointerEventsProxy); } - - // Remove old hover handler that covered the whole info panel - UnityEngine.Object.Destroy(____valuePointerEventsProxy); } } } diff --git a/Patches/InspectWindowResizePatches.cs b/Patches/InspectWindowResizePatches.cs index 3d312ff..5342c60 100644 --- a/Patches/InspectWindowResizePatches.cs +++ b/Patches/InspectWindowResizePatches.cs @@ -22,7 +22,7 @@ namespace UIFixes private const float ButtonPadding = 3f; - public static Image ButtonBackground; // Nice gray background for the new buttons + private static Image ButtonBackground; // Nice gray background for the new buttons public static void Enable() { diff --git a/Patches/OpenSortingTablePatch.cs b/Patches/OpenSortingTablePatch.cs index 3434187..6ad2f3c 100644 --- a/Patches/OpenSortingTablePatch.cs +++ b/Patches/OpenSortingTablePatch.cs @@ -4,6 +4,7 @@ using EFT.UI; using HarmonyLib; using System.Linq; using System.Reflection; +using UnityEngine; namespace UIFixes { @@ -20,7 +21,13 @@ namespace UIFixes [PatchPrefix] public static void Prefix(ItemUiContext __instance) { - if (!AllowedScreens.Contains(__instance.ContextType) || Plugin.InRaid()) + if (!Settings.AutoOpenSortingTable.Value || !AllowedScreens.Contains(__instance.ContextType) || Plugin.InRaid()) + { + return; + } + + // Temporary work-around for LootValue bug - bail out if the ALT key is down + if (Input.GetKey(KeyCode.LeftAlt)) { return; } diff --git a/Patches/ScrollPatches.cs b/Patches/ScrollPatches.cs index 6c7f6c2..6cd94ea 100644 --- a/Patches/ScrollPatches.cs +++ b/Patches/ScrollPatches.cs @@ -28,10 +28,6 @@ namespace UIFixes { if (scrollRect != null) { - Rect contentRect = scrollRect.content.rect; - Rect viewRect = scrollRect.RectTransform().rect; - float pageSize = viewRect.height / contentRect.height; - if (Settings.UseHomeEnd.Value) { if (Input.GetKeyDown(KeyCode.Home)) @@ -48,10 +44,23 @@ namespace UIFixes { if (Input.GetKeyDown(KeyCode.PageUp)) { + // Duplicate this code to avoid running it every frame + Rect contentRect = scrollRect.content.rect; + Rect viewRect = scrollRect.RectTransform().rect; + float pageSize = viewRect.height / contentRect.height; + + scrollRect.verticalNormalizedPosition = Math.Min(1f, scrollRect.verticalNormalizedPosition + pageSize); } + if (Input.GetKeyDown(KeyCode.PageDown)) { + // Duplicate this code to avoid running it every frame + Rect contentRect = scrollRect.content.rect; + Rect viewRect = scrollRect.RectTransform().rect; + float pageSize = viewRect.height / contentRect.height; + + scrollRect.verticalNormalizedPosition = Math.Max(0f, scrollRect.verticalNormalizedPosition - pageSize); } } diff --git a/Settings.cs b/Settings.cs index a739e45..2d80c2a 100644 --- a/Settings.cs +++ b/Settings.cs @@ -59,6 +59,7 @@ namespace UIFixes public static ConfigEntry MergeFIRMoney { get; set; } public static ConfigEntry MergeFIRAmmo { get; set; } public static ConfigEntry MergeFIROther { get; set; } + public static ConfigEntry AutoOpenSortingTable { get; set; } // Inspect Panels public static ConfigEntry ShowModStats { get; set; } @@ -306,6 +307,15 @@ namespace UIFixes null, new ConfigurationManagerAttributes { }))); + configEntries.Add(AutoOpenSortingTable = config.Bind( + InventorySection, + "Auto-open Sorting Table", + true, + new ConfigDescription( + "Automatically open the sorting table if it's closed when you shift-click an item", + null, + new ConfigurationManagerAttributes { }))); + // Inspect configEntries.Add(ShowModStats = config.Bind( InspectSection, diff --git a/UIFixes.csproj b/UIFixes.csproj index 684ac43..2a67f52 100644 --- a/UIFixes.csproj +++ b/UIFixes.csproj @@ -4,7 +4,7 @@ net471 Tyfon.UIFixes SPT UI Fixes - 1.6.6 + 1.6.7 true latest Debug;Release;Dist diff --git a/server/package.json b/server/package.json index 8053cbd..5b46919 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "uifixes", - "version": "1.6.6", + "version": "1.6.7", "main": "src/mod.js", "license": "MIT", "author": "Tyfon",