2023-07-08 23:42:42 +03:00
|
|
|
using BepInEx;
|
2024-12-02 15:59:14 +02:00
|
|
|
using BepInEx.Configuration;
|
|
|
|
using EFT.UI;
|
2023-07-08 23:42:42 +03:00
|
|
|
using IcyClawz.CustomInteractions;
|
2024-12-02 15:59:14 +02:00
|
|
|
using SPT.Reflection.Patching;
|
|
|
|
using System.Reflection;
|
2023-07-08 23:42:42 +03:00
|
|
|
|
2024-03-05 22:48:21 +02:00
|
|
|
namespace IcyClawz.ItemContextMenuExt;
|
|
|
|
|
2024-12-02 15:59:14 +02:00
|
|
|
[BepInPlugin("com.IcyClawz.ItemContextMenuExt", "IcyClawz.ItemContextMenuExt", "1.6.0")]
|
2024-03-05 22:48:21 +02:00
|
|
|
[BepInDependency("com.IcyClawz.CustomInteractions")]
|
|
|
|
public class Plugin : BaseUnityPlugin
|
2023-07-08 23:42:42 +03:00
|
|
|
{
|
2024-12-02 15:59:14 +02:00
|
|
|
private static ConfigEntry<float> ScaleConfig { get; set; }
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
const string SECTION = "Item Context Menu";
|
|
|
|
ScaleConfig = Config.Bind(SECTION, "Scale", 1f);
|
|
|
|
new ItemUiContextPatch().Enable();
|
2024-03-05 22:48:21 +02:00
|
|
|
CustomInteractionsManager.Register(new CustomInteractionsProvider());
|
2024-12-02 15:59:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
internal static float Scale => ScaleConfig.Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
internal class ItemUiContextPatch : ModulePatch
|
|
|
|
{
|
|
|
|
protected override MethodBase GetTargetMethod() =>
|
|
|
|
typeof(ItemUiContext).GetMethod("ShowContextMenu", BindingFlags.Public | BindingFlags.Instance);
|
|
|
|
|
|
|
|
[PatchPostfix]
|
|
|
|
private static void Postfix(ref ItemUiContext __instance) =>
|
|
|
|
__instance.ContextMenu.Transform.localScale = new(Plugin.Scale, Plugin.Scale);
|
2023-07-08 23:42:42 +03:00
|
|
|
}
|