예제 #1
0
        private static void AddButtons(OptionsMenu optionsMenu)
        {
            var header = optionsMenu.AddHeader(0, "Playlist Name");

            optionsMenu.scrollable.AddRow(header);

            var nameField = optionsMenu.AddButton(0, "Name:", new Action(() => { SongBrowser.shouldShowKeyboard = true; optionsMenu.keyboard.Show(); }), null, "Enter the desired name for the playlist", optionsMenu.textEntryButtonPrefab);

            optionsMenu.scrollable.AddRow(nameField.gameObject);
            playlistText = nameField.gameObject.GetComponentInChildren <TextMeshPro>();

            var createButton = optionsMenu.AddButton(0, "Create Playlist", new Action(() =>
            {
                if (newName.Length == 0)
                {
                    return;
                }

                Playlist playlist = new Playlist(newName, new List <string>());
                playlist.filename = newName + ".playlist";
                PlaylistManager.AddNewPlaylist(playlist, true);
                //PlaylistManager.SelectPlaylist(playlist.name);
                PlaylistManager.SavePlaylist(playlist.name, false);
                PlaylistManager.SavePlaylistData();
                CancelCreate();
            }), null, "Create playlist with the entered name", optionsMenu.buttonPrefab);

            optionsMenu.scrollable.AddRow(createButton.gameObject);
        }
 private void OnDownloadComplete(string search, bool success)
 {
     ActiveDownloads -= 1;
     if (!success)
     {
         MelonLogger.Warning("Download of " + search + " failed");
     }
     if (ActiveDownloads > 0)
     {
         return;
     }
     if (!IsDownloadingMissing)
     {
         SongBrowser.ReloadSongList();
         //EnableBackButton();
         return;
     }
     PlaylistManager.SavePlaylistData();
     //EnableBackButton();
     if (IsDownloadingMissing)
     {
         IsDownloadingMissing = false;
         SongLoadingManager.EnableButtons();
         PlaylistUtil.Popup("Missing playlist songs downloaded.");
         PopulatePlaylists();
         SongBrowser.ReloadSongList();
     }
 }