3DSoundPatches.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using Il2Cpp;
  2. using MelonLoader;
  3. using UnityEngine;
  4. namespace AudioMgr
  5. {
  6. [HarmonyLib.HarmonyPatch(typeof(GameAudioManager), "Play3DSound", new Type[] { typeof(string), typeof(GameObject)})]
  7. public class Play3DSoundPatchString
  8. {
  9. public static bool Prefix(ref GameAudioManager __instance, ref string soundID, ref GameObject go)
  10. {
  11. //MelonLogger.Msg("Play3D string " + soundID + " on " + go.name);
  12. if (PatchMaster.PatchAction(soundID, go))
  13. {
  14. return false;
  15. }
  16. return true;
  17. }
  18. }
  19. [HarmonyLib.HarmonyPatch(typeof(GameAudioManager), "Play3DSound", new Type[] { typeof(uint), typeof(GameObject) })]
  20. public class Play3DSoundPatchUInt
  21. {
  22. public static bool Prefix(ref GameAudioManager __instance, ref uint soundID, ref GameObject go)
  23. {
  24. //MelonLogger.Msg("Play3D uint " + EventIDs.GetEventString(soundID) + " on " + go.name);
  25. if (PatchMaster.PatchAction(EventIDs.GetEventString(soundID), go))
  26. {
  27. return false;
  28. }
  29. return true;
  30. }
  31. }
  32. [HarmonyLib.HarmonyPatch(typeof(GameAudioManager), "Play3DSound", new Type[] { typeof(Il2CppAK.Wwise.Event), typeof(GameObject) })]
  33. public class Play3DSoundPatchEvent
  34. {
  35. public static void Prefix(ref GameAudioManager __instance, ref Il2CppAK.Wwise.Event soundEvent, ref GameObject go)
  36. {
  37. //MelonLogger.Msg("Play3D event " + soundEvent.Name + " on " + go.name);
  38. }
  39. }
  40. }