Keep quantity focused after purchase
This commit is contained in:
26
Patches/FocusTradeQuantityPatch.cs
Normal file
26
Patches/FocusTradeQuantityPatch.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using Aki.Reflection.Patching;
|
||||||
|
using EFT.UI;
|
||||||
|
using HarmonyLib;
|
||||||
|
using System.Reflection;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
|
namespace UIFixes
|
||||||
|
{
|
||||||
|
public class FocusTradeQuantityPatch : ModulePatch
|
||||||
|
{
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
return AccessTools.Method(typeof(BarterSchemePanel), nameof(BarterSchemePanel.method_10));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets called on the TransactionChanged event.
|
||||||
|
// The reason quantity isn't focused on the 2nd+ purchase is that BSG calls ActivateInputField() and Select() before the transaction is finished
|
||||||
|
// During the transaction, the whole canvas group is not interactable, and these methods don't work on non-interactable fields
|
||||||
|
[PatchPostfix]
|
||||||
|
public static void Postfix(TMP_InputField ____quantity)
|
||||||
|
{
|
||||||
|
____quantity.ActivateInputField();
|
||||||
|
____quantity.Select();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,6 +41,7 @@ namespace UIFixes
|
|||||||
TradingAutoSwitchPatches.Enable();
|
TradingAutoSwitchPatches.Enable();
|
||||||
AddOfferRememberAutoselectPatches.Enable();
|
AddOfferRememberAutoselectPatches.Enable();
|
||||||
KeepMessagesOpenPatches.Enable();
|
KeepMessagesOpenPatches.Enable();
|
||||||
|
new FocusTradeQuantityPatch().Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool InRaid()
|
public static bool InRaid()
|
||||||
|
|||||||
Reference in New Issue
Block a user