mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
Move mods to Depricated folder.
This commit is contained in:
parent
e61f119f32
commit
5d1cb2ebec
70 changed files with 44 additions and 119 deletions
|
@ -1,11 +1,14 @@
|
|||
using ABI_RC.Core.Base;
|
||||
using MelonLoader;
|
||||
using System.Reflection;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace NAK.MuteSFX;
|
||||
|
||||
public class MuteSFX : MelonMod
|
||||
{
|
||||
#region Mod Settings
|
||||
|
||||
internal static MelonLogger.Instance Logger;
|
||||
internal const string SettingsCategory = nameof(MuteSFX);
|
||||
|
||||
|
@ -15,21 +18,39 @@ public class MuteSFX : MelonMod
|
|||
public static readonly MelonPreferences_Entry<bool> EntryEnabled =
|
||||
Category.CreateEntry("Enabled", true, description: "Toggle MuteSFX entirely.");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Melon Initialization
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
Logger = LoggerInstance;
|
||||
|
||||
HarmonyInstance.Patch(
|
||||
typeof(Audio).GetMethod(nameof(Audio.SetMicrophoneActive)),
|
||||
postfix: new HarmonyLib.HarmonyMethod(typeof(MuteSFX).GetMethod(nameof(OnSetMicrophoneActive_Postfix), BindingFlags.NonPublic | BindingFlags.Static))
|
||||
typeof(AudioManagement).GetMethod(nameof(AudioManagement.SetMicrophoneActive)),
|
||||
postfix: new HarmonyMethod(typeof(MuteSFX).GetMethod(nameof(OnSetMicrophoneActive_Postfix), BindingFlags.NonPublic | BindingFlags.Static))
|
||||
);
|
||||
|
||||
AudioModuleManager.SetupDefaultAudioClips();
|
||||
}
|
||||
|
||||
private static void OnSetMicrophoneActive_Postfix(bool muted)
|
||||
#endregion
|
||||
|
||||
#region Patched Methods
|
||||
|
||||
private static void OnSetMicrophoneActive_Postfix(bool active)
|
||||
{
|
||||
if (EntryEnabled.Value)
|
||||
AudioModuleManager.PlayAudioModule(muted ? AudioModuleManager.sfx_mute : AudioModuleManager.sfx_unmute);
|
||||
try
|
||||
{
|
||||
if (EntryEnabled.Value)
|
||||
AudioModuleManager.PlayAudioModule(active ? AudioModuleManager.sfx_unmute : AudioModuleManager.sfx_mute);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Error during the patched method {nameof(OnSetMicrophoneActive_Postfix)}");
|
||||
Logger.Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue