diff --git a/Patches/FocusFleaOfferNumberPatch.cs b/Patches/FocusFleaOfferNumberPatch.cs deleted file mode 100644 index 20a0439..0000000 --- a/Patches/FocusFleaOfferNumberPatch.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Aki.Reflection.Patching; -using EFT.InventoryLogic; -using EFT.UI.Ragfair; -using HarmonyLib; -using System.Linq; -using System.Reflection; -using TMPro; - -namespace UIFixes -{ - public class FocusFleaOfferNumberPatch : ModulePatch - { - protected override MethodBase GetTargetMethod() - { - // The parent has a Show() so need to be specific - return AccessTools.GetDeclaredMethods(typeof(HandoverRagfairMoneyWindow)).First( - m => m.Name == nameof(HandoverRagfairMoneyWindow.Show) && - m.GetParameters()[0].ParameterType == typeof(Inventory)); - } - - [PatchPostfix] - public static void Postfix(TMP_InputField ____inputField) - { - ____inputField.contentType = TMP_InputField.ContentType.IntegerNumber; - ____inputField.ActivateInputField(); - ____inputField.Select(); - } - } -} diff --git a/Patches/FocusFleaOfferNumberPatches.cs b/Patches/FocusFleaOfferNumberPatches.cs new file mode 100644 index 0000000..84bf0d5 --- /dev/null +++ b/Patches/FocusFleaOfferNumberPatches.cs @@ -0,0 +1,57 @@ +using Aki.Reflection.Patching; +using EFT.InventoryLogic; +using EFT.UI.Ragfair; +using HarmonyLib; +using System.Linq; +using System.Reflection; +using TMPro; + +namespace UIFixes +{ + public static class FocusFleaOfferNumberPatches + { + public static void Enable() + { + new MoneyPatch().Enable(); + new BarterPatch().Enable(); + } + + public class MoneyPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + // The parent has a Show() so need to be specific + return AccessTools.GetDeclaredMethods(typeof(HandoverRagfairMoneyWindow)).First( + m => m.Name == nameof(HandoverRagfairMoneyWindow.Show) && + m.GetParameters()[0].ParameterType == typeof(Inventory)); + } + + [PatchPostfix] + public static void Postfix(TMP_InputField ____inputField) + { + ____inputField.contentType = TMP_InputField.ContentType.IntegerNumber; + ____inputField.ActivateInputField(); + ____inputField.Select(); + } + } + + public class BarterPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + // The parent has a Show() so need to be specific + return AccessTools.GetDeclaredMethods(typeof(HandoverExchangeableItemsWindow)).First( + m => m.Name == nameof(HandoverExchangeableItemsWindow.Show) && + m.GetParameters()[0].ParameterType == typeof(EExchangeableWindowType)); + } + + [PatchPostfix] + public static void Postfix(TMP_InputField ____inputField) + { + ____inputField.contentType = TMP_InputField.ContentType.IntegerNumber; + ____inputField.ActivateInputField(); + ____inputField.Select(); + } + } + } +} diff --git a/Plugin.cs b/Plugin.cs index 7c0ab4d..f2c7114 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -15,7 +15,7 @@ namespace UIFixes new FixMailRecieveAllPatch().Enable(); new FixTooltipPatch().Enable(); new FixWeaponBindsDisplayPatch().Enable(); - new FocusFleaOfferNumberPatch().Enable(); + FocusFleaOfferNumberPatches.Enable(); HideoutSearchPatches.Enable(); InspectWindowResizePatches.Enable(); InspectWindowStatsPatches.Enable();