Ejemplo n.º 1
0
 private static void Postfix(StartupLoader __instance, ref StartupLoader.State newState)
 {
     if (newState == StartupLoader.State.Complete)
     {
         SongRequests.loadComplete = true;
         SongRequests.ProcessQueue();
     }
 }
Ejemplo n.º 2
0
 private static void Prefix(string msg)
 {
     if (msg.Length > 1)
     {
         if (msg.Substring(0, 1) == "@")
         {
             if (msg.Contains("tmi.twitch.tv PRIVMSG "))
             {
                 SongRequests.ParseCommand(new ParsedTwitchMessage(msg).Message);
             }
         }
     }
 }
        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);
                }
            }
        }