AudioMain.cs 902 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using MelonLoader;
  2. using Il2CppInterop.Runtime.Injection;
  3. namespace AudioMgr
  4. {
  5. public class AudioMain : MelonMod
  6. {
  7. bool initialized = false;
  8. public override void OnInitializeMelon()
  9. {
  10. ClassInjector.RegisterTypeInIl2Cpp<Shot>();
  11. ClassInjector.RegisterTypeInIl2Cpp<Queue>();
  12. }
  13. public override void OnSceneWasLoaded(int buildIndex, string sceneName)
  14. {
  15. if (sceneName.Contains("Boot"))
  16. {
  17. AudioMaster.CreateMasterParent();
  18. }
  19. if (sceneName.Contains("Menu"))
  20. {
  21. initialized = true;
  22. }
  23. }
  24. public override void OnFixedUpdate()
  25. {
  26. if (initialized)
  27. {
  28. AudioMaster.MoveMasterToPlayer();
  29. }
  30. }
  31. }
  32. }