예제 #1
0
            private static void Postfix(MenuState __instance, ref MenuState.State state)
            {
                if (state == MenuState.State.LaunchPage)
                {
                    DeleteButton.CreateDeleteButton();
                    FavoriteButton.CreateFavoriteButton();
                    AddPlaylistButton.CreatePlaylistButton();
                    DifficultyDisplay.Show();
                }
                else
                {
                    DifficultyDisplay.Hide();
                }
                if (state == MenuState.State.SongPage)
                {
                    ScoreDisplayList.Show();
                    RandomSongButton.CreateRandomSongButton();
                    SongSearchButton.CreateSearchButton();
                    SelectPlaylistButton.CreatePlaylistButton();
                    PlaylistEndlessButton.CreatePlaylistButton();
                    RefreshButton.CreateRefreshButton();
                    PlaylistEndlessManager.ResetIndex();
                }
                else
                {
                    ScoreDisplayList.Hide();
                    PlaylistEndlessButton.HidePlaylistButton();
                }

                if (state == MenuState.State.MainPage)
                {
                    //PlaylistManager.DownloadMissingSongs();
                }
            }
 public static void CancelEndless()
 {
     PlaylistManager.state = PlaylistManager.PlaylistState.None;
     MelonPreferences.Save();
     MenuState.I.GoToSongPage();
     SelectPlaylistButton.UpdatePlaylistButton();
 }
예제 #3
0
        public static void CancelEdit()
        {
            PlaylistManager.SavePlaylist(PlaylistManager.playlistToEdit.name, true);

            /*if (PlaylistDownloadManager.needReload)
             * {
             *      PlaylistManager.state = PlaylistManager.PlaylistState.None;
             *      MenuState.I.GoToSongPage();
             *      //PlaylistDownloadManager.Reload();
             * }
             * else
             * {
             *      PlaylistManager.state = PlaylistManager.PlaylistState.Selecting;
             *      OptionsMenu.I.ShowPage(OptionsMenu.Page.Main);
             * }*/
            PlaylistManager.state = PlaylistManager.PlaylistState.Selecting;
            OptionsMenu.I.ShowPage(OptionsMenu.Page.Main);
            SelectPlaylistButton.UpdatePlaylistButton();
        }
예제 #4
0
 public static void CancelCreate()
 {
     PlaylistManager.state = PlaylistManager.PlaylistState.Selecting;
     OptionsMenu.I.ShowPage(OptionsMenu.Page.Main);
     SelectPlaylistButton.UpdatePlaylistButton();
 }
예제 #5
0
        private static void AddButtons(OptionsMenu optionsMenu)
        {
            /*var header = optionsMenu.AddHeader(0, "Playlists");
             * optionsMenu.scrollable.AddRow(header);*/
            OptionsMenuButton entry = null;

            foreach (string playlist in PlaylistManager.playlists.Keys)
            {
                var name = optionsMenu.AddTextBlock(0, playlist);
                var tmp  = name.transform.GetChild(0).GetComponent <TextMeshPro>();
                tmp.fontSizeMax = 32;
                tmp.fontSizeMin = 8;
                optionsMenu.scrollable.AddRow(name.gameObject);
                OptionsMenuButton edit = null;
                if (PlaylistManager.state == PlaylistManager.PlaylistState.Selecting)
                {
                    edit = optionsMenu.AddButton(0, "Edit", new Action(() =>
                    {
                        PlaylistManager.state = PlaylistManager.PlaylistState.Editing;
                        PlaylistManager.SetPlaylistToEdit(playlist);
                        OptionsMenu.I.ShowPage(OptionsMenu.Page.Misc);
                        SelectPlaylistButton.UpdatePlaylistButton();
                    }), null, "Edit this playlist", optionsMenu.buttonPrefab);
                }

                string txt = PlaylistManager.state == PlaylistManager.PlaylistState.Selecting ? "Select" : "Add";
                entry = optionsMenu.AddButton(1, txt, new Action(() =>
                {
                    if (PlaylistManager.state == PlaylistManager.PlaylistState.Selecting)
                    {
                        PlaylistManager.SelectPlaylist(playlist);
                    }
                    else
                    {
                        PlaylistManager.AddSongToPlaylist(playlist, AddPlaylistButton.songToAdd);
                        MenuState.I.GoToLaunchPage();
                        return;
                    }
                    PlaylistManager.state = PlaylistManager.PlaylistState.None;
                    FilterPanel.ResetFilterState();
                    MenuState.I.GoToSongPage();
                    SelectPlaylistButton.UpdatePlaylistButton();
                }), null, "Select this playlist", optionsMenu.buttonPrefab);

                Il2CppSystem.Collections.Generic.List <GameObject> row = new Il2CppSystem.Collections.Generic.List <GameObject>();
                //row.Add(name.gameObject);
                if (PlaylistManager.state == PlaylistManager.PlaylistState.Selecting)
                {
                    row.Add(edit.gameObject);
                }
                row.Add(entry.gameObject);
                optionsMenu.scrollable.AddRow(row);
            }
            var header = optionsMenu.AddHeader(0, "Create");

            optionsMenu.scrollable.AddRow(header);
            entry = optionsMenu.AddButton(0, "Create new Playlist", new Action(() =>
            {
                MelonLoader.MelonLogger.Msg("Create button shot");
                PlaylistManager.state = PlaylistManager.PlaylistState.Creating;
                OptionsMenu.I.ShowPage(OptionsMenu.Page.Misc);
                MenuState.I.GoToSettingsPage();
                SelectPlaylistButton.UpdatePlaylistButton();
            }), null, "Create a new playlist", optionsMenu.buttonPrefab);
            optionsMenu.scrollable.AddRow(entry.gameObject);
        }
예제 #6
0
 public static void CancelSelect()
 {
     PlaylistManager.state = PlaylistManager.PlaylistState.None;
     MenuState.I.GoToSongPage();
     SelectPlaylistButton.UpdatePlaylistButton();
 }
예제 #7
0
        private static void AddButtons(OptionsMenu optionsMenu)
        {
            //var header = optionsMenu.AddHeader(0, PlaylistManager.playlistToEdit.name);
            var header = optionsMenu.AddHeader(0, "Song List");

            optionsMenu.scrollable.AddRow(header);
            int index = 0;

            Il2CppSystem.Collections.Generic.List <GameObject> row = new Il2CppSystem.Collections.Generic.List <GameObject>();
            foreach (KeyValuePair <string, string> song in PlaylistManager.playlistToEdit.songNames)
            {
                var name = optionsMenu.AddTextBlock(0, song.Value);
                var tmp  = name.transform.GetChild(0).GetComponent <TextMeshPro>();
                tmp.fontSizeMax = 32;
                tmp.fontSizeMin = 8;
                optionsMenu.scrollable.AddRow(name.gameObject);

                var delete = optionsMenu.AddButton(1, "Remove", new Action(() =>
                {
                    PlaylistManager.RemoveSongFromPlaylist(song.Key);
                    RefreshList();
                }), null, "Removes this song from this playlist", optionsMenu.buttonPrefab);
                row.Add(delete.gameObject);
                if (!SongLoadingManager.songDictionary.ContainsKey(song.Key + ".audica"))
                {
                    var download = optionsMenu.AddButton(0, "Download", new Action(() =>
                    {
                        var button = GameObject.Find("menu/ShellPage_Settings/page/backParent/back");
                        var label  = button.GetComponentInChildren <TextMeshPro>();
                        UnityEngine.Object.Destroy(button.GetComponentInChildren <Localizer>());
                        var bButton = button.GetComponentInChildren <GunButton>();
                        PlaylistManager.DownloadSingleSong(song.Key + ".audica", true, bButton, label);
                    }), null, "Download this song", optionsMenu.buttonPrefab);
                    download.button.destroyOnShot = true;
                    row.Add(download.gameObject);
                }

                optionsMenu.scrollable.AddRow(row);
                row = new Il2CppSystem.Collections.Generic.List <GameObject>();
                if (index < PlaylistManager.playlistToEdit.songs.Count - 1)
                {
                    var moveDown = optionsMenu.AddButton(0, "Move Down", new Action(() =>
                    {
                        PlaylistManager.MoveSongDown(song.Key);
                        RefreshList();
                    }), null, "Moves this song down in the playlist", optionsMenu.buttonPrefab);
                    row.Add(moveDown.gameObject);
                }
                if (index != 0)
                {
                    var moveUp = optionsMenu.AddButton(1, "Move Up", new Action(() =>
                    {
                        PlaylistManager.MoveSongUp(song.Key);
                        RefreshList();
                    }), null, "Moves this song up in the playlist", optionsMenu.buttonPrefab);
                    row.Add(moveUp.gameObject);
                }
                optionsMenu.scrollable.AddRow(row);
                index++;
                row = new Il2CppSystem.Collections.Generic.List <GameObject>();
            }
            header = optionsMenu.AddHeader(0, "Playlist Options");
            optionsMenu.scrollable.AddRow(header);

            var deletePlaylistButton = optionsMenu.AddButton(0, "Delete", new Action(() =>
            {
                PlaylistManager.DeletePlaylist();
                PlaylistManager.state = PlaylistManager.PlaylistState.Selecting;
                OptionsMenu.I.ShowPage(OptionsMenu.Page.Main);
                SelectPlaylistButton.UpdatePlaylistButton();
            }), null, "Deletes this Playlist", optionsMenu.buttonPrefab);

            //optionsMenu.scrollable.AddRow(deletePlaylistButton.gameObject);
            row.Add(deletePlaylistButton.gameObject);
            if (PlaylistManager.playlistToEdit.downloadedDict.Any(p => p.Value == false))
            {
                var downloadAllButton = optionsMenu.AddButton(1, "Download All", new Action(() =>
                {
                    var button = GameObject.Find("menu/ShellPage_Settings/page/backParent/back");
                    var label  = button.GetComponentInChildren <TextMeshPro>();
                    UnityEngine.Object.Destroy(button.GetComponentInChildren <Localizer>());
                    var bButton = button.GetComponentInChildren <GunButton>();
                    //bButton.SetInteractable(false);
                    List <string> songs = new List <string>();
                    foreach (KeyValuePair <string, string> song in PlaylistManager.playlistToEdit.songNames)
                    {
                        if (!SongLoadingManager.songDictionary.ContainsKey(song.Key + ".audica"))
                        {
                            songs.Add(song.Key + ".audica");
                            //PlaylistManager.DownloadSong(song.Key + ".audica", true, backButton);
                        }
                    }
                    if (songs.Count > 0)
                    {
                        PlaylistManager.DownloadSongs(songs, true, bButton, label);
                    }
                }), null, "Downloads all missing songs in this Playlist", optionsMenu.buttonPrefab);
                //optionsMenu.scrollable.AddRow(downloadAllButton.gameObject);
                row.Add(downloadAllButton.gameObject);
            }
            optionsMenu.scrollable.AddRow(row);
        }