Skip to content

Commit

Permalink
Update Plugin.cs
Browse files Browse the repository at this point in the history
3.8.3 fix
  • Loading branch information
reysonk authored Jun 17, 2024
1 parent 65f5968 commit 8f83bc4
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Plugin.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -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<int>(1, 16)));
configNumberInARow = Config.Bind("General", "Traders In a Row", 6, new ConfigDescription("Number of traders in a single row", new AcceptableValueRange<int>(1, 16)));


// Plugin startup logic
Expand All @@ -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<RectTransform>();

float DefaultSize = 177.25f;
float ResultRows = DefaultSize * (float)Plugin.configNumberInARow.Value;


TradeRectTrans.sizeDelta = new Vector2(ResultRows, 481f);



}
}
}
Expand Down

0 comments on commit 8f83bc4

Please sign in to comment.