Reverting flea dialog select
This commit is contained in:
@@ -1,65 +1,36 @@
|
|||||||
using Aki.Reflection.Patching;
|
using Aki.Reflection.Patching;
|
||||||
using EFT.InventoryLogic;
|
|
||||||
using EFT.UI;
|
using EFT.UI;
|
||||||
using EFT.UI.Ragfair;
|
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using TMPro;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UIFixes
|
namespace UIFixes
|
||||||
{
|
{
|
||||||
public class DialogPatches
|
public class DialogPatch : ModulePatch
|
||||||
{
|
{
|
||||||
public static void Enable()
|
private static MethodInfo AcceptMethod;
|
||||||
|
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
{
|
{
|
||||||
new DialogWindowPatch().Enable();
|
Type dialogWindowType = typeof(MessageWindow).BaseType;
|
||||||
new FleaPurchaseDialogPatch().Enable();
|
AcceptMethod = AccessTools.Method(dialogWindowType, "Accept");
|
||||||
|
|
||||||
|
return AccessTools.Method(dialogWindowType, "Update");
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DialogWindowPatch : ModulePatch
|
[PatchPostfix]
|
||||||
|
private static void Postfix(object __instance, bool ___bool_0)
|
||||||
{
|
{
|
||||||
private static MethodInfo AcceptMethod;
|
if (!___bool_0)
|
||||||
|
|
||||||
protected override MethodBase GetTargetMethod()
|
|
||||||
{
|
{
|
||||||
Type dialogWindowType = typeof(MessageWindow).BaseType;
|
return;
|
||||||
AcceptMethod = AccessTools.Method(dialogWindowType, "Accept");
|
|
||||||
|
|
||||||
return AccessTools.Method(dialogWindowType, "Update");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[PatchPostfix]
|
if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
|
||||||
private static void Postfix(object __instance, bool ___bool_0)
|
|
||||||
{
|
{
|
||||||
if (!___bool_0)
|
AcceptMethod.Invoke(__instance, []);
|
||||||
{
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
|
|
||||||
{
|
|
||||||
AcceptMethod.Invoke(__instance, []);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class FleaPurchaseDialogPatch : ModulePatch
|
|
||||||
{
|
|
||||||
protected override MethodBase GetTargetMethod()
|
|
||||||
{
|
|
||||||
// The parent has a Show() so need to be specific
|
|
||||||
return typeof(HandoverRagfairMoneyWindow).GetMethods().First(m => m.Name == "Show" && m.GetParameters()[0].ParameterType == typeof(Inventory));
|
|
||||||
}
|
|
||||||
|
|
||||||
[PatchPostfix]
|
|
||||||
private static void Postfix(TMP_InputField ____inputField)
|
|
||||||
{
|
|
||||||
____inputField.Select();
|
|
||||||
____inputField.ActivateInputField();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ namespace UIFixes
|
|||||||
new TooltipPatch().Enable();
|
new TooltipPatch().Enable();
|
||||||
ItemPanelPatches.Enable();
|
ItemPanelPatches.Enable();
|
||||||
new ContainerStackPatch().Enable();
|
new ContainerStackPatch().Enable();
|
||||||
DialogPatches.Enable();
|
new DialogPatch().Enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user