keybind events aren't mutually exclusive; fix object focus cancelling keybinds; bindable selection box key
This commit is contained in:
@@ -55,7 +55,7 @@ namespace UIFixes
|
|||||||
}
|
}
|
||||||
|
|
||||||
// checking ItemUiContext is a quick and easy way to know the mouse is over an item
|
// checking ItemUiContext is a quick and easy way to know the mouse is over an item
|
||||||
if (Input.GetKeyDown(KeyCode.Mouse0) && ItemUiContext.Instance.R().ItemContext == null)
|
if (Settings.SelectionBoxKey.Value.IsDown() && ItemUiContext.Instance.R().ItemContext == null)
|
||||||
{
|
{
|
||||||
PointerEventData eventData = new(EventSystem.current)
|
PointerEventData eventData = new(EventSystem.current)
|
||||||
{
|
{
|
||||||
@@ -138,7 +138,7 @@ namespace UIFixes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawing && !Input.GetKey(KeyCode.Mouse0))
|
if (drawing && !Settings.SelectionBoxKey.Value.IsPressed())
|
||||||
{
|
{
|
||||||
drawing = false;
|
drawing = false;
|
||||||
if (secondary)
|
if (secondary)
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ namespace UIFixes
|
|||||||
____text.text += " (x" + count + ")";
|
____text.text += " (x" + count + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (caption == EItemInfoButton.UnloadAmmo.ToString()))
|
else if (caption == EItemInfoButton.UnloadAmmo.ToString())
|
||||||
{
|
{
|
||||||
int count = MultiSelect.InteractionCount(EItemInfoButton.UnloadAmmo, ItemUiContext.Instance);
|
int count = MultiSelect.InteractionCount(EItemInfoButton.UnloadAmmo, ItemUiContext.Instance);
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using EFT.UI;
|
|||||||
using EFT.UI.DragAndDrop;
|
using EFT.UI.DragAndDrop;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using TMPro;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
|
||||||
namespace UIFixes
|
namespace UIFixes
|
||||||
@@ -28,7 +29,7 @@ namespace UIFixes
|
|||||||
{
|
{
|
||||||
// Need an item context to operate on, and ignore these keypresses if there's a focused textbox somewhere
|
// Need an item context to operate on, and ignore these keypresses if there's a focused textbox somewhere
|
||||||
ItemContextAbstractClass itemContext = __instance.R().ItemContext;
|
ItemContextAbstractClass itemContext = __instance.R().ItemContext;
|
||||||
if (itemContext == null || EventSystem.current.currentSelectedGameObject != null)
|
if (itemContext == null || EventSystem.current.currentSelectedGameObject?.GetComponent<TMP_InputField>() != null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -37,25 +38,21 @@ namespace UIFixes
|
|||||||
if (Settings.InspectKeyBind.Value.IsDown())
|
if (Settings.InspectKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
interactions.ExecuteInteraction(EItemInfoButton.Inspect);
|
interactions.ExecuteInteraction(EItemInfoButton.Inspect);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.OpenKeyBind.Value.IsDown())
|
if (Settings.OpenKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
interactions.ExecuteInteraction(EItemInfoButton.Open);
|
interactions.ExecuteInteraction(EItemInfoButton.Open);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.TopUpKeyBind.Value.IsDown())
|
if (Settings.TopUpKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
interactions.ExecuteInteraction(EItemInfoButton.TopUp);
|
interactions.ExecuteInteraction(EItemInfoButton.TopUp);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.UseKeyBind.Value.IsDown())
|
if (Settings.UseKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
interactions.ExecuteInteraction(EItemInfoButton.Use);
|
interactions.ExecuteInteraction(EItemInfoButton.Use);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.UseAllKeyBind.Value.IsDown())
|
if (Settings.UseAllKeyBind.Value.IsDown())
|
||||||
@@ -64,8 +61,6 @@ namespace UIFixes
|
|||||||
{
|
{
|
||||||
interactions.ExecuteInteraction(EItemInfoButton.Use);
|
interactions.ExecuteInteraction(EItemInfoButton.Use);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.UnloadKeyBind.Value.IsDown())
|
if (Settings.UnloadKeyBind.Value.IsDown())
|
||||||
@@ -74,26 +69,21 @@ namespace UIFixes
|
|||||||
{
|
{
|
||||||
interactions.ExecuteInteraction(EItemInfoButton.UnloadAmmo);
|
interactions.ExecuteInteraction(EItemInfoButton.UnloadAmmo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.UnpackKeyBind.Value.IsDown())
|
if (Settings.UnpackKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
interactions.ExecuteInteraction(EItemInfoButton.Unpack);
|
interactions.ExecuteInteraction(EItemInfoButton.Unpack);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.FilterByKeyBind.Value.IsDown())
|
if (Settings.FilterByKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
interactions.ExecuteInteraction(EItemInfoButton.FilterSearch);
|
interactions.ExecuteInteraction(EItemInfoButton.FilterSearch);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.LinkedSearchKeyBind.Value.IsDown())
|
if (Settings.LinkedSearchKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
interactions.ExecuteInteraction(EItemInfoButton.LinkedSearch);
|
interactions.ExecuteInteraction(EItemInfoButton.LinkedSearch);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
Settings.cs
10
Settings.cs
@@ -66,6 +66,7 @@ namespace UIFixes
|
|||||||
|
|
||||||
// Inventory
|
// Inventory
|
||||||
public static ConfigEntry<bool> EnableMultiSelect { get; set; }
|
public static ConfigEntry<bool> EnableMultiSelect { get; set; }
|
||||||
|
public static ConfigEntry<KeyboardShortcut> SelectionBoxKey { get; set; }
|
||||||
public static ConfigEntry<MultiSelectStrategy> MultiSelectStrat { get; set; }
|
public static ConfigEntry<MultiSelectStrategy> MultiSelectStrat { get; set; }
|
||||||
public static ConfigEntry<bool> ShowMultiSelectDebug { get; set; } // Advanced
|
public static ConfigEntry<bool> ShowMultiSelectDebug { get; set; } // Advanced
|
||||||
public static ConfigEntry<bool> SwapItems { get; set; }
|
public static ConfigEntry<bool> SwapItems { get; set; }
|
||||||
@@ -304,6 +305,15 @@ namespace UIFixes
|
|||||||
null,
|
null,
|
||||||
new ConfigurationManagerAttributes { })));
|
new ConfigurationManagerAttributes { })));
|
||||||
|
|
||||||
|
configEntries.Add(SelectionBoxKey = config.Bind(
|
||||||
|
InventorySection,
|
||||||
|
"Selection Box Key",
|
||||||
|
new KeyboardShortcut(KeyCode.Mouse0),
|
||||||
|
new ConfigDescription(
|
||||||
|
"Mouse button or keyboard key to hold while dragging to create a selection box. Press Reset to use Mouse0 (left mouse button)",
|
||||||
|
null,
|
||||||
|
new ConfigurationManagerAttributes { })));
|
||||||
|
|
||||||
configEntries.Add(MultiSelectStrat = config.Bind(
|
configEntries.Add(MultiSelectStrat = config.Bind(
|
||||||
InventorySection,
|
InventorySection,
|
||||||
"Multiselect Item Placement",
|
"Multiselect Item Placement",
|
||||||
|
|||||||
Reference in New Issue
Block a user