unload ammo/mag, 1.7.0
This commit is contained in:
@@ -31,11 +31,6 @@ namespace UIFixes
|
|||||||
|
|
||||||
public static void Toggle(GridItemView itemView)
|
public static void Toggle(GridItemView itemView)
|
||||||
{
|
{
|
||||||
if (!itemView.IsInteractable)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SelectedItemViews.ContainsKey(itemView))
|
if (SelectedItemViews.ContainsKey(itemView))
|
||||||
{
|
{
|
||||||
Deselect(itemView);
|
Deselect(itemView);
|
||||||
@@ -57,9 +52,9 @@ namespace UIFixes
|
|||||||
|
|
||||||
public static void Select(GridItemView itemView)
|
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.GClass2813_0.OnDisposed += RugPull;
|
||||||
itemContext.OnDisposed += RugPull;
|
itemContext.OnDisposed += RugPull;
|
||||||
|
|
||||||
@@ -159,4 +154,12 @@ namespace UIFixes
|
|||||||
selectedBackground?.SetActive(false);
|
selectedBackground?.SetActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class MultiSelectExtensions
|
||||||
|
{
|
||||||
|
public static bool IsSelectable(this ItemView itemView)
|
||||||
|
{
|
||||||
|
return itemView.IsInteractable && itemView.IsSearched && itemView.RemoveError.Value == null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@ namespace UIFixes
|
|||||||
public class MultiSelectDebug : MonoBehaviour
|
public class MultiSelectDebug : MonoBehaviour
|
||||||
{
|
{
|
||||||
private GUIStyle guiStyle;
|
private GUIStyle guiStyle;
|
||||||
private Rect guiRect = new(20, 20, 0, 0);
|
private Rect guiRect = new(20, 70, 0, 0);
|
||||||
|
|
||||||
GUIContent guiContent;
|
GUIContent guiContent;
|
||||||
|
|
||||||
|
@@ -34,53 +34,60 @@ namespace UIFixes
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var interactions = __instance.GetItemContextInteractions(itemContext, null);
|
||||||
if (Settings.InspectKeyBind.Value.IsDown())
|
if (Settings.InspectKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
__instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.Inspect);
|
interactions.ExecuteInteraction(EItemInfoButton.Inspect);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.OpenKeyBind.Value.IsDown())
|
if (Settings.OpenKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
__instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.Open);
|
interactions.ExecuteInteraction(EItemInfoButton.Open);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.TopUpKeyBind.Value.IsDown())
|
if (Settings.TopUpKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
__instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.TopUp);
|
interactions.ExecuteInteraction(EItemInfoButton.TopUp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.UseKeyBind.Value.IsDown())
|
if (Settings.UseKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
__instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.Use);
|
interactions.ExecuteInteraction(EItemInfoButton.Use);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.UseAllKeyBind.Value.IsDown())
|
if (Settings.UseAllKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
var interactions = __instance.GetItemContextInteractions(itemContext, null);
|
|
||||||
if (!interactions.ExecuteInteraction(EItemInfoButton.UseAll))
|
if (!interactions.ExecuteInteraction(EItemInfoButton.UseAll))
|
||||||
{
|
{
|
||||||
interactions.ExecuteInteraction(EItemInfoButton.Use);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.FilterByKeyBind.Value.IsDown())
|
if (Settings.FilterByKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
__instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.FilterSearch);
|
interactions.ExecuteInteraction(EItemInfoButton.FilterSearch);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.LinkedSearchKeyBind.Value.IsDown())
|
if (Settings.LinkedSearchKeyBind.Value.IsDown())
|
||||||
{
|
{
|
||||||
__instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.LinkedSearch);
|
interactions.ExecuteInteraction(EItemInfoButton.LinkedSearch);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
Settings.cs
10
Settings.cs
@@ -47,7 +47,7 @@ namespace UIFixes
|
|||||||
public static ConfigEntry<KeyboardShortcut> TopUpKeyBind { get; set; }
|
public static ConfigEntry<KeyboardShortcut> TopUpKeyBind { get; set; }
|
||||||
public static ConfigEntry<KeyboardShortcut> UseKeyBind { get; set; }
|
public static ConfigEntry<KeyboardShortcut> UseKeyBind { get; set; }
|
||||||
public static ConfigEntry<KeyboardShortcut> UseAllKeyBind { get; set; }
|
public static ConfigEntry<KeyboardShortcut> UseAllKeyBind { get; set; }
|
||||||
public static ConfigEntry<KeyboardShortcut> UnloadAmmoKeyBind { get; set; }
|
public static ConfigEntry<KeyboardShortcut> UnloadKeyBind { get; set; }
|
||||||
public static ConfigEntry<KeyboardShortcut> FilterByKeyBind { get; set; }
|
public static ConfigEntry<KeyboardShortcut> FilterByKeyBind { get; set; }
|
||||||
public static ConfigEntry<KeyboardShortcut> LinkedSearchKeyBind { get; set; }
|
public static ConfigEntry<KeyboardShortcut> LinkedSearchKeyBind { get; set; }
|
||||||
public static ConfigEntry<bool> UseRaidMouseScrollMulti { get; set; } // Advanced
|
public static ConfigEntry<bool> UseRaidMouseScrollMulti { get; set; } // Advanced
|
||||||
@@ -228,12 +228,12 @@ namespace UIFixes
|
|||||||
null,
|
null,
|
||||||
new ConfigurationManagerAttributes { })));
|
new ConfigurationManagerAttributes { })));
|
||||||
|
|
||||||
configEntries.Add(UnloadAmmoKeyBind = config.Bind(
|
configEntries.Add(UnloadKeyBind = config.Bind(
|
||||||
InputSection,
|
InputSection,
|
||||||
"Unload Ammo Shortcut",
|
"Unload Mag/Ammo Shortcut",
|
||||||
new KeyboardShortcut(KeyCode.None),
|
new KeyboardShortcut(KeyCode.U),
|
||||||
new ConfigDescription(
|
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,
|
null,
|
||||||
new ConfigurationManagerAttributes { })));
|
new ConfigurationManagerAttributes { })));
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net471</TargetFramework>
|
<TargetFramework>net471</TargetFramework>
|
||||||
<AssemblyName>Tyfon.UIFixes</AssemblyName>
|
<AssemblyName>Tyfon.UIFixes</AssemblyName>
|
||||||
<Description>SPT UI Fixes</Description>
|
<Description>SPT UI Fixes</Description>
|
||||||
<Version>1.6.7</Version>
|
<Version>1.7.0</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Configurations>Debug;Release;Dist</Configurations>
|
<Configurations>Debug;Release;Dist</Configurations>
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
|
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="UnityEngine.TextRenderingModule">
|
<Reference Include="UnityEngine.TextRenderingModule">
|
||||||
<HintPath>..\..\..\..\SPT\3.8.3-debug\EscapeFromTarkov_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
|
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="UnityEngine.UI">
|
<Reference Include="UnityEngine.UI">
|
||||||
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.UI.dll</HintPath>
|
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.UI.dll</HintPath>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "uifixes",
|
"name": "uifixes",
|
||||||
"version": "1.6.7",
|
"version": "1.7.0",
|
||||||
"main": "src/mod.js",
|
"main": "src/mod.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Tyfon",
|
"author": "Tyfon",
|
||||||
|
Reference in New Issue
Block a user