CWX-mods/Live/Kaeno-TraderScrolling/TraderScrollingPatch.cs
2024-02-06 00:14:43 +00:00

32 lines
783 B
C#

using System.Reflection;
using Aki.Reflection.Patching;
using Aki.Reflection.Utils;
using EFT.UI;
using HarmonyLib;
using UnityEngine;
namespace TraderScrolling
{
public class TraderScrollingPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(TraderScreensGroup), nameof(TraderScreensGroup.Show));
}
[PatchPostfix]
public static void PatchPostFix()
{
var gameObject = GameObject.Find("Menu UI");
var check = gameObject.GetComponentInChildren<TraderScrollingScript>();
if (check != null)
{
return;
}
gameObject.AddComponent<TraderScrollingScript>();
}
}
}