Ejemplo n.º 1
0
    private static void AddCategories()
    {
        var prefs = MelonPreferences.Categories;

        int buttonIndex = 0;

        Il2CppGeneric.List <GameObject> row = new Il2CppGeneric.List <GameObject>();
        foreach (var category in prefs)
        {
            var categoryButton = modMenuOM.AddButton(buttonIndex % 2,
                                                     AddWhitespace(category.DisplayName),
                                                     new Action(() => { CreateCategoryPage(category); }),
                                                     null,
                                                     "");
            buttonIndex++;
            row.Add(categoryButton.gameObject);
            if (row.Count == 2)
            {
                //This is the dumbest code I've ever wrote.
                Il2CppGeneric.List <GameObject> tempRow = new Il2CppGeneric.List <GameObject>();
                tempRow.Add(row[0]);
                tempRow.Add(row[1]);
                modMenuOM.scrollable.AddRow(tempRow);
                row.Clear();
            }
        }
        if (row.Count == 1) //If the last row is missing a pair, add a row with a single object.
        {
            modMenuOM.scrollable.AddRow(row[0]);
            row.Clear();
        }
    }
Ejemplo n.º 2
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 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);
        }
        private static void AddButtons(OptionsMenu optionsMenu)
        {
            var header = optionsMenu.AddHeader(0, "Marathon Settings");

            optionsMenu.scrollable.AddRow(header);
            string shuffleText = Config.Shuffle ? "<color=\"green\">Shuffle ON" : "<color=\"red\">Shuffle OFF";

            shuffleButton = optionsMenu.AddButton(0, shuffleText, new Action(() =>
            {
                ToggleShuffle();
            }), null, "Shuffles the songs", optionsMenu.buttonPrefab);

            string showScoreText = Config.ShowScores ? "<color=\"green\">Show Score ON" : "<color=\"red\">Show Score OFF";

            showScoreButton = optionsMenu.AddButton(1, showScoreText, new Action(() =>
            {
                ToggleShowScore();
            }), null, "Shows 'Level Complete' at the end of each song", optionsMenu.buttonPrefab);

            string noFailText = Config.NoFail ? "<color=\"green\">NoFail ON" : "<color=\"red\">NoFail OFF";

            noFailButton = optionsMenu.AddButton(0, noFailText, new Action(() =>
            {
                ToggleNoFail();
            }), null, "Play the marathon with NoFail on or off", optionsMenu.buttonPrefab);

            string resetHealthText = Config.ResetHealth ? "<color=\"green\">Reset Health ON" : "<color=\"red\">Reset Health OFF";

            resetHealthButton = optionsMenu.AddButton(1, resetHealthText, new Action(() =>
            {
                ToggleResetHealth();
            }), null, "Reset Health at the end of each song", optionsMenu.buttonPrefab);

            Il2CppSystem.Collections.Generic.List <GameObject> toggles = new Il2CppSystem.Collections.Generic.List <GameObject>();
            toggles.Add(shuffleButton.gameObject);
            toggles.Add(showScoreButton.gameObject);
            optionsMenu.scrollable.AddRow(toggles);
            toggles.Clear();
            toggles.Add(noFailButton.gameObject);
            toggles.Add(resetHealthButton.gameObject);
            optionsMenu.scrollable.AddRow(toggles);
            var divider = optionsMenu.AddHeader(0, "");

            optionsMenu.scrollable.AddRow(divider);
            var start = optionsMenu.AddButton(1, "Start", new Action(() =>
            {
                MelonPreferences.Save();
                PlaylistEndlessManager.StartEndlessSession();
            }), null, "Starts the marathon", optionsMenu.buttonPrefab);

            optionsMenu.scrollable.AddRow(start.gameObject);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
 private static void Postfix(OptionsMenu __instance, OptionsMenu.Page page)
 {
     if (page == OptionsMenu.Page.Calibration)
     {
         var button = __instance.AddButton(0, "Reset SongSettings", new Action(() => { SettingsManager.settings = new List <SavedData>(); }), null, "Resets all of the per song calibration changes you made in the pause menu");
         __instance.scrollable.AddRow(button.gameObject);
     }
 }
Ejemplo n.º 7
0
 static public void AddPageButton(OptionsMenu optionsMenu, int col)
 {
     optionsMenu.AddButton(col, "Download Songs", new System.Action(() => {
         GoToArenaPage(optionsMenu);
         if (songItemPanel != null)
         {
             songItemPanel.SetPageActive(true);
         }
     }), null, "Download new maps from the Audica Modding Discord");
 }
Ejemplo n.º 8
0
        public static void CreateSettingsButton(OptionsMenu optionsMenu)
        {
            string toggleText = "OFF";

            if (config.activated)
            {
                toggleText = "ON";
            }

            optionsMenu.AddHeader(0, "Trippy Menu");

            toggleButton = optionsMenu.AddButton
                               (0,
                               toggleText,
                               new Action(() =>
            {
                if (config.activated)
                {
                    config.activated        = false;
                    playPsychadelia         = false;
                    toggleButton.label.text = "OFF";
                    SaveConfig();
                    GameplayModifiers.I.mPsychedeliaPhase = 0.00000001f;
                    timer = 0;
                }
                else
                {
                    config.activated        = true;
                    playPsychadelia         = true;
                    toggleButton.label.text = "ON";
                    SaveConfig();
                }
            }),
                               null,
                               "Turns Trippy Menu on or off");

            speedSlider = optionsMenu.AddSlider
                          (
                0,
                "Trippy Menu Cycle Speed",
                "P",
                new Action <float>((float n) =>
            {
                config.speed = Mathf.Round((config.speed + n) * 1000.0f) / 1000.0f;
                UpdateSlider(speedSlider, "Speed : " + config.speed.ToString());
            }),
                null,
                null,
                "Changes color cycle speed"
                          );
            speedSlider.label.text = "Speed : " + config.speed.ToString();

            //MelonModLogger.Log("Buttons created");
            menuSpawned = true;
        }
Ejemplo n.º 9
0
 static public void AddPageButton(OptionsMenu optionsMenu, int col)
 {
     primaryMenu = optionsMenu;
     primaryMenu.AddButton(col, "Download Songs", new Action(() => {
         GoToWebSearchPage();
         if (songItemPanel != null)
         {
             songItemPanel.SetPageActive(true);
         }
     }), null, "Download new maps from the Audica Modding Discord");
 }
Ejemplo n.º 10
0
        private static void AddPageButtons(OptionsMenu optionsMenu)
        {
            var row          = new Il2CppSystem.Collections.Generic.List <GameObject>();
            var previousPage = optionsMenu.AddButton(0,
                                                     "Previous Page",
                                                     new Action(() => { SongBrowser.PreviousPage(); SongBrowser.StartSongSearch(); optionsMenu.scrollable.SnapTo(0); }),
                                                     null,
                                                     null);

            row.Add(previousPage.gameObject);

            var nextPage = optionsMenu.AddButton(1,
                                                 "Next Page",
                                                 new Action(() => { SongBrowser.NextPage(); SongBrowser.StartSongSearch(); optionsMenu.scrollable.SnapTo(0); }),
                                                 null,
                                                 null);

            row.Add(nextPage.gameObject);
            optionsMenu.scrollable.AddRow(row);
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
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.");
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
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);
        }
Ejemplo n.º 15
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);
        }
Ejemplo n.º 16
0
        public override void OnUpdate()
        {
            if (MenuState.sState == 0)
            {
                return;
            }

            if (introSkip)
            {
                if (!isPlaying && MenuState.sState == MenuState.State.Launched && AudioDriver.I is AudioDriver)
                {
                    isPlaying = true;
                }

                else if (isPlaying && (MenuState.sState != MenuState.State.Launched || AudioDriver.I is null))
                {
                    isPlaying    = false;
                    introSkipped = false;
                }

                if (isPlaying)
                {
                    if (!skipQueued && !introSkipped && GetCurrentTick() < GetFirstTick() - 3840)
                    {
                        canSkip = true;

                        if (popup is null)
                        {
                            if (button == "")
                            {
                                switch (VRHardwareSetup.I.hardware)
                                {
                                case VRHardwareSetup.VRHardwareMode.Cosmos:
                                    button = "X";
                                    break;

                                case VRHardwareSetup.VRHardwareMode.Knuckles:
                                case VRHardwareSetup.VRHardwareMode.OculusNative:
                                case VRHardwareSetup.VRHardwareMode.OculusOpenVR:
                                    button = "A";
                                    break;

                                case VRHardwareSetup.VRHardwareMode.ViveWand:
                                case VRHardwareSetup.VRHardwareMode.WinMROpenVR:
                                    button = "R Menu Button";
                                    break;

                                case VRHardwareSetup.VRHardwareMode.Unknown:
                                    button = "?";
                                    break;
                                }
                            }
                            popup = KataConfig.I.CreateDebugText("Skip Intro by pressing <color=#85e359>" + button + "</color>", new Vector3(0f, -1f, 5f), 3f, null, false, 0.001f).gameObject;
                        }
                    }
                    else
                    {
                        if (canSkip)
                        {
                            canSkip = false;
                        }
                        if (popup is GameObject)
                        {
                            GameObject.Destroy(popup);
                            popup = null;
                        }
                    }
                }
            }

            if (MenuState.sState == MenuState.State.Launched)
            {
                return;
            }
            if (MenuState.sState != MenuState.State.SettingsPage)
            {
                miscPageFound = false;
            }
            if (MenuState.sState == MenuState.State.SettingsPage && !miscPageFound)
            {
                if (OptionsMenu.I is OptionsMenu)
                {
                    optionMenu = OptionsMenu.I;
                }
                else
                {
                    return;
                }

                if (optionMenu.mPage == OptionsMenu.Page.Misc)
                {
                    miscPageFound = true;
                }


                if (miscPageFound && !menuSpawned)
                {
                    if (optionMenu.mPage == OptionsMenu.Page.Misc)
                    {
                        string toggleText = "OFF";

                        if (introSkip)
                        {
                            toggleText = "ON";
                        }

                        optionMenu.AddHeader(0, "Skip Intro");

                        toggleButton = optionMenu.AddButton
                                           (0,
                                           toggleText,
                                           new Action(() =>
                        {
                            if (introSkip)
                            {
                                introSkip = false;
                                toggleButton.label.text = "OFF";
                                SaveConfig();
                            }
                            else
                            {
                                introSkip = true;
                                toggleButton.label.text = "ON";
                                SaveConfig();
                            }
                        }),
                                           null,
                                           "Enables Intro Skipping");

                        menuSpawned = true;
                    }
                }
                else if (!miscPageFound)
                {
                    menuSpawned = false;
                }
            }
        }
Ejemplo n.º 17
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);
        }
Ejemplo n.º 18
0
 static public void AddArenaCustomizationButton(OptionsMenu optionsMenu, int col)
 {
     optionsMenu.AddButton(col, "Customize Arena", new Action(() => {
         GoToArenaPage(optionsMenu);
     }), null, "Customize your current arena.");
 }