From 8f83bc433942c476c0685cdd29fcecf9bd1f0cc7 Mon Sep 17 00:00:00 2001 From: Aleksandr Kirichenko Date: Tue, 18 Jun 2024 03:46:48 +0700 Subject: [PATCH] Update Plugin.cs 3.8.3 fix --- Plugin.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Plugin.cs b/Plugin.cs index 1d0e2e1..2fa70d7 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -1,9 +1,11 @@ -using BepInEx; +using BepInEx; using BepInEx.Configuration; using Aki.Reflection.Patching; using Aki.Reflection.Utils; using System.Reflection; using UnityEngine; +using EFT.UI; +using HarmonyLib; namespace AdjustableTraderRows { @@ -16,7 +18,7 @@ public class Plugin : BaseUnityPlugin private void Awake() { // set up config - configNumberInARow = Config.Bind("General", "Traders In a Row", 4, new ConfigDescription("Number of traders in a single row", new AcceptableValueRange(1, 16))); + configNumberInARow = Config.Bind("General", "Traders In a Row", 6, new ConfigDescription("Number of traders in a single row", new AcceptableValueRange(1, 16))); // Plugin startup logic @@ -29,19 +31,24 @@ public class TraderRowsPatch : ModulePatch { protected override MethodBase GetTargetMethod() { - return typeof(EFT.UI.TraderPanel).GetMethod("Update", PatchConstants.PrivateFlags); + return AccessTools.Method(typeof(MerchantsList), nameof(MerchantsList.method_4)); } [PatchPostfix] private static void AdjustTraderRows() { - var TradersContainer = GameObject.Find("Traders Container"); - var TradeRectTrans = TradersContainer.RectTransform(); + + var TradersContainer = GameObject.Find("Menu UI/UI/Merchants List/Traders Container"); + var TradeRectTrans = TradersContainer.GetComponent(); float DefaultSize = 177.25f; float ResultRows = DefaultSize * (float)Plugin.configNumberInARow.Value; + TradeRectTrans.sizeDelta = new Vector2(ResultRows, 481f); + + + } } }