| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using MelonLoader;
- using Il2CppInterop.Runtime.Injection;
- using Il2Cpp;
- using UnityEngine;
- using UnityEngine.Rendering;
- namespace AudioMgr
- {
- public class AudioMain : MelonMod
- {
- bool initialized = false;
- ClipManager myClipManager, myClipManager2;
- Shot myPlayerShot;
- string rootPath = Application.dataPath + "/../Mods/";
- //AssetBundle bundle;
- public static bool _debug = false;
- public override void OnInitializeMelon()
- {
- ClassInjector.RegisterTypeInIl2Cpp<Shot>();
- ClassInjector.RegisterTypeInIl2Cpp<Queue>();
- ClassInjector.RegisterTypeInIl2Cpp<Stream>();
- RadioMaster.Initialize();
- AudioMgr.Settings.OnLoad();
- //bundle = AssetBundle.LoadFromFile(Application.dataPath + "/../Mods/sillysounds.unity3d");
- }
- public override void OnSceneWasLoaded(int buildIndex, string sceneName)
- {
- if (sceneName.Contains("Boot"))
- {
- AudioMaster.CreateMasterParent();
-
-
- //myClipManager = new ClipManager();
- //myClipManager2 = new ClipManager();
- //myClipManager.LoadClipFromFile("start", "start.mp3", ClipManager.LoadType.Decompressed);
- //myClipManager.LoadClipFromFile("shutdown", "shutdown.mp3", ClipManager.LoadType.Decompressed);
- //myClipManager.LoadClipFromFile("waterfall", "waterfall.ogg", ClipManager.LoadType.Decompressed);
- //myClipManager2.LoadAllClipsFromBundle(bundle);
- }
- if (sceneName.Contains("Menu"))
- {
- initialized = true;
-
- //myPlayerShot = AudioMaster.CreatePlayerShot(AudioMaster.SourceType.SFX);
- //PatchMaster.AddReplacePatch("PLAY_CROWCAWSDISTANT", myClipManager, "start", AudioMaster.SourceType.SFX);
- //PatchMaster.AddReplacePatch("PLAY_SNDMECHDOORWOODCLOSE1", myClipManager, "shutdown", AudioMaster.SourceType.SFX);
-
- }
- }
- public override void OnFixedUpdate()
- {
- if (initialized)
- {
- AudioMaster.MoveMasterToPlayer();
- }
- }
- public override void OnUpdate()
- {
-
- if (InputManager.GetKeyDown(InputManager.m_CurrentContext, KeyCode.Keypad0))
- {
- // myPlayerShot.PlayOneshot(myClipManager.GetClip("waterfall"));
- PatchMaster.AddSkipPatch("PLAY_RANDOMBUILDINGCREAKS1");
- PatchMaster.AddParameterPatch("WINDGUSTINTENSITY", 0f, PatchMaster.ParameterType.Limitter);
- PatchMaster.AddParameterPatch("WINDACTUALSPEED", 0f, PatchMaster.ParameterType.Limitter);
- PatchMaster.AddParameterPatch("AMBIENTVOLUME", 0f, PatchMaster.ParameterType.Limitter);
- PatchMaster.AddParameterPatch("GLOBALVOLUME", 0f, PatchMaster.ParameterType.Limitter);
- }
- if (InputManager.GetKeyDown(InputManager.m_CurrentContext, KeyCode.L))
- {
- //myPlayerShot.PlayOneshot(myClipManager2.GetClip("woo"));
- }
- }
- }
- }
|