public static void CreateSkipButton(ButtonUtils.ButtonLocation location = ButtonUtils.ButtonLocation.Menu)
        {
            if (PlaylistManager.state != PlaylistManager.PlaylistState.Endless)
            {
                return;
            }
            if (location != ButtonUtils.ButtonLocation.Pause && location != ButtonUtils.ButtonLocation.Failed)
            {
                return;
            }

            string  name          = "InGameUI/ShellPage_EndGameContinue/page/ShellPanel_Center/exit";
            Vector3 localPosition = favButtonInGameUIPosition;
            Vector3 rotation      = favButtonInGameUIRotation;
            Action  listener      = new Action(() => { OnInGameSkipButtonShot(); });

            if (location == ButtonUtils.ButtonLocation.Failed)
            {
                name = "InGameUI/ShellPage_Failed/page/ShellPanel_Center/exit";
            }
            else if (location == ButtonUtils.ButtonLocation.Pause)
            {
                name = "InGameUI/ShellPage_Pause/page/ShellPanel_Center/exit";
            }

            var        refButton = GameObject.Find(name);
            GameObject button    = GameObject.Instantiate(refButton, refButton.transform.parent.transform);

            if (location == ButtonUtils.ButtonLocation.Menu)
            {
                skipButton = button;
            }
            ButtonUtils.InitButton(button, "Skip Song", listener, localPosition, rotation);
        }
示例#2
0
        public static void CreateDeleteButton(ButtonUtils.ButtonLocation location = ButtonUtils.ButtonLocation.Menu)
        {
            // can only reuse the menu button, InGameUI gets recreated each time
            if (location == ButtonUtils.ButtonLocation.Menu && delete != null)
            {
                delete.SetActive(true);
                UpdateButtonEnabled(deleteButton, deleteText);
                return;
            }

            string  name          = "InGameUI/ShellPage_EndGameContinue/page/ShellPanel_Center/exit";
            Vector3 localPosition = delButtonInGameUIPosition;
            Vector3 rotation      = delButtonInGameUIRotation;
            Action  listener      = new Action(() => { OnInGameUIDeleteButtonShot(); });

            if (location == ButtonUtils.ButtonLocation.Failed)
            {
                name = "InGameUI/ShellPage_Failed/page/ShellPanel_Center/exit";
            }
            else if (location == ButtonUtils.ButtonLocation.Pause)
            {
                name = "InGameUI/ShellPage_Pause/page/ShellPanel_Center/exit";
            }
            else if (location == ButtonUtils.ButtonLocation.PracticeModeOver)
            {
                name = "InGameUI/ShellPage_PracticeModeOver/page/ShellPanel_Center/exit";
            }
            else if (location == ButtonUtils.ButtonLocation.Menu)
            {
                name          = "menu/ShellPage_Launch/page/backParent/back";
                listener      = new Action(() => { OnDeleteButtonShot(); });
                localPosition = delButtonMenuPosition;
                rotation      = delButtonMenuRotation;
            }

            var         refButton = GameObject.Find(name);
            GameObject  button    = GameObject.Instantiate(refButton, refButton.transform.parent.transform);
            GunButton   gunButton = button.GetComponentInChildren <GunButton>();
            TextMeshPro tmp       = button.GetComponentInChildren <TextMeshPro>();

            ButtonUtils.InitButton(button, "Delete", listener, localPosition, rotation);

            UpdateButtonEnabled(gunButton, tmp);

            if (location == ButtonUtils.ButtonLocation.Menu)
            {
                delete       = button;
                deleteButton = gunButton;
                deleteText   = tmp;
            }
        }
示例#3
0
        public static void CreatePlaylistButton(ButtonUtils.ButtonLocation location = ButtonUtils.ButtonLocation.Menu)
        {
            if (PlaylistManager.state == PlaylistManager.PlaylistState.Endless)
            {
                return;
            }
            // can only reuse the menu button, InGameUI gets recreated each time
            if (location == ButtonUtils.ButtonLocation.Menu && playlistButton != null)
            {
                UpdateLabel();
                playlistButton.SetActive(true);
                return;
            }

            string  name          = "InGameUI/ShellPage_EndGameContinue/page/ShellPanel_Center/exit";
            Vector3 localPosition = playlistButtonInGameUIPosition;
            Vector3 rotation      = playlistButtonInGameUIRotation;
            Action  listener      = new Action(() => { OnIngamePlaylistButtonShot(); });

            if (location == ButtonUtils.ButtonLocation.Failed)
            {
                name = "InGameUI/ShellPage_Failed/page/ShellPanel_Center/exit";
            }
            else if (location == ButtonUtils.ButtonLocation.Pause)
            {
                name = "InGameUI/ShellPage_Pause/page/ShellPanel_Center/exit";
            }
            else if (location == ButtonUtils.ButtonLocation.PracticeModeOver)
            {
                name = "InGameUI/ShellPage_PracticeModeOver/page/ShellPanel_Center/exit";
            }
            else if (location == ButtonUtils.ButtonLocation.Menu)
            {
                name          = "menu/ShellPage_Launch/page/backParent/back";
                listener      = new Action(() => { OnPlaylistButtonShot(); });
                localPosition = playlistButtonMenuPosition;
                rotation      = playlistButtonMenuRotation;
            }

            var        refButton = GameObject.Find(name);
            GameObject button    = GameObject.Instantiate(refButton, refButton.transform.parent.transform);

            if (location == ButtonUtils.ButtonLocation.Menu)
            {
                playlistButton = button;
            }
            ButtonUtils.InitButton(button, "Add to Playlist", listener, localPosition, rotation);
        }
示例#4
0
        private static IEnumerator CreateButton()
        {
            while (EnvironmentLoader.I.IsSwitching())
            {
                yield return(new WaitForSecondsRealtime(.5f));
            }
            var backButton = GameObject.Find("menu/ShellPage_Song/page/backParent/back");

            if (backButton == null)
            {
                yield break;
            }
            playlistButton = GameObject.Instantiate(backButton, backButton.transform.parent.transform);
            ButtonUtils.InitButton(playlistButton, "Select Playlist", new Action(() => { OnPlaylistButtonShot(); }),
                                   playlistButtonPos, playlistButtonRot);
            playlistButton.SetActive(isActive);
        }
        public static void CreateRandomSongButton()
        {
            if (randomSongButton != null)
            {
                randomSongButton.SetActive(true);
                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);
        }
示例#6
0
        public static void CreateSearchButton()
        {
            if (searchButton != null)
            {
                return;
            }

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

            if (backButton == null)
            {
                return;
            }

            searchButton = GameObject.Instantiate(backButton, backButton.transform.parent.transform);
            ButtonUtils.InitButton(searchButton, "Search", new Action(() => { OnSearchButtonShot(); }),
                                   searchButtonPos, searchButtonRot);
            searchButton.SetActive(isActive);
        }
示例#7
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);
            }
        }
示例#8
0
 private static void UpdateLabel()
 {
     ButtonUtils.UpdateButtonLabel(playlistButton, "Add to Playlist");
 }
示例#9
0
 private static void UpdateLabel()
 {
     ButtonUtils.UpdateButtonLabel(favoriteButton, FindLabel());
 }