예제 #1
0
        private void CreateOnlineButton()
        {
            _newVersionText           = BeatSaberUI.CreateText(_mainMenuRectTransform, "A new version of the mod\nis available!", new Vector2(18.25f, 30f));
            _newVersionText.fontSize  = 6f;
            _newVersionText.alignment = TextAlignmentOptions.Center;
            _newVersionText.gameObject.SetActive(false);

            _multiplayerButton = BeatSaberUI.CreateUIButton(_mainMenuRectTransform, "SoloFreePlayButton");
            _multiplayerButton.transform.SetParent(Resources.FindObjectsOfTypeAll <Button>().First(x => x.name == "SoloFreePlayButton").transform.parent);
            _multiplayerButton.transform.SetSiblingIndex(2);

            _multiplayerButton.SetButtonText("Online");
            _multiplayerButton.SetButtonIcon(Sprites.onlineIcon);

            _multiplayerButton.onClick.AddListener(delegate()
            {
                try
                {
                    MainFlowCoordinator mainFlow = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First();

                    mainFlow.InvokeMethod("PresentFlowCoordinator", modeSelectionFlowCoordinator, null, false, false);
                }
                catch (Exception e)
                {
                    Misc.Logger.Exception($"Unable to present flow coordinator! Exception: {e}");
                }
            });
        }
예제 #2
0
        /// <summary>
        /// Set the global watermark to show that the player has hmd only custom notes.
        /// </summary>
        public static void CreateWatermark()
        {
            if (_watermarkObject != null)
            {
                return;
            }
            _watermarkObject = new GameObject("CustomNotes Watermark");
            _watermarkObject.transform.localScale = new Vector3(0.05f, 0.05f, 0.05f);
            _watermarkObject.transform.position   = new Vector3(0f, 0.025f, 0.8f);
            _watermarkObject.transform.rotation   = Quaternion.Euler(90, 0, 0);

            Canvas watermarkCanvas = _watermarkObject.AddComponent <Canvas>();

            watermarkCanvas.renderMode = RenderMode.WorldSpace;
            ((RectTransform)watermarkCanvas.transform).sizeDelta = new Vector2(100, 50);

            CurvedCanvasSettings canvasSettings = _watermarkObject.AddComponent <CurvedCanvasSettings>();

            canvasSettings.SetRadius(0f);

            CurvedTextMeshPro text = (CurvedTextMeshPro)BeatSaberUI.CreateText((RectTransform)watermarkCanvas.transform, "Custom Notes Enabled", new Vector2(0, 0));

            text.alignment = TextAlignmentOptions.Center;
            text.color     = new Color(0.95f, 0.95f, 0.95f);

            SetLayer(_watermarkObject, NoteLayer.ThirdPerson);
        }
        protected override void Awake()
        {
            const float OffsetX = 5f;

            CreateViewController("SearchCompactKeyboardViewController");

            ViewController.rectTransform.anchorMin        = new Vector2(0.5f, 0.5f);
            ViewController.rectTransform.anchorMax        = ViewController.rectTransform.anchorMin;
            ViewController.rectTransform.pivot            = ViewController.rectTransform.anchorMin;
            ViewController.rectTransform.anchoredPosition = Vector2.zero;
            ViewController.rectTransform.sizeDelta        = new Vector2(80f, 70f);

            _predictionBar = new GameObject("EnhancedSearchPredictionBar").AddComponent <PredictionBar>();
            _predictionBar.Initialize(ViewController.transform, 3.5f, 19f, -35f, 45f);

            var keyboardGO = new GameObject("EnhancedSearchKeyboard", typeof(CompactSearchKeyboard), typeof(RectTransform));

            var rt = keyboardGO.GetComponent <RectTransform>();

            rt.SetParent(ViewController.transform, false);
            rt.anchorMin        = Vector2.zero;
            rt.anchorMax        = Vector2.one;
            rt.pivot            = new Vector2(0.5f, 0.5f);
            rt.anchoredPosition = new Vector2(OffsetX, 5f);
            rt.sizeDelta        = Vector2.zero;

            _keyboard = keyboardGO.GetComponent <CompactSearchKeyboard>();

            _textDisplayComponent                    = BeatSaberUI.CreateText(ViewController.rectTransform, "", new Vector2(OffsetX, 28f), new Vector2(4f, 4f));
            _textDisplayComponent.fontSize           = 6f;
            _textDisplayComponent.alignment          = TextAlignmentOptions.Center;
            _textDisplayComponent.enableWordWrapping = false;

            base.Awake();
        }
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            if (firstActivation && activationType == ActivationType.AddedToHierarchy)
            {
                _tokensText = BeatSaberUI.CreateText(rectTransform, "Tokens: XX", Vector2.zero);
                _tokensText.rectTransform.anchorMin = new Vector2(0.3f, 0.5f);
                _tokensText.rectTransform.anchorMax = new Vector2(0.3f, 0.5f);
                _tokensText.fontSize = 8f;

                _rankUpButton = BeatSaberUI.CreateUIButton(rectTransform, "QuitButton", () =>
                {
                    var currentTeam = _teams.First(x => x.TeamId == _player.Team);
                    var nextTeam    = _teams.First(x => x.TeamId == currentTeam.NextPromotion);

                    var s = RSA.SignRankRequest(Plugin.UserId, nextTeam.TeamId, false);
#if BETA
                    var n = "SubmitRankRequest";
#else
                    var n = "b";
#endif
                    typeof(Client).InvokeMethod(n, Plugin.UserId, nextTeam.TeamId, "[NOT YET IMPLEMENTED]", false, s, null);
                }, "Rank Up");
                (_rankUpButton.transform as RectTransform).anchorMin        = new Vector2(0.7f, 0.5f);
                (_rankUpButton.transform as RectTransform).anchorMax        = new Vector2(0.7f, 0.5f);
                (_rankUpButton.transform as RectTransform).anchoredPosition = Vector2.zero;
                (_rankUpButton.transform as RectTransform).sizeDelta        = new Vector2(50, 10);
                _rankUpButton.interactable = false;

                UpdateUI();
            }
        }
예제 #5
0
        private void FirstActivation()
        {
            string tipsText = "<size=140%><b>Tips</b><size=110%>\n" +
                              "\n" +
                              "You can load your own trail and name textures into SaberForge! \n " +
                              "Place .png files in /BeatSaber/SaberForgeAssets/UserTextures and follow the naming guide found there. \n" +
                              "\n" +
                              //  "For a live update of the sabers in your hand try installing the Custom Pointers mod by Kylon99.\n" +
                              // "\n" +
                              "For other saber tweaks, such as saber position and trail length, use the Saber Tailor mod.\n"

            ;


            RectTransform verticalLayout = UIFunctions.CreateVerticalLayoutObj(new RectOffset(6, 6, 6, 6), 1, TextAnchor.UpperCenter);

            UIFunctions.SetRect(verticalLayout, transform, new Vector2(0, 1), new Vector2(0, 1), new Vector2(60, -40), new Vector2(120, 80));


            TextMeshProUGUI tips = BeatSaberUI.CreateText(verticalLayout, tipsText, new Vector2(0, 0), new Vector2(120, 80));

            //format
            tips.alignment          = TextAlignmentOptions.Top;
            tips.enableWordWrapping = true;
        }
예제 #6
0
        // Mostly just copying from Deviation Counter
        void Start()
        {
            if (Resources.FindObjectsOfTypeAll <CoreGameHUDController>()?.FirstOrDefault(x => x.isActiveAndEnabled) == null)
            {
                Logger.log.Debug("HUD disabled");
                return;
            }
            StartCoroutine(FindBeatMapObjectManager());
            StartCoroutine(FindScoreController());
            StartCoroutine(FindDifficultyBeatmap());

            gameObject.transform.localScale = Vector3.zero;
            Canvas canvas = gameObject.AddComponent <Canvas>();

            canvas.renderMode = RenderMode.WorldSpace;
            CanvasScaler cs = gameObject.AddComponent <CanvasScaler>();

            cs.scaleFactor          = 10.0f;
            cs.dynamicPixelsPerUnit = 10f;
            gameObject.AddComponent <GraphicRaycaster>();
            gameObject.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 1f);
            gameObject.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 1f);

            _counter           = BeatSaberUI.CreateText(canvas.transform as RectTransform, $"", Vector2.zero);
            _counter.alignment = TextAlignmentOptions.Center;
            _counter.fontSize  = 3f;
            _counter.color     = Color.white;
            _counter.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 1f);
            _counter.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 1f);
            _counter.enableWordWrapping = false;

            _totalNotes = 0;
            _score      = 0;
            _multiplier = 0;
        }
예제 #7
0
        private void Awake()
        {
            _canvas            = gameObject.AddComponent <Canvas>();
            _canvas.renderMode = RenderMode.WorldSpace;

            gameObject.AddComponent <CurvedCanvasSettings>().SetRadius(0f);

            var ct = _canvas.transform;

            ct.position   = Position;
            ct.localScale = Scale;

            if (ct is RectTransform crt)
            {
                crt.sizeDelta = CanvasSize;

                _authorNameText = BeatSaberUI.CreateText(crt, AuthorNameText, AuthorNameFontSize, AuthorNamePosition, HeaderSize);

                _pluginNameText = BeatSaberUI.CreateText(crt, PluginNameText, PluginNameFontSize, PluginNamePosition, HeaderSize);

                _headerText = BeatSaberUI.CreateText(crt, HeaderText, HeaderFontSize, HeaderPosition, HeaderSize);
            }

            _loadingBackg = new GameObject("Background").AddComponent <ImageView>();
            if (_loadingBackg.transform is RectTransform lbrt)
            {
                lbrt.SetParent(_canvas.transform, false);
                lbrt.sizeDelta = LoadingBarSize;
            }

            _loadingBackg.color = BackgroundColor;

            gameObject.SetActive(false);
        }
예제 #8
0
        private void Start()
        {
            pauseCanvas    = Resources.FindObjectsOfTypeAll <Transform>().First(x => x.name == "PauseMenu").GetComponentsInChildren <RectTransform>(true).First(x => x.name == "Canvas");
            text           = BeatSaberUI.CreateText(pauseCanvas, "", new Vector2(0f, 35f));
            text.fontSize  = 5f;
            text.alignment = TextAlignmentOptions.Center;
            if (Plugin.AutoPauseConfig.GetBool("Main", "LowSense", false, true))
            {
                flagvalue = 3;
                timevalue = .3f;
            }
            if (Plugin.AutoPauseConfig.GetBool("Main", "SensiMain", true, true))
            {
                flagvalue = 2;
                timevalue = .25f;
            }
            if (Plugin.AutoPauseConfig.GetBool("Main", "SensiRed", false, true))
            {
                flagvalue = 1;
                timevalue = .15f;
            }

            CreateImage();
            InvokeRepeating("TrackingScan", 1.0f, timevalue);
        }
예제 #9
0
        private void FirstActivation()
        {
            RectTransform container = new GameObject("AvatarSettingsContainer", typeof(RectTransform)).transform as RectTransform;

            container.SetParent(rectTransform, false);
            container.anchorMin = new Vector2(0.05f, 0.0f);
            container.anchorMax = new Vector2(0.95f, 1.0f);
            container.sizeDelta = new Vector2(0, 0);

            System.Action <RectTransform, float, float, float, float, float> relative_layout =
                (RectTransform rt, float x, float y, float w, float h, float pivotx) =>
            {
                rt.anchorMin        = new Vector2(x, y);
                rt.anchorMax        = new Vector2(x + w, y + h);
                rt.pivot            = new Vector2(pivotx, 1f);
                rt.sizeDelta        = Vector2.zero;
                rt.anchoredPosition = Vector2.zero;
            };

            TextMeshProUGUI text = BeatSaberUI.CreateText(container, "Preview", Vector2.zero);

            text.fontSize  = 6.0f;
            text.alignment = TextAlignmentOptions.Center;
            relative_layout(text.rectTransform, 0f, 0.85f, 1f, 0.166f, 0.5f);
        }
        protected override void DidActivate(bool firstActivation, ActivationType type)
        {
            if (type == ActivationType.AddedToHierarchy && firstActivation)
            {
                _customKeyboardGO = Instantiate(Resources.FindObjectsOfTypeAll <UIKeyboard>().First(x => x.name != "CustomUIKeyboard"), rectTransform, false).gameObject;

                Destroy(_customKeyboardGO.GetComponent <UIKeyboard>());
                _customKeyboard = _customKeyboardGO.AddComponent <CustomUIKeyboard>();

                _customKeyboard.textKeyWasPressedEvent      += delegate(char input) { inputString += input; UpdateInputText(); };
                _customKeyboard.deleteButtonWasPressedEvent += delegate() { inputString = inputString.Substring(0, inputString.Length - 1); UpdateInputText(); };
                _customKeyboard.cancelButtonWasPressedEvent += () => { backButtonPressed?.Invoke(); };
                _customKeyboard.okButtonWasPressedEvent     += () => { enterButtonPressed?.Invoke(inputString); };

                _inputText           = BeatSaberUI.CreateText(rectTransform, "", new Vector2(0f, 22f));
                _inputText.alignment = TextAlignmentOptions.Center;
                _inputText.fontSize  = 6f;

                UpdateInputText();
            }
            else
            {
                inputString          = "";
                _inputText.alignment = TextAlignmentOptions.Center;
                UpdateInputText();
            }
        }
예제 #11
0
        private void Awake()
        {
            gameObject.transform.position    = Position;
            gameObject.transform.eulerAngles = Rotation;
            gameObject.transform.localScale  = Scale;

            _canvas            = gameObject.AddComponent <Canvas>();
            _canvas.renderMode = RenderMode.WorldSpace;
            _canvas.enabled    = false;
            var rectTransform = _canvas.transform as RectTransform;

            rectTransform.sizeDelta = CanvasSize;

            _authorNameText = BeatSaberUI.CreateText(_canvas.transform as RectTransform, AuthorNameText, AuthorNameFontSize, AuthorNamePosition, HeaderSize);

            _pluginNameText = BeatSaberUI.CreateText(_canvas.transform as RectTransform, PluginNameText, PluginNameFontSize, PluginNamePosition, HeaderSize);

            _headerText = BeatSaberUI.CreateText(_canvas.transform as RectTransform, HeaderText, HeaderFontSize, HeaderPosition, HeaderSize);

            _loadingBackg = new GameObject("Background").AddComponent <Image>();
            rectTransform = _loadingBackg.transform as RectTransform;
            rectTransform.SetParent(_canvas.transform, false);
            rectTransform.sizeDelta = LoadingBarSize;
            _loadingBackg.color     = BackgroundColor;

            DontDestroyOnLoad(gameObject);
        }
예제 #12
0
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            if (firstActivation)
            {
                foreach (string path in _dllPaths)
                {
                    if (!File.Exists(path))
                    {
                        _filesMising         = true;
                        _missingFilesString += "\n" + path;
                    }
                }

                if (_filesMising)
                {
                    _missingFilesText           = BeatSaberUI.CreateText(rectTransform, _missingFilesString, new Vector2(0f, 0f));
                    _missingFilesText.alignment = TextAlignmentOptions.Center;
                    _missingFilesText.color     = Color.red;
                    _missingFilesText.fontSize  = 6f;
                }
                else
                {
                    _roomsButton = BeatSaberUI.CreateUIButton(rectTransform, "SoloFreePlayButton", new Vector2(-40f, 10f), () => { didSelectRooms?.Invoke(); }, "ROOMS");
                    Destroy(_roomsButton.GetComponentInChildren <HoverHint>());
                    _roomsButton.SetButtonIcon(Sprites.roomsIcon);

                    _radioButton = BeatSaberUI.CreateUIButton(rectTransform, "SoloFreePlayButton", new Vector2(10f, 10f), () => { didSelectRadio?.Invoke(); }, "RADIO");
                    Destroy(_radioButton.GetComponentInChildren <HoverHint>());
                    _radioButton.SetButtonIcon(Sprites.radioIcon);
                }
            }
        }
예제 #13
0
        private void CreateOnlineButton()
        {
            _newVersionText             = BeatSaberUI.CreateText(_mainMenuRectTransform, "A new version of the mod\nis available!", new Vector2(55.5f, 33f));
            _newVersionText.fontSize    = 5f;
            _newVersionText.lineSpacing = -52;
            _newVersionText.gameObject.SetActive(false);

            Button[] mainButtons = Resources.FindObjectsOfTypeAll <RectTransform>().First(x => x.name == "MainButtons" && x.parent.name == "MainMenuViewController").GetComponentsInChildren <Button>();

            foreach (var item in mainButtons)
            {
                (item.transform as RectTransform).sizeDelta = new Vector2(35f, 30f);
            }

            _multiplayerButton = BeatSaberUI.CreateUIButton(_mainMenuRectTransform, "CampaignButton");
            _multiplayerButton.transform.SetParent(mainButtons.First(x => x.name == "CampaignButton").transform.parent);
            _multiplayerButton.transform.SetSiblingIndex(3);

            _multiplayerButton.SetButtonText("Online");
            _multiplayerButton.SetButtonIcon(Sprites.onlineIcon);

            _multiplayerButton.onClick.AddListener(delegate()
            {
                try
                {
                    MainFlowCoordinator mainFlow = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First();

                    mainFlow.InvokeMethod("PresentFlowCoordinator", modeSelectionFlowCoordinator, null, false, false);
                }
                catch (Exception e)
                {
                    Misc.Logger.Exception($"Unable to present flow coordinator! Exception: {e}");
                }
            });
        }
 public static void UpdateSettings <T>(T settings, SettingsInfo info) where T : ConfigModel
 {
     try
     {
         if (!(settings is null))
         {
             MockCounter.Highlight(settings);
         }
         ClearScreen();
         if (!(info is null))
         {
             if (info.IsCustom)
             {
                 CreateBase(settings, (settings as CustomConfigModel).RestrictedPositions);
             }
             else
             {
                 SubMenu sub = CreateBase(settings);
                 AdvancedCounterSettings.counterUIItems[settings](sub, settings);
             }
         }
         Instance.SelectedSettingsInfo = info;
         Instance.SelectedConfigModel  = settings;
         settingsTitle           = BeatSaberUI.CreateText(rect, $"{settings.DisplayName} Settings", Vector2.zero);
         settingsTitle.fontSize  = 6;
         settingsTitle.alignment = TextAlignmentOptions.Center;
         SetPositioning(settingsTitle.rectTransform, 0, 0.85f, 1, 0.166f, 0.5f);
         LoadedElements.Add(settingsTitle.gameObject);
         InitSettings();
     }
     catch (Exception e) { Plugin.Log(e.ToString(), LogInfo.Fatal, "Go to the Counters+ GitHub and open an Issue. This shouldn't happen!"); }
 }
예제 #15
0
        private void CreateText()
        {
            if (loadingText == null && _identifierText == null && _nameText == null && _accountStatus == null && _rankPointsText == null && _rankText == null && _roleText == null && _randomText == null)
            {
                loadingText           = BeatSaberUI.CreateText(rectTransform, "", new Vector2(15, 0));
                loadingText.alignment = TextAlignmentOptions.Center;

                _identifierText           = BeatSaberUI.CreateText(rectTransform, "", new Vector2(27, 26));
                _identifierText.alignment = TextAlignmentOptions.BaselineLeft;
                _nameText                 = BeatSaberUI.CreateText(rectTransform, "", new Vector2(27, 20));
                _nameText.alignment       = TextAlignmentOptions.BaselineLeft;
                _accountStatus            = BeatSaberUI.CreateText(rectTransform, "", new Vector2(27, 14));
                _accountStatus.alignment  = TextAlignmentOptions.BaselineLeft;
                _rankPointsText           = BeatSaberUI.CreateText(rectTransform, "", new Vector2(27, 8));
                _rankPointsText.alignment = TextAlignmentOptions.BaselineLeft;
                _rankText                 = BeatSaberUI.CreateText(rectTransform, "", new Vector2(27, 2));
                _rankText.alignment       = TextAlignmentOptions.BaselineLeft;
                _roleText                 = BeatSaberUI.CreateText(rectTransform, "", new Vector2(27, -4));
                _roleText.alignment       = TextAlignmentOptions.BaselineLeft;

                _randomText           = BeatSaberUI.CreateText(rectTransform, "", new Vector2(0, -23));
                _randomText.alignment = TextAlignmentOptions.Center;
            }

            _loadingIndicator.SetActive(false);
            //FakeData();
            CreateButtons();
        }
        public void Init(ModInfoViewController controller)
        {
            this.controller = controller;

            var rectTransform = transform as RectTransform;

            rectTransform.sizeDelta = new Vector2(60f, 10f);

            titleText                   = BeatSaberUI.CreateText(rectTransform, $"{controller.Name} <size=60%>{controller.Version}", new Vector2(11f, 27.5f));
            titleText.fontSize          = 6f;
            authorText                  = BeatSaberUI.CreateText(rectTransform, controller.Author, new Vector2(11f, 22f));
            authorText.fontSize         = 4.5f;
            descText                    = BeatSaberUI.CreateText(rectTransform, controller.Description, new Vector2(-4.5f, 12f));
            descText.fontSize           = 3.5f;
            descText.enableWordWrapping = true;
            descText.overflowMode       = TextOverflowModes.ScrollRect;

            icon = new GameObject("Mod Info View Icon", typeof(RectTransform)).AddComponent <Image>();
            icon.gameObject.SetActive(false);
            icon.rectTransform.SetParent(rectTransform, false);
            icon.rectTransform.anchorMin        = new Vector2(0.5f, 0.44f);
            icon.rectTransform.anchorMax        = new Vector2(0.5f, 0.5f);
            icon.rectTransform.sizeDelta        = new Vector2(60f, 10f);
            icon.rectTransform.anchoredPosition = new Vector2(-27.8f, 27.3f);
            icon.sprite         = controller.Icon;
            icon.preserveAspect = true;
            icon.useSpriteMesh  = true;
            icon.material       = UIUtilities.NoGlowMaterial;
            icon.gameObject.SetActive(true);
        }
        protected override void DidActivate(bool firstActivation, ActivationType type)
        {
            if (firstActivation && type == ActivationType.AddedToHierarchy)
            {
                SongDownloader.Instance.songDownloaded -= SongDownloaded;
                SongDownloader.Instance.songDownloaded += SongDownloaded;
                _songListTableCellInstance              = Resources.FindObjectsOfTypeAll <LevelListTableCell>().First(x => (x.name == "LevelListTableCell"));

                _titleText           = BeatSaberUI.CreateText(rectTransform, "DOWNLOAD QUEUE", new Vector2(0f, 35f));
                _titleText.alignment = TextAlignmentOptions.Top;
                _titleText.fontSize  = 6f;

                _pageUpButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().Last(x => (x.name == "PageUpButton")), rectTransform, false);
                (_pageUpButton.transform as RectTransform).anchorMin        = new Vector2(0.5f, 1f);
                (_pageUpButton.transform as RectTransform).anchorMax        = new Vector2(0.5f, 1f);
                (_pageUpButton.transform as RectTransform).anchoredPosition = new Vector2(0f, -14f);
                (_pageUpButton.transform as RectTransform).sizeDelta        = new Vector2(40f, 10f);
                _pageUpButton.interactable = true;
                _pageUpButton.onClick.AddListener(delegate()
                {
                    _queuedSongsTableView.PageScrollUp();
                });

                _pageDownButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().Last(x => (x.name == "PageDownButton")), rectTransform, false);
                (_pageDownButton.transform as RectTransform).anchorMin        = new Vector2(0.5f, 0f);
                (_pageDownButton.transform as RectTransform).anchorMax        = new Vector2(0.5f, 0f);
                (_pageDownButton.transform as RectTransform).anchoredPosition = new Vector2(0f, 8f);
                (_pageDownButton.transform as RectTransform).sizeDelta        = new Vector2(40f, 10f);
                _pageDownButton.interactable = true;
                _pageDownButton.onClick.AddListener(delegate()
                {
                    _queuedSongsTableView.PageScrollDown();
                });

                _queuedSongsTableView = new GameObject().AddComponent <TableView>();
                _queuedSongsTableView.transform.SetParent(rectTransform, false);

                _queuedSongsTableView.SetPrivateField("_isInitialized", false);
                _queuedSongsTableView.SetPrivateField("_preallocatedCells", new TableView.CellsGroup[0]);
                _queuedSongsTableView.Init();

                RectMask2D viewportMask = Instantiate(Resources.FindObjectsOfTypeAll <RectMask2D>().First(), _queuedSongsTableView.transform, false);
                viewportMask.transform.DetachChildren();
                _queuedSongsTableView.GetComponentsInChildren <RectTransform>().First(x => x.name == "Content").transform.SetParent(viewportMask.rectTransform, false);

                (_queuedSongsTableView.transform as RectTransform).anchorMin        = new Vector2(0.3f, 0.5f);
                (_queuedSongsTableView.transform as RectTransform).anchorMax        = new Vector2(0.7f, 0.5f);
                (_queuedSongsTableView.transform as RectTransform).sizeDelta        = new Vector2(0f, 60f);
                (_queuedSongsTableView.transform as RectTransform).anchoredPosition = new Vector3(0f, -3f);

                ReflectionUtil.SetPrivateField(_queuedSongsTableView, "_pageUpButton", _pageUpButton);
                ReflectionUtil.SetPrivateField(_queuedSongsTableView, "_pageDownButton", _pageDownButton);

                _queuedSongsTableView.selectionType = TableViewSelectionType.None;
                _queuedSongsTableView.dataSource    = this;

                _abortButton = BeatSaberUI.CreateUIButton(rectTransform, "CreditsButton", new Vector2(36f, -30f), new Vector2(20f, 10f), AbortDownloads, "Abort All");
                _abortButton.ToggleWordWrapping(false);
            }
        }
예제 #18
0
        private void FirstActivation()
        {
            string creditsText = "<b><size=140%>Developed by Frost Dragon</b> <size=100%>\n " +
                                 "\n" +
                                 "This mod would not be possible without the assitance of - \n" +
                                 "\n" +
                                 "The <b>Beat Saber Modding Group Discord</b> and <b>British Beat Saber Discord</b>.\n" +
                                 "The developers of BSIPA, BS Utils, CustomUI, Custom Sabers.\n " +
                                 "\n" +
                                 "With special thanks to community members -  \n" +
                                 "\n" +
                                 "Wolven "
            ;


            RectTransform verticalLayout = UIFunctions.CreateVerticalLayoutObj(new RectOffset(6, 6, 6, 6), 1, TextAnchor.UpperCenter);

            UIFunctions.SetRect(verticalLayout, transform, new Vector2(0, 1), new Vector2(0, 1), new Vector2(60, -40), new Vector2(120, 80));


            TextMeshProUGUI credits = BeatSaberUI.CreateText(verticalLayout, creditsText, new Vector2(0, 0), new Vector2(120, 80));

            //format
            credits.alignment          = TextAlignmentOptions.Top;
            credits.enableWordWrapping = true;
        }
예제 #19
0
        private Toggle CreateToggleControl(RectTransform parent, string label, int index, Toggle prefab, bool createDivider = true)
        {
            var text = BeatSaberUI.CreateText(parent, label, new Vector2(4f, -9.5f - (10f * index)), new Vector2(30f, 10f));

            text.fontSize = 5f;

            var rt = text.rectTransform;

            rt.anchorMin = new Vector2(0f, 1f);
            rt.anchorMax = new Vector2(0f, 1f);
            rt.pivot     = new Vector2(0f, 1f);

            var toggle = Utilities.CreateToggleFromPrefab(prefab, parent);

            rt                  = toggle.transform as RectTransform;
            rt.anchorMin        = Vector2.one;
            rt.anchorMax        = Vector2.one;
            rt.pivot            = new Vector2(1f, 0.5f);
            rt.sizeDelta        = new Vector2(6f, 6f);
            rt.anchoredPosition = new Vector2(-6f, -13f - (10f * index));

            if (createDivider)
            {
                var divider = Utilities.CreateHorizontalDivider(parent, 0f, false);
                divider.rectTransform.anchoredPosition = new Vector2(0f, -18f - (10f * index));
            }

            return(toggle);
        }
예제 #20
0
        public async void AddWeatherInfoMenu()
        {
            forecast.spacing = 0.01f;
            if (PluginConfig.Instance.showCityName)
            {
                var Header = BeatSaberUI.CreateText((RectTransform)forecast.transform, PluginConfig.Instance.WeatherFinder.cityName, Vector2.zero);
                Header.color     = Color.cyan;
                Header.fontSize  = 12f;
                Header.alignment = TMPro.TextAlignmentOptions.Center;
                ContentSizeFitter fitter = Header.gameObject.AddComponent <ContentSizeFitter>();
                fitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
                fitter.verticalFit   = ContentSizeFitter.FitMode.PreferredSize;
            }
            WeatherDataRoot weatherInfo = await WeatherFinder.GetWeatherData();

            for (int i = 0; i < weatherInfo.weather.Length; i++)
            {
                WeatherData data        = weatherInfo.weather[i];
                GameObject  forecastObj = new GameObject("ForecastObject");
                forecastObj.transform.SetParent(forecast.transform);
                HorizontalLayoutGroup horiz = forecastObj.AddComponent <HorizontalLayoutGroup>();
                horiz.childAlignment = TextAnchor.MiddleCenter;
                var text = BeatSaberUI.CreateText((RectTransform)forecastObj.transform, data.main + "    -    " + data.description, Vector2.zero);
                text.fontSize  = 0.2f;
                text.alignment = TMPro.TextAlignmentOptions.Center;
                forecastObj.transform.localPosition = Vector3.zero;
            }
        }
예제 #21
0
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            if (firstActivation)
            {
                _timerText           = BeatSaberUI.CreateText(rectTransform, "0:30", new Vector2(0f, 35f));
                _timerText.alignment = TextAlignmentOptions.Top;
                _timerText.fontSize  = 8f;

                RectTransform resultsRectTransform = Resources.FindObjectsOfTypeAll <RectTransform>().First(x => x.name == "StandardLevelResultsViewController");
                Instantiate(resultsRectTransform.GetComponentsInChildren <RectTransform>().First(x => x.name == "Cleared"), rectTransform);

                _songNameText   = GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "SongNameText");
                _scoreText      = GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "ScoreText");
                _difficultyText = GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "DifficultyText");
                _rankText       = GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "RankText");
                _goodCutsText   = GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "GoodCutsText");
                _fullComboText  = GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "FullComboText");
                Destroy(GetComponentsInChildren <RectTransform>().First(x => x.name == "HeaderPanel").gameObject);
                Destroy(GetComponentsInChildren <RectTransform>().First(x => x.name == "NewHighScoreText").gameObject);

                if (IllusionInjector.PluginManager.Plugins.Any(x => x.Name == "BeatSaver Downloader"))
                {
                    _favButton = this.CreateUIButton("PracticeButton", new Vector2(65f, 25f), null, "", Sprites.addToFavorites);

                    _upvoteButton         = this.CreateUIButton("PracticeButton", new Vector2(65f, 10f), null, "", Sprites.thumbUp);
                    _downvoteButton       = this.CreateUIButton("PracticeButton", new Vector2(65f, -10f), null, "", Sprites.thumbDown);
                    _ratingText           = this.CreateText("LOADING...", new Vector2(65f, 0f));
                    _ratingText.alignment = TextAlignmentOptions.Center;
                    _ratingText.fontSize  = 7f;
                }
            }
        }
        private void PrepareWarningText()
        {
            _peakWarningGo = new GameObject("DiffWarningCanvas");
            var canvas = _peakWarningGo.AddComponent <Canvas>();

            canvas.renderMode = RenderMode.WorldSpace;

            _peakWarningGo.AddComponent <CurvedCanvasSettings>().SetRadius(0f);

            var ct = canvas.transform;

            ct.position    = new Vector3(0, 2.25f, 3.5f);
            ct.localScale /= 100;

            if (ct is RectTransform crt)
            {
                crt.sizeDelta = new Vector2(140, 50);

                _text           = BeatSaberUI.CreateText <TextMeshProUGUI>(crt, string.Empty, Vector2.zero);
                _text.alignment = TextAlignmentOptions.Center;
                _text.fontSize  = 16f;
                _text.alpha     = 0f;
            }

            _peakWarningGo.SetActive(false);

            _timeTillPeak = _audioTimeSyncController.songLength;
        }
예제 #23
0
        public void CreateTextOld()
        {
            Logger.log?.Debug("Font found, creating text.");
            GameObject gameObject = this.gameObject;//new GameObject();

            //UnityEngine.Object.DontDestroyOnLoad(gameObject);
            gameObject.transform.position    = new Vector3(0f, 1f, 1.5f);
            gameObject.transform.eulerAngles = new Vector3(0f, 0f, 0f);
            gameObject.transform.localScale  = new Vector3(0.01f, 0.01f, 0.01f);
            Canvas    canvas  = gameObject.AddComponent <Canvas>();
            Texture2D texture = new Texture2D(1, 1);

            texture.SetPixel(0, 0, Color.red);
            texture.wrapMode = TextureWrapMode.Repeat;
            texture.Apply();

            canvas.renderMode = UnityEngine.RenderMode.WorldSpace;
            (canvas.transform as RectTransform).sizeDelta = new Vector2(200f, 50f);
            var thing = canvas.transform as RectTransform;

            Logger.log?.Info($"FloatingText AnchorMin: {Vector2ToString(thing.anchorMin)}, AnchorMax: {Vector2ToString(thing.anchorMax)}");
            TextMeshProUGUI textMeshProUGUI = BeatSaberUI.CreateText(canvas.transform as RectTransform, _displayedText, new Vector2(0f, -20f), new Vector2(400f, 20f));
            var             thing2          = textMeshProUGUI.rectTransform;

            Logger.log?.Info($"FloatingText AnchorMin: {Vector2ToString(thing2.anchorMin)}, AnchorMax: {Vector2ToString(thing2.anchorMax)}");
            textMeshProUGUI.text      = DisplayedText;
            textMeshProUGUI.fontSize  = 10f;
            textMeshProUGUI.alignment = TextAlignmentOptions.Center;
            Logger.log?.Debug($"FloatingText {this.gameObject.name ?? ""} created.");
        }
        internal static void ShowMainSettings()
        {
            ClearScreen();
            MockCounter.Highlight <ConfigModel>(null);
            settingsTitle           = BeatSaberUI.CreateText(rect, "Main Settings", Vector2.zero);
            settingsTitle.fontSize  = 6;
            settingsTitle.alignment = TextAlignmentOptions.Center;
            SetPositioning(settingsTitle.rectTransform, 0, 0.85f, 1, 0.166f, 0.5f);
            LoadedElements.Add(settingsTitle.gameObject);

            SubMenu sub     = new SubMenu(rect);
            var     enabled = AddList(ref sub, null as ConfigModel, "Enabled", "Toggles Counters+ on or off.", 2);

            enabled.GetTextForValue = (v) => (v != 0f) ? "ON" : "OFF";
            enabled.GetValue        = () => CountersController.settings.Enabled ? 1f : 0f;
            enabled.SetValue        = (v) => CountersController.settings.Enabled = v != 0f;

            var toggleCounters = AddList(ref sub, null as ConfigModel, "Advanced Mock Counters", "Allows the mock counters to display more settings. To increase preformance, and reduce chances of bugs, disable this option.", 2);

            toggleCounters.GetTextForValue = (v) => (v != 0f) ? "ON" : "OFF";
            toggleCounters.GetValue        = () => CountersController.settings.AdvancedCounterInfo ? 1f : 0f;
            toggleCounters.SetValue        = (v) => CountersController.settings.AdvancedCounterInfo = v != 0f;

            var comboOffset = AddList(ref sub, null as ConfigModel, "Combo Offset", "How far from the Combo counters should be before Distance is taken into account.", 20);

            comboOffset.GetTextForValue = (v) => ((v - 10) / 10).ToString();
            comboOffset.GetValue        = () => (CountersController.settings.ComboOffset * 10) + 10;
            comboOffset.SetValue        = (v) => CountersController.settings.ComboOffset = ((v - 10) / 10);

            var multiOffset = AddList(ref sub, null as ConfigModel, "Multiplier Offset", "How far from the Multiplier counters should be before Distance is taken into account.", 20);

            multiOffset.GetTextForValue = (v) => ((v - 10) / 10).ToString();
            multiOffset.GetValue        = () => (CountersController.settings.MultiplierOffset * 10) + 10;
            multiOffset.SetValue        = (v) => CountersController.settings.MultiplierOffset = ((v - 10) / 10);

            var hideCombo = AddList(ref sub, null as ConfigModel, "Hide Combo In-Game", "The combo counter wasn't good enough anyways.", 2);

            hideCombo.GetTextForValue = (v) => (v != 0f) ? "ON" : "OFF";
            hideCombo.GetValue        = () => CountersController.settings.HideCombo ? 1f : 0f;
            hideCombo.SetValue        = (v) => CountersController.settings.HideCombo = v != 0f;

            var hideMultiplier = AddList(ref sub, null as ConfigModel, "Hide Multiplier In-Game", "The multiplier wasn't good enough anyways.", 2);

            hideMultiplier.GetTextForValue = (v) => (v != 0f) ? "ON" : "OFF";
            hideMultiplier.GetValue        = () => CountersController.settings.HideMultiplier ? 1f : 0f;
            hideMultiplier.SetValue        = (v) => CountersController.settings.HideMultiplier = v != 0f;

            toggleCounters.SetValue += (v) => CountersPlusSettingsFlowCoordinator.UpdateMockCounters();
            comboOffset.SetValue    += (v) => CountersPlusSettingsFlowCoordinator.UpdateMockCounters();
            multiOffset.SetValue    += (v) => CountersPlusSettingsFlowCoordinator.UpdateMockCounters();

            foreach (ListViewController list in LoadedSettings) //Should be cleared from the ClearScreen function.
            {
                list.SetValue += (v) => CountersController.settings.Save();
            }

            InitSettings();
        }
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            if (firstActivation)
            {
                var headerPanelRectTransform = Instantiate(Resources.FindObjectsOfTypeAll <RectTransform>().First(x => x.name == "HeaderPanel" && x.parent.name == "PlayerSettingsViewController"), rectTransform);
                headerPanelRectTransform.gameObject.SetActive(true);

                _titleText      = headerPanelRectTransform.GetComponentInChildren <TextMeshProUGUI>();
                _titleText.text = "SONG DESCRIPTION";

                _pageUpButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => x.name == "PageUpButton"), rectTransform, false);
                (_pageUpButton.transform as RectTransform).anchorMin        = new Vector2(0.5f, 1f);
                (_pageUpButton.transform as RectTransform).anchorMax        = new Vector2(0.5f, 1f);
                (_pageUpButton.transform as RectTransform).anchoredPosition = new Vector2(52f, -12f);
                (_pageUpButton.transform as RectTransform).sizeDelta        = new Vector2(8f, 6f);
                _pageUpButton.GetComponentsInChildren <RectTransform>().First(x => x.name == "BG").sizeDelta        = new Vector2(8f, 6f);
                _pageUpButton.GetComponentsInChildren <UnityEngine.UI.Image>().First(x => x.name == "Arrow").sprite = Sprites.DoubleArrow;
                _pageUpButton.onClick.AddListener(delegate()
                {
                    PageUpButtonPressed();
                });

                _pageDownButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => x.name == "PageDownButton"), rectTransform, false);
                (_pageDownButton.transform as RectTransform).anchorMin        = new Vector2(0.5f, 0f);
                (_pageDownButton.transform as RectTransform).anchorMax        = new Vector2(0.5f, 0f);
                (_pageDownButton.transform as RectTransform).anchoredPosition = new Vector2(52f, 10f);
                (_pageDownButton.transform as RectTransform).sizeDelta        = new Vector2(8f, 6f);
                _pageDownButton.GetComponentsInChildren <RectTransform>().First(x => x.name == "BG").sizeDelta        = new Vector2(8f, 6f);
                _pageDownButton.GetComponentsInChildren <UnityEngine.UI.Image>().First(x => x.name == "Arrow").sprite = Sprites.DoubleArrow;
                _pageDownButton.onClick.AddListener(delegate()
                {
                    PageDownButtonPressed();
                });

                _textViewport = new GameObject("DescriptionViewport", typeof(RectTransform), typeof(RectMask2D)).transform as RectTransform;
                _textViewport.SetParent(rectTransform, false);
                _textViewport.anchorMin        = new Vector2(0.05f, 0.025f);
                _textViewport.anchorMax        = new Vector2(0.9f, 0.85f);
                _textViewport.sizeDelta        = new Vector2(0f, 0f);
                _textViewport.anchoredPosition = new Vector2(0f, 0f);

                _descriptionText                                = BeatSaberUI.CreateText(_textViewport, "", new Vector2(0f, 0f));
                _descriptionText.fontSize                       = 4f;
                _descriptionText.enableWordWrapping             = true;
                _descriptionText.overflowMode                   = TextOverflowModes.Overflow;
                _descriptionText.lineSpacing                    = -40f;
                _descriptionText.ignoreRectMaskCulling          = true;
                _descriptionText.rectTransform.anchorMin        = new Vector2(0f, 0f);
                _descriptionText.rectTransform.anchorMax        = new Vector2(1f, 1f);
                _descriptionText.rectTransform.sizeDelta        = new Vector2(0f, 0f);
                _descriptionText.rectTransform.anchoredPosition = new Vector2(0f, 0f);

                _linkHandler              = _descriptionText.gameObject.AddComponent <TextMeshProHyperlinkHandler>();
                _linkHandler.linkClicked += linkClicked;
            }
            SetDescription("");
        }
예제 #26
0
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            if (!firstActivation)
            {
                return;
            }
            instance = this;
            TextMeshProUGUI name, version, creator;
            Button          github, issues, donate;

            name                  = BeatSaberUI.CreateText(rectTransform, "Counters+", Vector2.zero);
            name.fontSize         = 11;
            name.alignment        = TextAlignmentOptions.Center;
            name.characterSpacing = 2;
            setPositioning(name.rectTransform, 0, 0.7f, 1, 0.166f, 0.5f);

            version = BeatSaberUI.CreateText(rectTransform,
                                             $"Version <color={(Plugin.UpToDate ? "#00FF00" : "#FF0000")}>{Plugin.PluginVersion}</color>", Vector2.zero);
            version.fontSize  = 3;
            version.alignment = TextAlignmentOptions.Center;
            setPositioning(version.rectTransform, 0, 0.5f, 1, 0.166f, 0.5f);

            if (!Plugin.UpToDate)
            {
                TextMeshProUGUI warning = BeatSaberUI.CreateText(rectTransform,
                                                                 $"<color=#FF0000>Version {Plugin.WebVersion} available for download!</color>", Vector2.zero);
                warning.fontSize  = 3;
                warning.alignment = TextAlignmentOptions.Center;
                setPositioning(warning.rectTransform, 0, 0.47f, 1, 0.166f, 0.5f);
            }

            creator           = BeatSaberUI.CreateText(rectTransform, "Developed by: <color=#00c0ff>Caeden117</color>", Vector2.zero);
            creator.fontSize  = 5;
            creator.alignment = TextAlignmentOptions.Center;
            setPositioning(creator.rectTransform, 0, 0.35f, 1, 0.166f, 0.5f);

            try //attempt to load BSML's button cuz it messes with layout
            {
                github = BeatSaberUI.CreateUIButton(rectTransform, "SettingsButton(Clone)", Vector2.left, null, "GitHub");
            }
            catch { github = BeatSaberUI.CreateUIButton(rectTransform, "SettingsButton", Vector2.left, null, "GitHub"); }
            github.onClick.AddListener(() => { GoTo("https://github.com/Caeden117/CountersPlus", github); });
            setPositioning(github.transform as RectTransform, 0f, 0f, 0.39f, 0.125f, 0.5f);
            BeatSaberUI.AddHintText(github.transform as RectTransform, "Opens in a new browser tab on your desktop. Feel free to explore the source code! Maybe try out experimental versions?");

            issues = BeatSaberUI.CreateUIButton(rectTransform, "QuitButton", Vector2.right, null, "Report an Issue");
            issues.onClick.AddListener(() => { GoTo("https://github.com/Caeden117/CountersPlus/issues", issues); });
            setPositioning(issues.transform as RectTransform, 0.5f, 0f, 0.5f, 0.125f, 0.5f);
            BeatSaberUI.AddHintText(issues.transform as RectTransform, "Opens in a new browser tab on your desktop. Be sure to read the Issue template thoroughly!");

            donate = BeatSaberUI.CreateUIButton(rectTransform, "CreditsButton", Vector2.zero, null, "<3");
            donate.onClick.AddListener(() => { GoTo("https://ko-fi.com/Caeden117", donate); });
            BeatSaberUI.AddHintText(donate.transform as RectTransform, "Buy me a coffee if you feel like I'm deserving of one.");
            setPositioning(donate.transform as RectTransform, 0.36f, 0f, 0.17f, 0.125f, 0.5f);
        }
        public void Init(Sprite icon, string name, string version, string author, string description, PluginLoader.PluginMetadata updateInfo, PluginManifest.LinksObject links = null, bool showEnDis = false, ModListFlowCoordinator mlfc = null)
        {
            showEnableDisable      = showEnDis;
            Plugin.OnConfigChaned -= OptHideButton;

            Icon        = icon;
            Name        = name;
            Version     = version;
            Author      = author;
            Description = description;
            UpdateInfo  = updateInfo;

            enabled = !PluginManager.IsDisabled(updateInfo);

            flowController = mlfc;

            if (rowTransformOriginal == null)
            {
                rowTransformOriginal = MenuButtonUI.Instance.GetPrivateField <RectTransform>("menuButtonsOriginal");
            }

            // i also have no clue why this is necessary
            rectTransform.anchorMin = new Vector2(0f, 0f);
            rectTransform.anchorMax = new Vector2(0.5f, 1f);

            var go = new GameObject("Info View", typeof(RectTransform));

            go.SetActive(false);
            go.AddComponent <RectMask2D>();
            view = go.AddComponent <ModInfoView>();
            var rt = view.transform as RectTransform;

            rt.SetParent(transform);
            rt.anchorMin        = new Vector2(0f, 0f);
            rt.anchorMax        = new Vector2(1f, 1f);
            rt.anchoredPosition = new Vector2(0f, 0);
            view.Init(this);
            go.SetActive(true);

            if (showEnDis)
            {
                restartMessage          = BeatSaberUI.CreateText(rectTransform, "A restart is required to apply", new Vector2(11f, 33.5f));
                restartMessage.fontSize = 4f;
                restartMessage.gameObject.SetActive(false);

                enableDisableButton = BeatSaberUI.CreateUIButton(rectTransform, "CreditsButton", new Vector2(33, 32), new Vector2(25, 10), ToggleEnable);
                enableDisableButton.GetComponentInChildren <StartMiddleEndButtonBackgroundController>().SetMiddleSprite();
                UpdateButtonText();

                Plugin.OnConfigChaned += OptHideButton;
                OptHideButton(Plugin.config.Value);
            }

            SetupLinks(links);
        }
        internal static void CreateFiller()
        {
            ClearScreen();
            TextMeshProUGUI filler = BeatSaberUI.CreateText(rect, "Select an option, and\nsettings will appear here!", Vector2.zero);

            filler.fontSize         = 11;
            filler.alignment        = TextAlignmentOptions.Center;
            filler.characterSpacing = 2;
            SetPositioning(filler.rectTransform, 0, 0.6f, 1, 0.166f, 0.5f);
            LoadedElements.Add(filler.gameObject);
        }
예제 #29
0
        //Counters plus yoinked :3
        private void GoTo(string url, Button button)
        {
            button.interactable = false;
            TextMeshProUGUI reminder = BeatSaberUI.CreateText(transform as RectTransform, "Link opened in your browser!", new Vector2(0, -25), new Vector2(16, 16));

            reminder.fontSize  = 4;
            reminder.alignment = TextAlignmentOptions.Center;

            this.StartCoroutine(SecondRemove(reminder.gameObject, button));
            System.Diagnostics.Process.Start(url);
        }
        private static void GoTo(string url, Button button)
        {
            Plugin.Log("Opened a link to: " + url);
            button.interactable = false;
            TextMeshProUGUI reminder = BeatSaberUI.CreateText(instance.rectTransform, "Link opened in your browser!", Vector2.zero);

            reminder.fontSize  = 4;
            reminder.alignment = TextAlignmentOptions.Center;
            setPositioning(reminder.rectTransform, 0, 0.25f, 1, 0.166f, 0.5f);
            instance.StartCoroutine(instance.SecondRemove(reminder.gameObject, button));
            System.Diagnostics.Process.Start(url);
        }