private static void CreateSongItem(Song song, OptionsMenu optionsMenu)
        {
            var row = new Il2CppSystem.Collections.Generic.List <GameObject>();

            var textBlock = optionsMenu.AddTextBlock(0, song.title + " - " + song.artist + " (mapped by " + song.author + ")");
            var TMP       = textBlock.transform.GetChild(0).GetComponent <TextMeshPro>();

            TMP.fontSizeMax = 32;
            TMP.fontSizeMin = 8;
            optionsMenu.scrollable.AddRow(textBlock.gameObject);

            // Skip button
            bool   destroyOnShot = true;
            Action onHit         = new Action(() => {
                missingSongsIDs.Remove(song.song_id);           // remove from local copy
                SongRequests.missingSongs.Remove(song.song_id); // remove from main list
                AddSongItems(optionsMenu);                      // refresh list
            });

            var skipButton = optionsMenu.AddButton(1,
                                                   "Skip",
                                                   onHit,
                                                   null,
                                                   null);

            skipButton.button.destroyOnShot   = destroyOnShot;
            skipButton.button.doMeshExplosion = destroyOnShot;

            // Download button
            Action onHit2 = new Action(() => {
                StartDownload(song.song_id, song.download_url, TMP);
            });

            var downloadButton = optionsMenu.AddButton(0,
                                                       "Download",
                                                       onHit2,
                                                       null,
                                                       null);

            downloadButton.button.destroyOnShot   = destroyOnShot;
            downloadButton.button.doMeshExplosion = destroyOnShot;

            // Preview button
            var previewButton = optionsMenu.AddButton(0,
                                                      "Preview",
                                                      new Action(() => { MelonCoroutines.Start(SongDownloader.StreamPreviewSong(song.preview_url)); }),
                                                      null,
                                                      null);

            optionsMenu.scrollable.AddRow(previewButton.gameObject);
            row.Add(downloadButton.gameObject);
            row.Add(skipButton.gameObject);

            optionsMenu.scrollable.AddRow(row);
        }
Exemplo n.º 2
0
        private static void CreateSongItem(Song song, OptionsMenu optionsMenu)
        {
            var row = new Il2CppSystem.Collections.Generic.List <GameObject>();

            var textBlock = optionsMenu.AddTextBlock(0, song.title + " - " + song.artist + " (mapped by " + song.author + ")");
            var TMP       = textBlock.transform.GetChild(0).GetComponent <TextMeshPro>();

            TMP.fontSizeMax = 32;
            TMP.fontSizeMin = 8;
            optionsMenu.scrollable.AddRow(textBlock.gameObject);

            //package data to be used for display
            SongBrowser.SongDisplayPackage songd = new SongBrowser.SongDisplayPackage();

            songd.hasEasy     = song.beginner;
            songd.hasStandard = song.standard;
            songd.hasAdvanced = song.advanced;
            songd.hasExpert   = song.expert;

            //if song data loader is installed look for custom tags
            if (SongBrowser.songDataLoaderInstalled)
            {
                songd = SongBrowser.SongDisplayPackage.FillCustomData(songd, song.song_id);
            }

            songd.customExpertTags   = songd.customExpertTags.Distinct().ToList();
            songd.customStandardTags = songd.customStandardTags.Distinct().ToList();
            songd.customAdvancedTags = songd.customAdvancedTags.Distinct().ToList();
            songd.customEasyTags     = songd.customEasyTags.Distinct().ToList();

            var downloadButton = optionsMenu.AddButton(0,
                                                       "Download" + SongBrowser.GetDifficultyString(songd),
                                                       new Action(() => { MelonCoroutines.Start(SongBrowser.DownloadSong(song.download_url)); TMP.text = "Added song to download queue!"; }),
                                                       null,
                                                       null);

            downloadButton.button.destroyOnShot = true;

            row.Add(downloadButton.gameObject);

            var previewButton = optionsMenu.AddButton(1,
                                                      "Preview",
                                                      new Action(() => { MelonCoroutines.Start(SongBrowser.StreamPreviewSong(song.preview_url)); }),
                                                      null,
                                                      null);

            row.Add(previewButton.gameObject);


            optionsMenu.scrollable.AddRow(row);
        }
Exemplo n.º 3
0
        private static void AddButtons(OptionsMenu optionsMenu)
        {
            var header = optionsMenu.AddHeader(0, "Search by: Artist, Title, Mapper");

            optionsMenu.scrollable.AddRow(header);

            var searchField = optionsMenu.AddButton(0, "Search:", new Action(() => { SongBrowser.shouldShowKeyboard = true; optionsMenu.keyboard.Show(); }), null, "Filter by: Artist, Title, Mapper", optionsMenu.textEntryButtonPrefab);

            optionsMenu.scrollable.AddRow(searchField.gameObject);
            searchText = searchField.gameObject.GetComponentInChildren <TextMeshPro>();

            var infoText = optionsMenu.AddTextBlock(0, "Searching for nothing will find all songs, unless limited by additional filters.");

            optionsMenu.scrollable.AddRow(infoText);

            var filtersHeader = optionsMenu.AddHeader(0, "Additional filters");

            optionsMenu.scrollable.AddRow(filtersHeader);

            mapTypeToggle = optionsMenu.AddButton(0,
                                                  SplitCamelCase(SongSearch.mapType.ToString()),
                                                  new Action(() =>
            {
                SongSearch.mapType++;
                if ((int)SongSearch.mapType > 2)
                {
                    SongSearch.mapType = SongSearch.MapType.All;
                }
                mapTypeToggle.label.text = SplitCamelCase(SongSearch.mapType.ToString());
            }),
                                                  null,
                                                  "Filters the search to the selected map type");
            mapTypeToggle.button.doMeshExplosion = false;
            mapTypeToggle.button.doParticles     = false;
            optionsMenu.scrollable.AddRow(mapTypeToggle.gameObject);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        private static void AddButtons(OptionsMenu optionsMenu)
        {
            var header = optionsMenu.AddHeader(0, "Filter by: Artist, Title, Mapper");

            optionsMenu.scrollable.AddRow(header);

            var searchField = optionsMenu.AddButton(0, "Search:", new Action(() => { SongBrowser.shouldShowKeyboard = true; optionsMenu.keyboard.Show(); }), null, "Filter by: Artist, Title, Mapper", optionsMenu.textEntryButtonPrefab);

            optionsMenu.scrollable.AddRow(searchField.gameObject);
            searchText = searchField.gameObject.GetComponentInChildren <TextMeshPro>();

            var difficultyHeader = optionsMenu.AddHeader(0, "Filter difficulty");

            optionsMenu.scrollable.AddRow(difficultyHeader);

            string difficultyFilterText = difficultyFilter.ToString();

            difficultyToggle = optionsMenu.AddButton
                                   (0,
                                   difficultyFilterText,
                                   new Action(() =>
            {
                difficultyFilter++;
                if ((int)difficultyFilter > 4)
                {
                    difficultyFilter = 0;
                }
                difficultyToggle.label.text = difficultyFilter.ToString();
                SongBrowser.page            = 1;
                SongBrowser.StartSongSearch();
            }),
                                   null,
                                   "Filters the search to the selected difficulty");
            difficultyToggle.button.doMeshExplosion = false;
            difficultyToggle.button.doParticles     = false;
            optionsMenu.scrollable.AddRow(difficultyToggle.gameObject);

            var extraHeader = optionsMenu.AddHeader(0, "Extra");

            optionsMenu.scrollable.AddRow(extraHeader);

            string curatedFilterText = "Curated only: " + curated.ToString();

            curatedToggle = optionsMenu.AddButton
                                (0,
                                curatedFilterText,
                                new Action(() =>
            {
                if (curated)
                {
                    curated = false;
                }
                else
                {
                    curated = true;
                }

                curatedToggle.label.text = "Curated only: " + curated.ToString();
                SongBrowser.page         = 1;
                SongBrowser.StartSongSearch();
            }),
                                null,
                                "Filters the search to curated maps only");
            curatedToggle.button.doMeshExplosion = false;
            curatedToggle.button.doParticles     = false;
            optionsMenu.scrollable.AddRow(curatedToggle.gameObject);

            var downloadFullPage = optionsMenu.AddButton
                                       (1,
                                       "Download current page",
                                       new Action(() =>
            {
                DownloadFullPage();
            }),
                                       null,
                                       "Downloads all songs from the current page, this will cause major stutters");

            var RestoreSongs = optionsMenu.AddButton
                                   (0,
                                   "Restore Deleted Songs",
                                   new Action(() =>
            {
                SongBrowser.RestoreDeletedSongs();
            }),
                                   null,
                                   "Restores all the songs you have deleted.");
            //optionsMenu.scrollable.AddRow(RestoreSongs.gameObject);

            string popularityFilterText = "Sort by playcount: " + popularity.ToString();

            popularityToggle = optionsMenu.AddButton
                                   (1,
                                   popularityFilterText,
                                   new Action(() =>
            {
                if (popularity)
                {
                    popularity = false;
                }
                else
                {
                    popularity = true;
                }

                popularityToggle.label.text = "Sort by playcount: " + popularity.ToString();
                SongBrowser.page            = 1;
                SongBrowser.StartSongSearch();
            }),
                                   null,
                                   "Sorts downloads by leaderboard scores rather than date.");
            popularityToggle.button.doMeshExplosion = false;
            popularityToggle.button.doParticles     = false;
            optionsMenu.scrollable.AddRow(popularityToggle.gameObject);

            var downloadFolderBlock = optionsMenu.AddTextBlock(0, "You can hotload songs by placing them in Audica/Downloads and pressing F5");

            optionsMenu.scrollable.AddRow(downloadFolderBlock);
        }
Exemplo n.º 6
0
        private static void CreateSongItem(Song song, OptionsMenu optionsMenu)
        {
            var row = new Il2CppSystem.Collections.Generic.List <GameObject>();

            var textBlock = optionsMenu.AddTextBlock(0, song.title + " - " + song.artist + " (mapped by " + song.author + ")");
            var TMP       = textBlock.transform.GetChild(0).GetComponent <TextMeshPro>();

            TMP.fontSizeMax = 32;
            TMP.fontSizeMin = 8;
            optionsMenu.scrollable.AddRow(textBlock.gameObject);

            //package data to be used for display
            SongBrowser.SongDisplayPackage songd = new SongBrowser.SongDisplayPackage();

            songd.hasEasy     = song.beginner;
            songd.hasStandard = song.standard;
            songd.hasAdvanced = song.advanced;
            songd.hasExpert   = song.expert;

            //if song data loader is installed look for custom tags
            if (SongBrowser.songDataLoaderInstalled)
            {
                songd = SongBrowser.SongDisplayPackage.FillCustomData(songd, song.song_id);
            }

            songd.customExpertTags   = songd.customExpertTags.Distinct().ToList();
            songd.customStandardTags = songd.customStandardTags.Distinct().ToList();
            songd.customAdvancedTags = songd.customAdvancedTags.Distinct().ToList();
            songd.customEasyTags     = songd.customEasyTags.Distinct().ToList();

            bool   destroyOnShot = true;
            Action onHit         = new Action(() => {
                OnDownloadStart(song);
                MelonCoroutines.Start(SongDownloader.DownloadSong(song.song_id, song.download_url, (songID, success) => { OnDownloadDone(song, success); }));
                KataConfig.I.CreateDebugText("Downloading...", new Vector3(0f, -1f, 5f), 5f, null, false, 0.2f);
            });
            string label        = "Download" + SongBrowser.GetDifficultyString(songd);
            float  alpha        = 1f;
            bool   interactable = true;

            string[] splitURL   = song.download_url.Split('/');
            string   audicaName = splitURL[splitURL.Length - 1];

            if (SongLoadingManager.songFilenames.Contains(song.filename) || SongDownloader.downloadedFileNames.Contains(song.filename) ||
                SongDownloader.failedDownloads.Contains(song.filename))
            {
                if (SongDownloader.failedDownloads.Contains(song.filename))
                {
                    label = "Download unavailable";
                }
                else
                {
                    label = "Downloaded!";
                }

                destroyOnShot = false;
                onHit         = new Action(() => { });
                alpha         = 0.25f;
                interactable  = false;
            }

            var downloadButton = optionsMenu.AddButton(0,
                                                       label,
                                                       onHit,
                                                       null,
                                                       null);

            downloadButton.button.SetInteractable(interactable);
            downloadButton.button.destroyOnShot   = destroyOnShot;
            downloadButton.button.doMeshExplosion = destroyOnShot;
            downloadButton.label.alpha            = alpha;

            downloadButtons.Add(song, downloadButton);

            row.Add(downloadButton.gameObject);

            var previewButton = optionsMenu.AddButton(1,
                                                      "Preview",
                                                      new Action(() => { MelonCoroutines.Start(SongDownloader.StreamPreviewSong(song.preview_url)); }),
                                                      null,
                                                      null);

            row.Add(previewButton.gameObject);


            optionsMenu.scrollable.AddRow(row);
        }
Exemplo n.º 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);
        }
Exemplo n.º 8
0
        private static void AddButtons(OptionsMenu optionsMenu)
        {
            optionsMenu.AddHeader(0, "Skybox controls");

            var RotationSlider = optionsMenu.AddSlider(0, "Skybox Rotation", "P",
                                                       new Action <float>(x => { ArenaLoaderMod.RotateSkybox(x * 5); }),
                                                       null);

            RotationSlider.label.text = "Rotation";

            var ExposureSlider = optionsMenu.AddSlider(1, "Skybox Exposure", "P",
                                                       new Action <float>(x => { ArenaLoaderMod.ChangeExposure(x * 0.05f); }),
                                                       null);

            ExposureSlider.label.text = "Brightness";

            var ReflectionSlider = optionsMenu.AddSlider(0, "Skybox Reflection", "P",
                                                         new Action <float>(x => { ArenaLoaderMod.ChangeReflectionStrength(x * 0.05f); }),
                                                         null);

            ReflectionSlider.label.text = "Reflection";

            optionsMenu.AddTextBlock(0, "These settings will reset when you enter a new arena. A way to save current arena settings will be added in a future update");

            optionsMenu.AddHeader(0, "Custom skybox");
            OptionsMenuSlider skyboxSlider = optionsMenu.AddSlider(0, "Custom Skybox", null, new Action <float>((amount) => { ArenaLoaderMod.skyboxLoader.Index += (int)amount; }), new Func <float>(() => { return((float)ArenaLoaderMod.skyboxLoader.Index); }), new Action(() => { ArenaLoaderMod.skyboxLoader.Index = 0; }), "Skybox to load", new Func <float, string>((amount) =>
            {
                if (ArenaLoaderMod.skyboxLoader.skyboxes.Count == 0)
                {
                    return("Skybox folder is empty");
                }
                Material currentSkybox = ArenaLoaderMod.skyboxLoader.skyboxes[ArenaLoaderMod.skyboxLoader.Index];
                if (currentSkybox != null)
                {
                    return(currentSkybox.name);
                }
                else
                {
                    return("Skybox folder is empty");
                }
            }), optionsMenu.sliderCustomModelPrefab);

            skyboxSlider.transform.Find("reload").gameObject.SetActive(false);             // Disables the reload icon.

            optionsMenu.AddButton(0, "Apply skybox", new Action(() =>
            {
                if (ArenaLoaderMod.skyboxLoader.skyboxes.Count == 0)
                {
                    return;
                }
                var newSkybox = ArenaLoaderMod.skyboxLoader.skyboxes[ArenaLoaderMod.skyboxLoader.Index];
                if (newSkybox != null)
                {
                    ArenaLoaderMod.UpdateSkybox(newSkybox);
                }
            }), null, "Apply the currently selected skybox");

            optionsMenu.AddButton(0, "Reload skybox folder", new Action(() =>
            {
                ArenaLoaderMod.skyboxLoader.LoadSkyboxes();
            }), null, "Deletes the currently loaded skyboxes and reloads the folder.\n<color=red>Only use this for working on skyboxes</color>");
            optionsMenu.AddTextBlock(0, "Create your own custom skyboxes from images in Audica\\Mods\\Arenas\\Skyboxes\nTo reset a custom skybox, load a different arena.");
        }