Skip to content

Commit

Permalink
fix AvatarHideButton
Browse files Browse the repository at this point in the history
  • Loading branch information
BlazingTwist committed Dec 13, 2021
1 parent de3fdf5 commit 0d8a8d6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion SoD_BaseMod/src/asm/SanctuaryPetPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private static void SetSleepParticlePostfix(SanctuaryPet __instance) {
}
}

[HarmonyPrefix, HarmonyPatch(methodName: "set_" + nameof(SanctuaryPet.pWeaponShotsAvailable), argumentTypes: new[] { typeof(int) })]
[HarmonyPrefix, HarmonyPatch(methodName: nameof(SanctuaryPet.pWeaponShotsAvailable), methodType: MethodType.Setter)]
private static bool SetPWeaponShotsAvailablePrefix() {
BTHackConfig hackConfig = BTDebugCamInputManager.GetConfigHolder().hackConfig;
return hackConfig == null || !hackConfig.fireball_infiniteShots;
Expand Down
23 changes: 18 additions & 5 deletions SoD_BaseMod/src/asm/UiAvatarControlsPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
using HarmonyLib;
using SoD_BaseMod.config;
using SoD_BaseMod.Extensions;
using UnityEngine;

namespace SoD_BaseMod {
[HarmonyPatch(declaringType: typeof(UiAvatarControls))]
public static class UiAvatarControlsPatcher {
[HarmonyPrefix, HarmonyPatch(methodName: nameof(UiAvatarControls.ShowAvatarToggleButton), argumentTypes: new[] { typeof(bool) })]
private static void ShowAvatarToggleButtonPrefix(out bool show) {
show = true;
}


[HarmonyPostfix, HarmonyPatch(methodName: nameof(UiAvatarControls.GetWeaponCooldown), argumentTypes: new Type[] { })]
private static void GetWeaponCooldownPostfix(ref float __result) {
BTHackConfig hackConfig = BTDebugCamInputManager.GetConfigHolder().hackConfig;
Expand Down Expand Up @@ -71,5 +68,21 @@ private static void HideAvatarPostfix(UiAvatarControls __instance, bool hide) {
}
}
}

[HarmonyPrefix, HarmonyPatch(methodName: nameof(UiAvatarControls.ShowAvatarToggleButton), argumentTypes: new[] { typeof(bool) })]
private static bool ShowAvatarToggleButtonPrefix(UiAvatarControls __instance, bool show) {
BTVisibilitySetting visibility = BTDebugCamInputManager.GetConfigHolder().config.avatarButtonVisibility;
switch (visibility) {
case BTVisibilitySetting.Default:
return true;
case BTVisibilitySetting.Force:
return false;
case BTVisibilitySetting.Hide:
return false;
default:
BTConfigHolder.LogMessage(LogType.Error, $"ShowAvatarToggleButtonPrefix: Unknown ButtonVisibility '{visibility}'");
throw new ArgumentOutOfRangeException();
}
}
}
}

0 comments on commit 0d8a8d6

Please sign in to comment.