Fix quick access panel autohide/never not working
This commit is contained in:
@@ -3,7 +3,6 @@ using EFT.InventoryLogic;
|
||||
using EFT.UI;
|
||||
using EFT.UI.DragAndDrop;
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
|
@@ -1,11 +1,23 @@
|
||||
using Aki.Reflection.Patching;
|
||||
using Bsg.GameSettings;
|
||||
using Comfort.Common;
|
||||
using EFT.InputSystem;
|
||||
using EFT.InventoryLogic;
|
||||
using EFT.UI;
|
||||
using EFT.UI.Settings;
|
||||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
|
||||
namespace UIFixes
|
||||
{
|
||||
public static class QuickAccessPanelPatches
|
||||
{
|
||||
public static void Enable()
|
||||
{
|
||||
new FixWeaponBindsDisplayPatch().Enable();
|
||||
new FixVisibilityPatch().Enable();
|
||||
}
|
||||
|
||||
public class FixWeaponBindsDisplayPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
@@ -31,4 +43,33 @@ namespace UIFixes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class FixVisibilityPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return AccessTools.Method(typeof(InventoryScreenQuickAccessPanel), nameof(InventoryScreenQuickAccessPanel.method_4));
|
||||
}
|
||||
|
||||
// BSGs implementation of this method is just straight up wrong, so reimplementing it
|
||||
[PatchPrefix]
|
||||
public static bool Prefix(InventoryScreenQuickAccessPanel __instance, bool visible)
|
||||
{
|
||||
GameSetting<EVisibilityMode> quickSlotsVisibility = Singleton<SharedGameSettingsClass>.Instance.Game.Settings.QuickSlotsVisibility;
|
||||
bool disabled = __instance.IsDisabled;
|
||||
|
||||
if (visible && !disabled && quickSlotsVisibility != EVisibilityMode.Never)
|
||||
{
|
||||
__instance.AnimatedShow(quickSlotsVisibility == EVisibilityMode.Autohide);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance.AnimatedHide();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ namespace UIFixes
|
||||
ConfirmDialogKeysPatches.Enable();
|
||||
new FixMailRecieveAllPatch().Enable();
|
||||
FixTooltipPatches.Enable();
|
||||
new FixWeaponBindsDisplayPatch().Enable();
|
||||
QuickAccessPanelPatches.Enable();
|
||||
FocusFleaOfferNumberPatches.Enable();
|
||||
HideoutSearchPatches.Enable();
|
||||
HideoutLevelPatches.Enable();
|
||||
|
Reference in New Issue
Block a user