private static bool CreateMusicListPrefix(LevelEditor __instance, ref float ___numButtonsLoad) { List <string> trackList = new List <string> { "Home_Base_v2", "Level1_1", "Level1_2", "Level1_3", "Level2_1", "Level2_2", "Level2_3", "Level3_1", "Level3_2", "Level3_3", "Level4_1", "Level4_2", "Level4_3", "Level5_1", "Level5_2", "Level5_3", "Level6" }; trackList.AddRange(CustomMusicManager.GetCustomMusic().Keys); __instance.ActivateLoadMenu(); ___numButtonsLoad = trackList.Count; __instance.OpenObjectLoad(trackList); __instance.StartCoroutine(SetScrollBarPlacement(__instance)); return(false); }
public void Awake() { var harmony = new Harmony(pluginGuid); RuntimePatcherUtils.RunPatchers(Logger, harmony, RuntimePatcherUtils.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "SoR_Music_Loader.asm")); TrackConfigManager.AttachToScene(); CustomMusicManager.AttachToScene(); }
/// <summary> /// Same as Music, but asynchronous. Will call the callback once execution has finished. /// Can be used to minimize lag when loading tracks. /// </summary> /// /// <param name="trackName"> /// DisplayName of the track, has to be unique. (preferably prefixed with your mod's name or acronym, eg `myMod_trackName`) /// </param> /// /// <param name="formatType"> /// format of the file, e.g. MPEG for .mp3 or WAV for .wav files /// </param> /// /// <param name="filePath"> /// The path to the music-file, either absolute or relative to `[...]/BepInEx/config/blazingtwist.sor.musicloader/` /// You can use either `/` or System.IO.Path.DirectorySeparatorChar for the path. /// </param> /// /// <param name="callback"> /// optional callback. Called once execution is finished with MusicLoadResult and the final AudioClip (when MusicLoadResult == Success) or null otherwise /// </param> /// /// <returns> /// IEnumerator /// </returns> public static IEnumerator LoadMusicAsync(string trackName, AudioType formatType, string filePath, Action <MusicLoadResult, AudioClip> callback = null) { yield return(CustomMusicManager.AddMusicAsync(trackName, formatType, filePath, callback)); }
/// <summary> /// Adds a track to the game /// can be used as an alternative to the LoadMusic/LoadMusicAsync methods if you want to load the file yourself or already have an AudioClip for other reasons /// </summary> /// /// <param name="trackName"> /// DisplayName of the track, has to be unique. (preferably prefixed with your mod's name or acronym, eg `myMod_trackName`) /// </param> /// /// <param name="music"> /// Non-Null AudioClip to play when loading the track /// </param> /// /// <returns> /// MusicLoadResult /// </returns> public static MusicLoadResult AddMusic(string trackName, AudioClip music) { return(CustomMusicManager.AddMusic(trackName, music)); }
/// <summary> /// Loads and adds a track synchronously /// </summary> /// /// <param name="trackName"> /// DisplayName of the track, has to be unique. (preferably prefixed with your mod's name or acronym, eg `myMod_trackName`) /// </param> /// /// <param name="formatType"> /// format of the file, e.g. MPEG for .mp3 or WAV for .wav files /// </param> /// /// <param name="filePath"> /// The path to the music-file, either absolute or relative to `[...]/BepInEx/config/blazingtwist.sor.musicloader/` /// You can use either `/` or System.IO.Path.DirectorySeparatorChar for the path. /// </param> /// /// <returns> /// A Tuple of MusicLoadResult and the final AudioClip (when MusicLoadResult == Success) or null otherwise /// </returns> public static (MusicLoadResult, AudioClip) LoadMusic(string trackName, AudioType formatType, string filePath) { return(CustomMusicManager.AddMusic(trackName, formatType, filePath)); }