44 lines
1.3 KiB
C#
Raw Normal View History

2023-10-06 18:46:03 +01:00
using System;
using Aki.Reflection.Patching;
2023-08-03 10:01:46 +01:00
using EFT.InventoryLogic;
using EFT.UI.DragAndDrop;
using System.Reflection;
2023-10-06 18:46:03 +01:00
using EFT.UI;
2023-08-03 10:01:46 +01:00
using UnityEngine;
2023-10-06 18:46:03 +01:00
using Newtonsoft.Json;
2023-08-03 10:01:46 +01:00
2023-10-06 18:46:03 +01:00
namespace Test_layout
2023-08-03 10:01:46 +01:00
{
2023-10-06 18:46:03 +01:00
public class Test_layoutPatch : ModulePatch
2023-08-03 10:01:46 +01:00
{
protected override MethodBase GetTargetMethod()
{
2023-10-06 18:46:03 +01:00
return typeof(ContainedGridsView).GetMethod("CreateGrids", BindingFlags.Public | BindingFlags.Static);
2023-08-03 10:01:46 +01:00
}
2023-10-06 18:46:03 +01:00
[PatchPostfix]
2023-10-08 22:01:21 +01:00
private static void PatchPostfix(ref ContainedGridsView __result, Item item, ContainedGridsView containedGridsTemplate)
2023-08-03 10:01:46 +01:00
{
Debug.LogError(item.TemplateId);
2023-10-08 22:01:21 +01:00
if (item.TemplateId != "5648a69d4bdc2ded0b8b457b") return;
2023-10-06 18:46:03 +01:00
Debug.LogError("Test!");
2023-08-03 10:01:46 +01:00
2023-10-06 18:46:03 +01:00
foreach (var gridView in __result.GridViews)
{
Debug.LogError(JsonConvert.SerializeObject(gridView));
2023-08-03 10:01:46 +01:00
}
2023-10-06 18:46:03 +01:00
var test = new GridView();
test.enabled = true;
test.Grid = new GClass2317("1", 1, 2, false, false, Array.Empty<ItemFilter>(),
new LootItemClass("test", new GClass2348()));
test.IsMagnified = false;
test.name = "GridView 1";
test.tag = "Untagged";
__result.GridViews = new[] { test };
2023-08-03 10:01:46 +01:00
}
}
}