private static void UpdateButtonEnabled(GunButton button, TextMeshPro text)
 {
     if (Utility.IsCustomSong(SongDataHolder.I.songData.songID))
     {
         button.SetInteractable(true);
         text.alpha = 1.0f;
     }
     else
     {
         button.SetInteractable(false);
         text.alpha = 0.25f;
     }
 }
 public void EnableBackButton()
 {
     if (backButton != null)
     {
         backButton.SetInteractable(true);
         backButtonLabel.text  = "Back";
         backButtonLabel.alpha = 1f;
         backButton            = null;
         backButtonLabel       = null;
     }
 }
        private static void OnDownloadStart(Song song)
        {
            activeDownloadsCount++;

            if (activeDownloadsCount > 0)
            {
                backButton.SetInteractable(false);
                backText.alpha = 0.25f;
                backText.text  = "Waiting...";
            }
            if (downloadButtons.ContainsKey(song))
            {
                downloadButtons[song].button.SetInteractable(false);
                downloadButtons[song].button.destroyOnShot   = false;
                downloadButtons[song].button.doMeshExplosion = false;
                downloadButtons[song].button.onHitEvent      = new UnityEngine.Events.UnityEvent();
                downloadButtons[song].label.alpha            = 0.25f;
                downloadButtons[song].label.text             = "Downloading...";
            }
        }
Exemple #4
0
        public static void CreateRandomSongButton()
        {
            if (randomSongButton != null)
            {
                randomSongButton.SetActive(true);

                if (enabled)
                {
                    randomSongGB.SetInteractable(true);
                }
                else
                {
                    randomSongGB.SetInteractable(false);
                }

                return;
            }

            var backButton = GameObject.Find("menu/ShellPage_Song/page/backParent/back");

            if (backButton == null)
            {
                return;
            }

            randomSongButton = GameObject.Instantiate(backButton, backButton.transform.parent.transform);
            ButtonUtils.InitButton(randomSongButton, "Random Song", new Action(() => { OnRandomSongButtonShot(); }),
                                   randomSongButtonPos, randomSongButtonRot);

            randomSongGB = randomSongButton.GetComponentInChildren <GunButton>();

            if (enabled)
            {
                randomSongGB.SetInteractable(true);
            }
            else
            {
                randomSongGB.SetInteractable(false);
            }
        }
Exemple #5
0
        /// <summary>
        /// Makes sure the Song and Party buttons are only available if there is not currently
        /// an ongoing song search.
        /// </summary>
        public static void UpdateUI()
        {
            if (!Config.SafeSongListReload)
            {
                return;
            }
            if ((!searching || disabled || MenuState.GetState() != MenuState.State.MainPage) && !PlaylistDownloadManager.IsDownloadingMissing)
            {
                return;
            }

            disabled = true;

            if (soloButton == null)
            {
                soloButton      = GameObject.Find("menu/ShellPage_Main/page/ShellPanel_Center/Solo/Button").GetComponent <GunButton>();
                soloButtonLabel = GameObject.Find("menu/ShellPage_Main/page/ShellPanel_Center/Solo/Label").GetComponent <TextMeshPro>();
                GameObject.Destroy(soloButtonLabel.gameObject.GetComponent <Localizer>());
            }
            originalSoloButtonText = soloButtonLabel.text;
            soloButtonLabel.text   = "Loading...";
            soloButton.SetInteractable(false);

            if (!SongBrowser.modSettingsInstalled)
            {
                if (partyButton == null)
                {
                    partyButton      = GameObject.Find("menu/ShellPage_Main/page/ShellPanel_Center/Party/Button").GetComponent <GunButton>();
                    partyButtonLabel = GameObject.Find("menu/ShellPage_Main/page/ShellPanel_Center/Party/Label").GetComponent <TextMeshPro>();
                    GameObject.Destroy(partyButtonLabel.gameObject.GetComponent <Localizer>());
                }
                originalPartyButtonText = partyButtonLabel.text;
                partyButtonLabel.text   = "Loading...";
                partyButton.SetInteractable(false);
            }
        }
 public void DownloadSingleSong(string filename, bool showPopup, GunButton button, TextMeshPro label)
 {
     if (backButton is null && button != null)
     {
         backButton      = button;
         backButtonLabel = label;
         backButton.SetInteractable(false);
         backButtonLabel.text  = "Loading..";
         backButtonLabel.alpha = .25f;
     }
     if (showPopup)
     {
         PlaylistUtil.Popup("Downloading..");
     }
     MelonCoroutines.Start(SongDownloader.DoSongWebSearch(filename, OnWebSearchDone, DifficultyFilter.All, false, 1, false, true));
 }
        public static void UpdateButtonText(bool processing = false)
        {
            TextMeshPro buttonText = null;

            if (SongRequests.hasCompatibleSongBrowser)
            {
                buttonText = GetSongBrowserFilterButtonText();
            }
            else
            {
                if (filterSongRequestsButton == null)
                {
                    return;
                }
                if (filterButtonText == null)
                {
                    filterButtonText = filterSongRequestsButton.GetComponentInChildren <TextMeshPro>();
                }

                buttonText = filterButtonText;
            }

            if (buttonText == null)
            {
                return;
            }

            if (SongRequests.requestList.Count == 0 && SongRequests.missingSongs.Count == 0)
            {
                if (buttonText.text.Contains("=green>"))
                {
                    buttonText.text = buttonText.text.Replace("=green>", "=red>");
                }
                else if (!buttonText.text.Contains("=red>"))
                {
                    buttonText.text = "<color=red>" + buttonText.text + "</color>";
                }
            }
            else
            {
                if (buttonText.text.Contains("=red>"))
                {
                    buttonText.text = buttonText.text.Replace("=red>", "=green>");
                }
                else if (!buttonText.text.Contains("=green>"))
                {
                    buttonText.text = "<color=green>" + buttonText.text + "</color>";
                }
            }

            // update
            if (SongRequests.hasCompatibleSongBrowser && downloadMissingButton != null)
            {
                if (SongRequests.GetActiveWebSearchCount() > 0)
                {
                    downloadButtonText.text = "Processing...";
                    downloadGunButton.SetInteractable(false);
                }
                else if (SongRequests.missingSongs.Count > 0)
                {
                    downloadButtonText.text = $"<color=green>Download {SongRequests.missingSongs.Count} missing song(s)</color>";
                    downloadGunButton.SetInteractable(true);
                }
                else
                {
                    downloadButtonText.text = "No songs missing";
                    downloadGunButton.SetInteractable(false);
                }
            }
        }