public static void SelectRandomSong() { SongSelect select = GameObject.FindObjectOfType <SongSelect>(); if (select == null) { return; } List <SongSelectItem> songs = select.GetSongButtons(); if (songs.Count == 0) { return; } int songCount = songs.Count; System.Random rand = new System.Random(); int idx = rand.Next(0, songCount); SongList.SongData data = songs[idx].mSongData; if (data != null) { SongDataHolder.I.songData = data; MenuState.I.GoToLaunchPage(); } }
private static bool CanPlay(SongSelect select) { if (select is null) { MelonLogger.Warning("SongSelect not found"); return(false); } songs = new Il2CppSystem.Collections.Generic.List <SongSelectItem>(); songs = select.GetSongButtons(); songs.RemoveAt(0); if (songs.Count == 0) { MelonLogger.Warning("No songs in playlist"); return(false); } return(true); }