From d18dfc031076b8e52c135dfcedc1f1b6627c414c Mon Sep 17 00:00:00 2001 From: Tyfon <29051038+tyfon7@users.noreply.github.com> Date: Sat, 25 May 2024 11:44:37 -0700 Subject: [PATCH] Add offer price hightlight; static patches classes --- Patches/AddOfferClickablePricesPatches.cs | 83 ++++++++++++++++++----- Patches/FixFleaPatches.cs | 2 +- Patches/HideoutSearchPatches.cs | 2 +- Patches/InspectWindowResizePatches.cs | 2 +- Patches/InspectWindowStatsPatches.cs | 2 +- Patches/ScrollPatches.cs | 8 +-- Patches/SwapPatches.cs | 2 +- Patches/SyncScrollPositionPatches.cs | 2 +- Patches/WeaponPresetConfirmPatches.cs | 2 +- Patches/WeaponZoomPatches.cs | 2 +- Plugin.cs | 2 +- 11 files changed, 80 insertions(+), 29 deletions(-) diff --git a/Patches/AddOfferClickablePricesPatches.cs b/Patches/AddOfferClickablePricesPatches.cs index b61c564..2506ba7 100644 --- a/Patches/AddOfferClickablePricesPatches.cs +++ b/Patches/AddOfferClickablePricesPatches.cs @@ -1,37 +1,88 @@ using Aki.Reflection.Patching; using EFT.UI.Ragfair; using HarmonyLib; +using JetBrains.Annotations; using System.Linq; using System.Reflection; +using TMPro; +using UnityEngine; +using UnityEngine.EventSystems; using UnityEngine.UI; namespace UIFixes { - public class AddOfferClickablePricesPatches : ModulePatch + public static class AddOfferClickablePricesPatches { - protected override MethodBase GetTargetMethod() + public static void Enable() { - return AccessTools.Method(typeof(AddOfferWindow), nameof(AddOfferWindow.Show)); + new AddButtonPatch().Enable(); } - [PatchPostfix] - public static void Postfix(ItemMarketPricesPanel ____pricesPanel, RequirementView[] ____requirementViews) + public class AddButtonPatch : ModulePatch { - var panel = ____pricesPanel.R(); + protected override MethodBase GetTargetMethod() + { + return AccessTools.Method(typeof(AddOfferWindow), nameof(AddOfferWindow.Show)); + } - var rublesRequirement = ____requirementViews.First(rv => rv.name == "Requirement (RUB)"); + [PatchPostfix] + public static void Postfix(ItemMarketPricesPanel ____pricesPanel, RequirementView[] ____requirementViews) + { + var panel = ____pricesPanel.R(); - Button lowestButton = panel.LowestLabel.GetOrAddComponent