Add keybind for purchase dialog ALL button
This commit is contained in:
@@ -2,9 +2,12 @@
|
||||
using EFT.InventoryLogic;
|
||||
using EFT.UI.Ragfair;
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UIFixes
|
||||
{
|
||||
@@ -24,8 +27,11 @@ namespace UIFixes
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
public static void Postfix(TMP_InputField ____inputField)
|
||||
public static void Postfix(HandoverRagfairMoneyWindow __instance, TMP_InputField ____inputField)
|
||||
{
|
||||
AllButtonKeybind allKeybind = __instance.GetOrAddComponent<AllButtonKeybind>();
|
||||
allKeybind.Init(__instance.method_9);
|
||||
|
||||
____inputField.contentType = TMP_InputField.ContentType.IntegerNumber;
|
||||
____inputField.ActivateInputField();
|
||||
____inputField.Select();
|
||||
@@ -40,12 +46,33 @@ namespace UIFixes
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
public static void Postfix(TMP_InputField ____inputField)
|
||||
public static void Postfix(HandoverExchangeableItemsWindow __instance, TMP_InputField ____inputField)
|
||||
{
|
||||
AllButtonKeybind allKeybind = __instance.GetOrAddComponent<AllButtonKeybind>();
|
||||
allKeybind.Init(__instance.method_16);
|
||||
|
||||
____inputField.contentType = TMP_InputField.ContentType.IntegerNumber;
|
||||
____inputField.ActivateInputField();
|
||||
____inputField.Select();
|
||||
}
|
||||
}
|
||||
|
||||
public class AllButtonKeybind : MonoBehaviour
|
||||
{
|
||||
private Action purchaseAllAction;
|
||||
|
||||
public void Init(Action purchaseAllAction)
|
||||
{
|
||||
this.purchaseAllAction = purchaseAllAction;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Settings.PurchaseAllKeybind.Value.IsDown())
|
||||
{
|
||||
purchaseAllAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
10
Settings.cs
10
Settings.cs
@@ -68,6 +68,7 @@ namespace UIFixes
|
||||
public static ConfigEntry<bool> ShowRequiredQuest { get; set; }
|
||||
public static ConfigEntry<bool> AutoExpandCategories { get; set; }
|
||||
public static ConfigEntry<bool> KeepAddOfferOpen { get; set; }
|
||||
public static ConfigEntry<KeyboardShortcut> PurchaseAllKeybind { get; set; }
|
||||
public static ConfigEntry<bool> KeepAddOfferOpenIgnoreMaxOffers { get; set; } // Advanced
|
||||
public static ConfigEntry<bool> RememberAutoselectSimilar { get; set; } // Advanced
|
||||
|
||||
@@ -333,6 +334,15 @@ namespace UIFixes
|
||||
null,
|
||||
new ConfigurationManagerAttributes { })));
|
||||
|
||||
configEntries.Add(PurchaseAllKeybind = config.Bind(
|
||||
InspectSection,
|
||||
"Purchase Dialog ALL Shortcut",
|
||||
new KeyboardShortcut(KeyCode.A),
|
||||
new ConfigDescription(
|
||||
"Keybind to set the quantity to all in the item purchase dialog. Equivalent to clicking the ALL button.",
|
||||
null,
|
||||
new ConfigurationManagerAttributes { })));
|
||||
|
||||
configEntries.Add(KeepAddOfferOpenIgnoreMaxOffers = config.Bind(
|
||||
FleaMarketSection,
|
||||
"Keep Add Offer Window Open: Ignore Max Offers",
|
||||
|
||||
Reference in New Issue
Block a user