mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-20 01:46:28 +00:00
58 lines
1.9 KiB
C#
58 lines
1.9 KiB
C#
using AmongUs.GameOptions;
|
|
|
|
namespace AmongUsRevamped;
|
|
|
|
// https://github.com/astra1dev/AUnlocker/blob/main/src/OptionsPatches.cs
|
|
|
|
[HarmonyPatch(typeof(NumberOption), nameof(NumberOption.Increase))]
|
|
public static class NumberOption_Increase
|
|
{
|
|
public static bool Prefix(NumberOption __instance)
|
|
{
|
|
if (ModGameOptionsMenu.TabIndex >= 3) return true;
|
|
|
|
if (Utils.isHideNSeek || !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
|
{
|
|
__instance.Value += __instance.Increment;
|
|
__instance.UpdateValue();
|
|
__instance.OnValueChanged.Invoke(__instance);
|
|
__instance.AdjustButtonsActiveState();
|
|
return false;
|
|
}
|
|
else return true;
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(NumberOption), nameof(NumberOption.Decrease))]
|
|
public static class NumberOption_Decrease
|
|
{
|
|
public static bool Prefix(NumberOption __instance)
|
|
{
|
|
if (ModGameOptionsMenu.TabIndex >= 3) return true;
|
|
|
|
if (Utils.isHideNSeek || !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
|
{
|
|
__instance.Value -= __instance.Increment;
|
|
__instance.UpdateValue();
|
|
__instance.OnValueChanged.Invoke(__instance);
|
|
__instance.AdjustButtonsActiveState();
|
|
return false;
|
|
}
|
|
else return true;
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(NumberOption), nameof(NumberOption.Initialize))]
|
|
public static class NumberOption_Initialize
|
|
{
|
|
public static void Postfix(NumberOption __instance)
|
|
{
|
|
if (ModGameOptionsMenu.TabIndex >= 3) return;
|
|
|
|
if (Utils.isHideNSeek || !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
|
{
|
|
__instance.ValidRange = new FloatRange(-900f, 900f);
|
|
}
|
|
}
|
|
}
|