public static void GoToWebSearchPage()
        {
            SongDownloader.StartNewSongSearch();

            if (backButton == null)
            {
                var button = GameObject.Find("menu/ShellPage_Settings/page/backParent/back");
                backButton       = button.GetComponentInChildren <GunButton>();
                backText         = button.GetComponentInChildren <TextMeshPro>();
                originalBackText = backText.text;

                UnityEngine.Object.Destroy(button.GetComponentInChildren <Localizer>());
            }

            if (songItemPanel == null)
            {
                secondaryPanel = GameObject.Instantiate(GameObject.Find("ShellPage_Settings"));
                secondaryPanel.SetActive(true);
                secondaryPanel.transform.Rotate(0, -65, 0);
                SpawnSecondaryPanel(secondaryPanel);
            }
            else
            {
                SpawnSecondaryPanel(secondaryPanel);
            }

            primaryMenu.ShowPage(OptionsMenu.Page.Customization);
            CleanUpPage(primaryMenu);
            AddButtons(primaryMenu);
            primaryMenu.screenTitle.text = "Filters";
            Config.UpdateSongCount(SongBrowser.newSongCount);             //User has seen new songs
        }
示例#2
0
 private static void Postfix(StartupLogo __instance, ref StartupLogo.State state)
 {
     if (state == StartupLogo.State.Done)
     {
         SongDownloader.StartNewSongSearch();
         PlaylistManager.OnApplicationStart();
         FilterPanel.OnApplicationStart();
         SongLoadingManager.StartSongListUpdate();
         //PlaylistManager.GetAllApiSongs();
     }
 }
示例#3
0
        public override void OnApplicationStart()
        {
            Config.RegisterConfig();
            mainSongDirectory        = Path.Combine(Application.streamingAssetsPath, "HmxAudioAssets", "songs");
            downloadsDirectory       = Application.dataPath.Replace("Audica_Data", "Downloads");
            deletedDownloadsListPath = Path.Combine(downloadsDirectory, "SongBrowserDownload_DeletedFiles");
            CheckFolderDirectories();

            if (MelonHandler.Mods.Any(it => it.Info.SystemType.Name == nameof(SongDataLoader)))
            {
                songDataLoaderInstalled = true;
                MelonLogger.Msg("Song Data Loader is installed. Enabling integration");
            }
            else
            {
                MelonLogger.Warning("Song Data Loader is not installed. Consider downloading it for the best experience :3");
            }

            if (MelonHandler.Mods.Any(it => it.Info.SystemType.Name == nameof(ModSettings)))
            {
                modSettingsInstalled = true;
            }

            if (MelonHandler.Mods.Any(it => it.Assembly.GetName().Name == "AuthorableModifiers"))
            {
                var scoreVersion           = new Version(MelonHandler.Mods.First(it => it.Assembly.GetName().Name == "AuthorableModifiers").Info.Version);
                var lastUnsupportedVersion = new Version("1.2.4");
                var result = scoreVersion.CompareTo(lastUnsupportedVersion);
                if (result > 0)
                {
                    authorableInstalled = true;
                }
            }

            if (!SongBrowser.emptiedDownloadsFolder)
            {
                Utility.EmptyDownloadsFolder();
            }

            if (!isInitialized && MenuState.sState != MenuState.State.TitleScreen)
            {
                SongDownloader.StartNewSongSearch();
                PlaylistManager.OnApplicationStart();
                FilterPanel.OnApplicationStart();
                SongLoadingManager.StartSongListUpdate();
            }
        }
示例#4
0
            private static bool Prefix(KeyboardEntry __instance, KeyCode keyCode, string label)
            {
                if (SongBrowser.shouldShowKeyboard)
                {
                    if (PlaylistManager.state == PlaylistManager.PlaylistState.Creating)
                    {
                        switch (label)
                        {
                        case "done":
                            __instance.Hide();
                            break;

                        case "clear":
                            PlaylistCreatePanel.newName = "";
                            break;

                        default:
                            PlaylistCreatePanel.newName += label;
                            break;
                        }
                        if (PlaylistCreatePanel.playlistText != null)
                        {
                            PlaylistCreatePanel.playlistText.text = PlaylistCreatePanel.newName;
                        }
                    }

                    if (SongSearch.searchInProgress)
                    {
                        switch (label)
                        {
                        case "done":
                            __instance.Hide();
                            SongBrowser.shouldShowKeyboard = false;
                            SongSearch.OnNewUserSearch();
                            break;

                        case "clear":
                            SongSearch.query = "";
                            break;

                        default:
                            SongSearch.query += label;
                            break;
                        }

                        if (SongSearchScreen.searchText != null)
                        {
                            SongSearchScreen.searchText.text = SongSearch.query;
                        }
                    }
                    else
                    {
                        switch (label)
                        {
                        case "done":
                            __instance.Hide();
                            SongBrowser.shouldShowKeyboard = false;
                            SongDownloader.StartNewSongSearch();
                            break;

                        case "clear":
                            SongDownloader.searchString = "";
                            break;

                        default:
                            SongDownloader.searchString += label;
                            break;
                        }

                        if (SongDownloaderUI.searchText != null)
                        {
                            SongDownloaderUI.searchText.text = SongDownloader.searchString;
                        }
                    }
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        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();
                SongDownloader.StartNewSongSearch();
            }),
                                   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);

            if (!SongDownloader.UseNewAPI)
            {
                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();
                    SongDownloader.StartNewSongSearch();
                }),
                                    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
                                       (SongDownloader.UseNewAPI ? 0 : 1,
                                       "Download current page",
                                       new Action(() =>
            {
                DownloadFullPage();
            }),
                                       null,
                                       "Downloads all songs from the current page, this will cause major stutters");

            if (SongDownloader.UseNewAPI)
            {
                optionsMenu.scrollable.AddRow(downloadFullPage.gameObject);
            }

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

            if (SongDownloader.UseNewAPI)
            {
                string popularityFilterText = "Sort by downloads: " + popularity.ToString();
                popularityToggle = optionsMenu.AddButton
                                       (1,
                                       popularityFilterText,
                                       new Action(() =>
                {
                    if (popularity)
                    {
                        popularity = false;
                    }
                    else
                    {
                        popularity = true;
                    }

                    popularityToggle.label.text = "Sort by downloads: " + popularity.ToString();
                    SongDownloader.StartNewSongSearch();
                }),
                                       null,
                                       "Sorts songs by number of downloads rather than date.");
                popularityToggle.button.doMeshExplosion = false;
                popularityToggle.button.doParticles     = false;
                optionsMenu.scrollable.AddRow(popularityToggle.gameObject);
            }
            else
            {
                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();
                    SongDownloader.StartNewSongSearch();
                }),
                                       null,
                                       "Sorts songs 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);
        }