diff --git a/MultiSelect.cs b/MultiSelect.cs index 5214967..3122fe8 100644 --- a/MultiSelect.cs +++ b/MultiSelect.cs @@ -31,11 +31,6 @@ namespace UIFixes public static void Toggle(GridItemView itemView) { - if (!itemView.IsInteractable) - { - return; - } - if (SelectedItemViews.ContainsKey(itemView)) { Deselect(itemView); @@ -57,9 +52,9 @@ namespace UIFixes public static void Select(GridItemView itemView) { - if (itemView.IsInteractable && !SelectedItemViews.ContainsKey(itemView)) + if (itemView.IsSelectable() && !SelectedItemViews.ContainsKey(itemView)) { - ItemContextClass itemContext = new ItemContextClass(itemView.ItemContext, itemView.ItemRotation); + ItemContextClass itemContext = new(itemView.ItemContext, itemView.ItemRotation); itemContext.GClass2813_0.OnDisposed += RugPull; itemContext.OnDisposed += RugPull; @@ -159,4 +154,12 @@ namespace UIFixes selectedBackground?.SetActive(false); } } + + public static class MultiSelectExtensions + { + public static bool IsSelectable(this ItemView itemView) + { + return itemView.IsInteractable && itemView.IsSearched && itemView.RemoveError.Value == null; + } + } } diff --git a/MultiSelectDebug.cs b/MultiSelectDebug.cs index e5e0344..a92a9bb 100644 --- a/MultiSelectDebug.cs +++ b/MultiSelectDebug.cs @@ -6,7 +6,7 @@ namespace UIFixes public class MultiSelectDebug : MonoBehaviour { private GUIStyle guiStyle; - private Rect guiRect = new(20, 20, 0, 0); + private Rect guiRect = new(20, 70, 0, 0); GUIContent guiContent; diff --git a/Patches/ContextMenuShortcutPatch.cs b/Patches/ContextMenuShortcutPatch.cs index 6694251..811a021 100644 --- a/Patches/ContextMenuShortcutPatch.cs +++ b/Patches/ContextMenuShortcutPatch.cs @@ -34,53 +34,60 @@ namespace UIFixes return; } + var interactions = __instance.GetItemContextInteractions(itemContext, null); if (Settings.InspectKeyBind.Value.IsDown()) { - __instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.Inspect); + interactions.ExecuteInteraction(EItemInfoButton.Inspect); return; } if (Settings.OpenKeyBind.Value.IsDown()) { - __instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.Open); + interactions.ExecuteInteraction(EItemInfoButton.Open); return; } if (Settings.TopUpKeyBind.Value.IsDown()) { - __instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.TopUp); + interactions.ExecuteInteraction(EItemInfoButton.TopUp); return; } if (Settings.UseKeyBind.Value.IsDown()) { - __instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.Use); + interactions.ExecuteInteraction(EItemInfoButton.Use); + return; } if (Settings.UseAllKeyBind.Value.IsDown()) { - var interactions = __instance.GetItemContextInteractions(itemContext, null); if (!interactions.ExecuteInteraction(EItemInfoButton.UseAll)) { interactions.ExecuteInteraction(EItemInfoButton.Use); } + + return; } - if (Settings.UnloadAmmoKeyBind.Value.IsDown()) + if (Settings.UnloadKeyBind.Value.IsDown()) { - __instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.UnloadAmmo); + if (!interactions.ExecuteInteraction(EItemInfoButton.Unload)) + { + interactions.ExecuteInteraction(EItemInfoButton.UnloadAmmo); + } + return; } if (Settings.FilterByKeyBind.Value.IsDown()) { - __instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.FilterSearch); + interactions.ExecuteInteraction(EItemInfoButton.FilterSearch); return; } if (Settings.LinkedSearchKeyBind.Value.IsDown()) { - __instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.LinkedSearch); + interactions.ExecuteInteraction(EItemInfoButton.LinkedSearch); return; } } diff --git a/Settings.cs b/Settings.cs index 90335e7..bd3ca6d 100644 --- a/Settings.cs +++ b/Settings.cs @@ -47,7 +47,7 @@ namespace UIFixes public static ConfigEntry TopUpKeyBind { get; set; } public static ConfigEntry UseKeyBind { get; set; } public static ConfigEntry UseAllKeyBind { get; set; } - public static ConfigEntry UnloadAmmoKeyBind { get; set; } + public static ConfigEntry UnloadKeyBind { get; set; } public static ConfigEntry FilterByKeyBind { get; set; } public static ConfigEntry LinkedSearchKeyBind { get; set; } public static ConfigEntry UseRaidMouseScrollMulti { get; set; } // Advanced @@ -228,12 +228,12 @@ namespace UIFixes null, new ConfigurationManagerAttributes { }))); - configEntries.Add(UnloadAmmoKeyBind = config.Bind( + configEntries.Add(UnloadKeyBind = config.Bind( InputSection, - "Unload Ammo Shortcut", - new KeyboardShortcut(KeyCode.None), + "Unload Mag/Ammo Shortcut", + new KeyboardShortcut(KeyCode.U), new ConfigDescription( - "Keybind to unload the ammo in a magazine", + "Keybind to unload the ammo in a magazine, or a magazine in a gun", null, new ConfigurationManagerAttributes { }))); diff --git a/UIFixes.csproj b/UIFixes.csproj index 52f4f0d..ffc8237 100644 --- a/UIFixes.csproj +++ b/UIFixes.csproj @@ -4,7 +4,7 @@ net471 Tyfon.UIFixes SPT UI Fixes - 1.6.7 + 1.7.0 true latest Debug;Release;Dist @@ -64,7 +64,7 @@ $(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.InputLegacyModule.dll - ..\..\..\..\SPT\3.8.3-debug\EscapeFromTarkov_Data\Managed\UnityEngine.TextRenderingModule.dll + $(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.TextRenderingModule.dll $(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.UI.dll diff --git a/server/package.json b/server/package.json index 5b46919..11d8dd5 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "uifixes", - "version": "1.6.7", + "version": "1.7.0", "main": "src/mod.js", "license": "MIT", "author": "Tyfon",