AuroraPatches.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. /*
  33. [HarmonyLib.HarmonyPatch(typeof(AuroraActivatedToggle), "Update")]
  34. public class LightingPatch
  35. {
  36. public static bool Prefix(ref AuroraActivatedToggle __instance)
  37. {
  38. if (Settings.options.customRadioMusic && Settings.options.radioWorksWithoutAurora)
  39. {
  40. __instance.m_RequiresAuroraField = false;
  41. return false;
  42. }
  43. return true;
  44. }
  45. }
  46. [HarmonyLib.HarmonyPatch(typeof(AuroraActivatedToggle), "ShouldEnableChildren")]
  47. public class ShouldEnableEffectPatch
  48. {
  49. public static void Postfix(ref AuroraActivatedToggle __instance, ref bool __result)
  50. {
  51. if (Settings.options.customRadioMusic && Settings.options.radioWorksWithoutAurora && RadioMaster.auroraClipManager.clipCount > 0)
  52. {
  53. __result = true;
  54. }
  55. }
  56. }
  57. */
  58. }