Keep all windows on screen
This commit is contained in:
41
Patches/KeepWindowsOnScreenPatches.cs
Normal file
41
Patches/KeepWindowsOnScreenPatches.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using Aki.Reflection.Patching;
|
||||||
|
using EFT.InputSystem;
|
||||||
|
using EFT.UI;
|
||||||
|
using HarmonyLib;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace UIFixes.Patches
|
||||||
|
{
|
||||||
|
public static class KeepWindowsOnScreenPatches
|
||||||
|
{
|
||||||
|
public static void Enable()
|
||||||
|
{
|
||||||
|
new KeepWindowOnScreenPatch(nameof(ItemUiContext.Inspect)).Enable();
|
||||||
|
new KeepWindowOnScreenPatch(nameof(ItemUiContext.EditTag)).Enable();
|
||||||
|
new KeepWindowOnScreenPatch(nameof(ItemUiContext.OpenInsuranceWindow)).Enable();
|
||||||
|
new KeepWindowOnScreenPatch(nameof(ItemUiContext.OpenRepairWindow)).Enable();
|
||||||
|
new KeepWindowOnScreenPatch(nameof(ItemUiContext.method_2)).Enable(); // grids
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void FixNewestWindow(List<InputNode> windows)
|
||||||
|
{
|
||||||
|
UIInputNode newWindow = windows.Last() as UIInputNode;
|
||||||
|
newWindow?.CorrectPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class KeepWindowOnScreenPatch(string methodName) : ModulePatch
|
||||||
|
{
|
||||||
|
private string methodName = methodName;
|
||||||
|
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
return AccessTools.Method(typeof(ItemUiContext), methodName);
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchPostfix]
|
||||||
|
public static void Postfix(List<InputNode> ____children) => FixNewestWindow(____children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using BepInEx;
|
using BepInEx;
|
||||||
using Comfort.Common;
|
using Comfort.Common;
|
||||||
using EFT;
|
using EFT;
|
||||||
|
using UIFixes.Patches;
|
||||||
|
|
||||||
namespace UIFixes
|
namespace UIFixes
|
||||||
{
|
{
|
||||||
@@ -45,6 +46,7 @@ namespace UIFixes
|
|||||||
RememberRepairerPatches.Enable();
|
RememberRepairerPatches.Enable();
|
||||||
new GridWindowButtonsPatch().Enable();
|
new GridWindowButtonsPatch().Enable();
|
||||||
new LoadMagPresetsPatch().Enable();
|
new LoadMagPresetsPatch().Enable();
|
||||||
|
KeepWindowsOnScreenPatches.Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool InRaid()
|
public static bool InRaid()
|
||||||
|
|||||||
Reference in New Issue
Block a user