Ejemplo n.º 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);
        }
Ejemplo n.º 2
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();
        }