MusicPatches.cs 940 B

12345678910111213141516171819202122232425262728293031
  1. using Il2Cpp;
  2. using UnityEngine;
  3. namespace AudioMgr
  4. {
  5. [HarmonyLib.HarmonyPatch(typeof(GameAudioManager), "PlayMusic", new Type[] {typeof(string), typeof(GameObject)})]
  6. public class PlayMusicStringPatch
  7. {
  8. public static bool Prefix(ref GameAudioManager __instance, string soundID, GameObject go)
  9. {
  10. if (AudioMaster.vanillaMusicDisabled)
  11. {
  12. return false;
  13. }
  14. return true;
  15. }
  16. }
  17. [HarmonyLib.HarmonyPatch(typeof(GameAudioManager), "PlayMusic", new Type[] {typeof(uint), typeof(GameObject)})]
  18. public class PlayMusicUIntPatch
  19. {
  20. public static bool Prefix(ref GameAudioManager __instance, uint soundID, GameObject go)
  21. {
  22. if (AudioMaster.vanillaMusicDisabled)
  23. {
  24. return false;
  25. }
  26. return true;
  27. }
  28. }
  29. }