AuroraPatches.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using Il2Cpp;
  2. using MelonLoader;
  3. using UnityEngine;
  4. namespace AudioMgr
  5. {
  6. [HarmonyLib.HarmonyPatch(typeof(AuroraActivatedToggle), "SetState", new Type[] { typeof(AuroraActivatedToggleState) })]
  7. public class TurnOnPatch
  8. {
  9. public static bool Prefix(ref AuroraActivatedToggle __instance, ref AuroraActivatedToggleState state)
  10. {
  11. if (Settings.options.customRadioMusic && RadioMaster.auroraClipManager.clipCount > 0)
  12. {
  13. if (state == AuroraActivatedToggleState.On)
  14. {
  15. if (GameManager.GetAuroraManager().AuroraIsActive() || (!GameManager.GetAuroraManager().AuroraIsActive() && Settings.options.radioWorksWithoutAurora))
  16. {
  17. RadioMaster.StartQueue(__instance.gameObject);
  18. __instance.m_ToggleState = state;
  19. return false;
  20. }
  21. }
  22. }
  23. if (state == AuroraActivatedToggleState.Off)
  24. {
  25. RadioMaster.StopQueue(__instance.gameObject);
  26. __instance.m_ToggleState = state;
  27. return true;
  28. }
  29. return true;
  30. }
  31. }
  32. [HarmonyLib.HarmonyPatch(typeof(AuroraManager), "AuroraAudioSetIntensityRTPC")]
  33. public class TempAuroraMusicPatch
  34. {
  35. public static bool Prefix(ref AuroraManager __instance)
  36. {
  37. return false;
  38. }
  39. }
  40. /*
  41. [HarmonyLib.HarmonyPatch(typeof(AuroraActivatedToggle), "Update")]
  42. public class LightingPatch
  43. {
  44. public static bool Prefix(ref AuroraActivatedToggle __instance)
  45. {
  46. if (Settings.options.customRadioMusic && Settings.options.radioWorksWithoutAurora)
  47. {
  48. __instance.m_RequiresAuroraField = false;
  49. return false;
  50. }
  51. return true;
  52. }
  53. }
  54. [HarmonyLib.HarmonyPatch(typeof(AuroraActivatedToggle), "ShouldEnableChildren")]
  55. public class ShouldEnableEffectPatch
  56. {
  57. public static void Postfix(ref AuroraActivatedToggle __instance, ref bool __result)
  58. {
  59. if (Settings.options.customRadioMusic && Settings.options.radioWorksWithoutAurora && RadioMaster.auroraClipManager.clipCount > 0)
  60. {
  61. __result = true;
  62. }
  63. }
  64. }
  65. */
  66. }