protected override void DidActivate(bool firstActivation, ActivationType type)
        {
            if (firstActivation && type == ActivationType.AddedToHierarchy)
            {
                _beatmapCharacteristics = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSO>();

                _songTableCellInstance = Resources.FindObjectsOfTypeAll <LevelListTableCell>().First(x => (x.name == "LevelListTableCell"));

                _searchButton = this.CreateUIButton("CreditsButton", new Vector2(-20f, 36.25f), new Vector2(20f, 6f), () => { SearchPressed?.Invoke(); }, "Search");
                _searchButton.SetButtonTextSize(3f);
                _searchButton.ToggleWordWrapping(false);

                _sortByButton = this.CreateUIButton("CreditsButton", new Vector2(0f, 36.25f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.SortBy);
                }, "Sort By");
                _sortByButton.SetButtonTextSize(3f);
                _sortByButton.ToggleWordWrapping(false);

                _modeButton = this.CreateUIButton("CreditsButton", new Vector2(20f, 36.25f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Mode);
                }, "Mode");
                _modeButton.SetButtonTextSize(3f);
                _modeButton.ToggleWordWrapping(false);

                _defButton = this.CreateUIButton("CreditsButton", new Vector2(-20f, 36.25f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Select);
                    SortPressed?.Invoke(SortMode.Default);
                },
                                                 "Default");

                _defButton.SetButtonTextSize(3f);
                _defButton.ToggleWordWrapping(false);
                _defButton.gameObject.SetActive(false);

                _newButton = this.CreateUIButton("CreditsButton", new Vector2(0f, 36.25f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Select);
                    SortPressed?.Invoke(SortMode.Newest);
                }, "Newest");

                _newButton.SetButtonTextSize(3f);
                _newButton.ToggleWordWrapping(false);
                _newButton.gameObject.SetActive(false);


                _diffButton = this.CreateUIButton("CreditsButton", new Vector2(20f, 36.25f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Select);
                    SortPressed?.Invoke(SortMode.Difficulty);
                }, "Difficulty");

                _diffButton.SetButtonTextSize(3f);
                _diffButton.ToggleWordWrapping(false);
                _diffButton.gameObject.SetActive(false);

                _stdButton = this.CreateUIButton("CreditsButton", new Vector2(-20f, 36.25f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Select);
                    ModePressed?.Invoke(_beatmapCharacteristics.First(x => x.characteristicName == "Standard"));
                },
                                                 "Standard");

                _stdButton.SetButtonTextSize(3f);
                _stdButton.ToggleWordWrapping(false);
                _stdButton.gameObject.SetActive(false);

                _oneSbrButton = this.CreateUIButton("CreditsButton", new Vector2(0f, 36.25f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Select);
                    ModePressed?.Invoke(_beatmapCharacteristics.First(x => x.characteristicName == "One Saber"));
                }, "One Saber");

                _oneSbrButton.SetButtonTextSize(3f);
                _oneSbrButton.ToggleWordWrapping(false);
                _oneSbrButton.gameObject.SetActive(false);


                _noArrButton = this.CreateUIButton("CreditsButton", new Vector2(20f, 36.25f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Select);
                    ModePressed?.Invoke(_beatmapCharacteristics.First(x => x.characteristicName == "No Arrows"));
                }, "No Arrows");

                _noArrButton.SetButtonTextSize(3f);
                _noArrButton.ToggleWordWrapping(false);
                _noArrButton.gameObject.SetActive(false);

                _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(0f, -12f);
                (_pageUpButton.transform as RectTransform).sizeDelta        = new Vector2(40f, 6f);
                _pageUpButton.interactable = true;
                _pageUpButton.onClick.AddListener(delegate()
                {
                    _songsTableView.PageScrollUp();
                });
                _pageUpButton.interactable = false;

                _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(0f, 6f);
                (_pageDownButton.transform as RectTransform).sizeDelta        = new Vector2(40f, 6f);
                _pageDownButton.interactable = true;
                _pageDownButton.onClick.AddListener(delegate()
                {
                    _songsTableView.PageScrollDown();
                });
                _pageDownButton.interactable = false;

                RectTransform container = new GameObject("Content", typeof(RectTransform)).transform as RectTransform;
                container.SetParent(rectTransform, false);
                container.anchorMin        = new Vector2(0.3f, 0.5f);
                container.anchorMax        = new Vector2(0.7f, 0.5f);
                container.sizeDelta        = new Vector2(0f, 60f);
                container.anchoredPosition = new Vector2(0f, -3f);

                _songsTableView = new GameObject("CustomTableView").AddComponent <TableView>();
                _songsTableView.gameObject.AddComponent <RectMask2D>();
                _songsTableView.transform.SetParent(container, false);

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

                (_songsTableView.transform as RectTransform).anchorMin        = new Vector2(0f, 0f);
                (_songsTableView.transform as RectTransform).anchorMax        = new Vector2(1f, 1f);
                (_songsTableView.transform as RectTransform).sizeDelta        = new Vector2(0f, 0f);
                (_songsTableView.transform as RectTransform).anchoredPosition = new Vector3(0f, 0f);

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

                _songsTableView.didSelectRowEvent += SongsTableView_DidSelectRow;
                _songsTableView.dataSource         = this;

                _hostIsSelectingSongText           = BeatSaberUI.CreateText(rectTransform, "Host is selecting song...", new Vector2(0f, 0f));
                _hostIsSelectingSongText.fontSize  = 8f;
                _hostIsSelectingSongText.alignment = TextAlignmentOptions.Center;
                _hostIsSelectingSongText.rectTransform.sizeDelta = new Vector2(120f, 6f);

                SelectTopButtons(TopButtonsState.Select);
            }
            else
            {
                _songsTableView.ReloadData();
            }
        }
        protected override void DidActivate(bool firstActivation, ActivationType type)
        {
            if (firstActivation && type == ActivationType.AddedToHierarchy)
            {
                _beatmapCharacteristics = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSO>();

                _songTableCellInstance = Resources.FindObjectsOfTypeAll <LevelListTableCell>().First(x => (x.name == "LevelListTableCell"));

                _searchButton = this.CreateUIButton("CancelButton", new Vector2(-15f, 36.5f), new Vector2(30f, 6f), () => {
                    SearchPressed?.Invoke();
                }, "Search");
                _searchButton.SetButtonTextSize(3f);
                _searchButton.ToggleWordWrapping(false);

                _sortByButton = this.CreateUIButton("CancelButton", new Vector2(15f, 36.5f), new Vector2(30f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.SortBy);
                }, "Sort By");
                _sortByButton.SetButtonTextSize(3f);
                _sortByButton.ToggleWordWrapping(false);

                _randomButton = this.CreateUIButton("PracticeButton", new Vector2(35f, 36.5f), new Vector2(6.5f, 6.5f), () =>
                {
                    PickRandomSong();
                }, "", Sprites.randomIcon);
                var _randomButtonLayout = _randomButton.GetComponentsInChildren <HorizontalLayoutGroup>().First(x => x.name == "Content");
                _randomButtonLayout.padding = new RectOffset(0, 0, 1, 1);

                _defButton = this.CreateUIButton("CancelButton", new Vector2(-30f, 36.5f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Select);
                    SortPressed?.Invoke(SortMode.Default);
                }, "Default");

                _defButton.SetButtonTextSize(3f);
                _defButton.ToggleWordWrapping(false);
                _defButton.gameObject.SetActive(false);

                _rankedButton = this.CreateUIButton("CancelButton", new Vector2(-10f, 36.5f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Select);
                    SortPressed?.Invoke(SortMode.Ranked);
                }, "Ranked");

                _rankedButton.SetButtonTextSize(3f);
                _rankedButton.ToggleWordWrapping(false);
                _rankedButton.gameObject.SetActive(false);


                _newButton = this.CreateUIButton("CancelButton", new Vector2(10f, 36.5f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Select);
                    SortPressed?.Invoke(SortMode.Newest);
                }, "Newest");

                _newButton.SetButtonTextSize(3f);
                _newButton.ToggleWordWrapping(false);
                _newButton.gameObject.SetActive(false);

                _diffButton = this.CreateUIButton("CancelButton", new Vector2(30f, 36.5f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Select);
                    SortPressed?.Invoke(SortMode.Difficulty);
                }, "Difficulty");

                _diffButton.SetButtonTextSize(3f);
                _diffButton.ToggleWordWrapping(false);
                _diffButton.gameObject.SetActive(false);
                _fastPageUpButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().Last(x => (x.name == "PageUpButton")), rectTransform, false);
                (_fastPageUpButton.transform as RectTransform).anchorMin        = new Vector2(0.5f, 1f);
                (_fastPageUpButton.transform as RectTransform).anchorMax        = new Vector2(0.5f, 1f);
                (_fastPageUpButton.transform as RectTransform).anchoredPosition = new Vector2(-26f, -8f);
                (_fastPageUpButton.transform as RectTransform).sizeDelta        = new Vector2(8f, 6f);
                _fastPageUpButton.GetComponentsInChildren <RectTransform>().First(x => x.name == "BG").sizeDelta = new Vector2(8f, 6f);
                _fastPageUpButton.GetComponentsInChildren <Image>().First(x => x.name == "Arrow").sprite         = Sprites.doubleArrow;
                _fastPageUpButton.onClick.AddListener(delegate()
                {
                    FastScrollUp(_songsTableView, 4);
                });
                _fastPageUpButton.interactable = true;

                _fastPageDownButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "PageDownButton")), rectTransform, false);
                (_fastPageDownButton.transform as RectTransform).anchorMin        = new Vector2(0.5f, 0f);
                (_fastPageDownButton.transform as RectTransform).anchorMax        = new Vector2(0.5f, 0f);
                (_fastPageDownButton.transform as RectTransform).anchoredPosition = new Vector2(-26f, 7f);
                (_fastPageDownButton.transform as RectTransform).sizeDelta        = new Vector2(8f, 6f);
                _fastPageDownButton.GetComponentsInChildren <RectTransform>().First(x => x.name == "BG").sizeDelta = new Vector2(8f, 6f);
                _fastPageDownButton.GetComponentsInChildren <Image>().First(x => x.name == "Arrow").sprite         = Sprites.doubleArrow;
                _fastPageDownButton.onClick.AddListener(delegate()
                {
                    FastScrollDown(_songsTableView, 4);
                });
                _fastPageDownButton.interactable = true;

                _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, -8f);
                (_pageUpButton.transform as RectTransform).sizeDelta        = new Vector2(40f, 6f);
                _pageUpButton.onClick.AddListener(delegate()
                {
                    _songTableViewScroller.PageScrollUp();
                    _songsTableView.RefreshScrollButtons();
                });
                _pageUpButton.interactable = true;

                _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(0f, 7f);
                (_pageDownButton.transform as RectTransform).sizeDelta        = new Vector2(40f, 6f);
                _pageDownButton.onClick.AddListener(delegate()
                {
                    _songTableViewScroller.PageScrollDown();
                    _songsTableView.RefreshScrollButtons();
                });
                _pageDownButton.interactable = true;

                RectTransform container = new GameObject("Content", typeof(RectTransform)).transform as RectTransform;
                container.SetParent(base.rectTransform, false);
                container.anchorMin        = new Vector2(0.3f, 0.5f);
                container.anchorMax        = new Vector2(0.7f, 0.5f);
                container.sizeDelta        = new Vector2(0f, 58f);
                container.anchoredPosition = new Vector2(0f, -2f);

                var tableGameObject = new GameObject("CustomTableView");
                tableGameObject.SetActive(false);

                Plugin.log.Info("Creating tableview");

                _songsTableView = tableGameObject.AddComponent <TableView>();
                _songsTableView.gameObject.AddComponent <RectMask2D>();
                _songsTableView.transform.SetParent(container, false);

                (_songsTableView.transform as RectTransform).anchorMin        = new Vector2(0f, 0f);
                (_songsTableView.transform as RectTransform).anchorMax        = new Vector2(1f, 1f);
                (_songsTableView.transform as RectTransform).sizeDelta        = new Vector2(0f, 0f);
                (_songsTableView.transform as RectTransform).anchoredPosition = new Vector3(0f, -2f);

                _songsTableView.SetPrivateField("_isInitialized", false);
                _songsTableView.SetPrivateField("_preallocatedCells", new TableView.CellsGroup[0]);
                _songsTableView.SetPrivateField("_tableType", TableView.TableType.Vertical);

                RectTransform viewport = new GameObject("Viewport").AddComponent <RectTransform>(); //Make a Viewport RectTransform
                viewport.SetParent(_songsTableView.transform as RectTransform, false);              //It expects one from a ScrollRect, so we have to make one ourselves.
                viewport.sizeDelta = new Vector2(0f, 58f);

                _songsTableView.Init();
                _songsTableView.SetPrivateField("_scrollRectTransform", viewport);

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

                tableGameObject.SetActive(true);
                _songTableViewScroller = _songsTableView.GetPrivateField <TableViewScroller>("_scroller");
                _songsTableView.didSelectCellWithIdxEvent += SongsTableView_DidSelectRow;
                _songsTableView.dataSource = this;

                Plugin.log.Info("Created tableview!");

                _hostIsSelectingSongText           = BeatSaberUI.CreateText(rectTransform, "Host is selecting song...", new Vector2(0f, 0f));
                _hostIsSelectingSongText.fontSize  = 8f;
                _hostIsSelectingSongText.alignment = TextAlignmentOptions.Center;
                _hostIsSelectingSongText.rectTransform.sizeDelta = new Vector2(120f, 6f);

                SelectTopButtons(TopButtonsState.Select);
            }
            else
            {
                _songsTableView.ReloadData();
            }
        }
Esempio n. 3
0
 public void DifficultySotrPressed()
 {
     SelectTopButtons(TopButtonsState.Select);
     SortPressed?.Invoke(SortMode.Difficulty);
 }
Esempio n. 4
0
 public void NewestSotrPressed()
 {
     SelectTopButtons(TopButtonsState.Select);
     SortPressed?.Invoke(SortMode.Newest);
 }
Esempio n. 5
0
 public void DefaultSotrPressed()
 {
     SelectTopButtons(TopButtonsState.Select);
     SortPressed?.Invoke(SortMode.Default);
 }
        protected override void DidActivate(bool firstActivation, ActivationType type)
        {
            if (firstActivation && type == ActivationType.AddedToHierarchy)
            {
                _songTableCellInstance = Resources.FindObjectsOfTypeAll <LevelListTableCell>().First(x => (x.name == "LevelListTableCell"));

                _searchButton = this.CreateUIButton("CancelButton", new Vector2(-15f, 36.5f), new Vector2(30f, 6f), () => { SearchPressed?.Invoke(); }, "Search");
                _searchButton.SetButtonTextSize(3f);
                _searchButton.ToggleWordWrapping(false);

                _sortByButton = this.CreateUIButton("CancelButton", new Vector2(15f, 36.5f), new Vector2(30f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.SortBy);
                }, "Sort By");
                _sortByButton.SetButtonTextSize(3f);
                _sortByButton.ToggleWordWrapping(false);

                _defButton = this.CreateUIButton("CancelButton", new Vector2(-20f, 36.5f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Select);
                    SortPressed?.Invoke(SortMode.Default);
                },
                                                 "Default");

                _defButton.SetButtonTextSize(3f);
                _defButton.ToggleWordWrapping(false);
                _defButton.gameObject.SetActive(false);

                _newButton = this.CreateUIButton("CancelButton", new Vector2(0f, 36.5f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Select);
                    SortPressed?.Invoke(SortMode.Newest);
                }, "Newest");

                _newButton.SetButtonTextSize(3f);
                _newButton.ToggleWordWrapping(false);
                _newButton.gameObject.SetActive(false);


                _diffButton = this.CreateUIButton("CancelButton", new Vector2(20f, 36.5f), new Vector2(20f, 6f), () =>
                {
                    SelectTopButtons(TopButtonsState.Select);
                    SortPressed?.Invoke(SortMode.Difficulty);
                }, "Difficulty");

                _diffButton.SetButtonTextSize(3f);
                _diffButton.ToggleWordWrapping(false);
                _diffButton.gameObject.SetActive(false);

                _fastPageUpButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().Last(x => (x.name == "PageUpButton")), rectTransform, false);
                (_fastPageUpButton.transform as RectTransform).anchorMin        = new Vector2(0.5f, 1f);
                (_fastPageUpButton.transform as RectTransform).anchorMax        = new Vector2(0.5f, 1f);
                (_fastPageUpButton.transform as RectTransform).anchoredPosition = new Vector2(-26f, -6.5f);
                (_fastPageUpButton.transform as RectTransform).sizeDelta        = new Vector2(8f, 6f);
                _fastPageUpButton.GetComponentsInChildren <RectTransform>().First(x => x.name == "BG").sizeDelta = new Vector2(8f, 6f);
                _fastPageUpButton.GetComponentsInChildren <Image>().First(x => x.name == "Arrow").sprite         = Sprites.doubleArrow;
                _fastPageUpButton.onClick.AddListener(delegate()
                {
                    FastScrollUp(_songsTableView, 4);
                });
                _fastPageUpButton.interactable = true;

                _fastPageDownButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "PageDownButton")), rectTransform, false);
                (_fastPageDownButton.transform as RectTransform).anchorMin        = new Vector2(0.5f, 0f);
                (_fastPageDownButton.transform as RectTransform).anchorMax        = new Vector2(0.5f, 0f);
                (_fastPageDownButton.transform as RectTransform).anchoredPosition = new Vector2(-26f, 1f);
                (_fastPageDownButton.transform as RectTransform).sizeDelta        = new Vector2(8f, 6f);
                _fastPageDownButton.GetComponentsInChildren <RectTransform>().First(x => x.name == "BG").sizeDelta = new Vector2(8f, 6f);
                _fastPageDownButton.GetComponentsInChildren <Image>().First(x => x.name == "Arrow").sprite         = Sprites.doubleArrow;
                _fastPageDownButton.onClick.AddListener(delegate()
                {
                    FastScrollDown(_songsTableView, 4);
                });
                _fastPageDownButton.interactable = true;

                _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, -6.5f);
                (_pageUpButton.transform as RectTransform).sizeDelta        = new Vector2(40f, 6f);
                _pageUpButton.onClick.AddListener(delegate()
                {
                    _songsTableView.GetPrivateField <TableViewScroller>("_scroller").PageScrollUp();
                });
                _pageUpButton.interactable = true;

                _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(0f, 1f);
                (_pageDownButton.transform as RectTransform).sizeDelta        = new Vector2(40f, 6f);
                _pageDownButton.onClick.AddListener(delegate()
                {
                    _songsTableView.GetPrivateField <TableViewScroller>("_scroller").PageScrollDown();
                });
                _pageDownButton.interactable = true;

                RectTransform container = new GameObject("Container", typeof(RectTransform)).transform as RectTransform;
                container.SetParent(rectTransform, false);
                container.anchorMin        = new Vector2(0.3f, 0.5f);
                container.anchorMax        = new Vector2(0.7f, 0.5f);
                container.sizeDelta        = new Vector2(0f, 60f);
                container.anchoredPosition = new Vector2(0f, -3f);

                var tableGameObject = new GameObject("CustomTableView");
                tableGameObject.SetActive(false);
                _songsTableView = tableGameObject.AddComponent <TableView>();
                _songsTableView.gameObject.AddComponent <RectMask2D>();
                _songsTableView.transform.SetParent(container, false);

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

                RectTransform viewport = new GameObject("Viewport").AddComponent <RectTransform>();
                viewport.SetParent(_songsTableView.transform, false);
                (viewport.transform as RectTransform).sizeDelta      = new Vector2(0f, 0f);
                (viewport.transform as RectTransform).anchorMin      = new Vector2(0f, 0f);
                (viewport.transform as RectTransform).anchorMax      = new Vector2(1f, 1f);
                _songsTableView.GetComponent <ScrollRect>().viewport = viewport;
                _songsTableView.Init();

                (_songsTableView.transform as RectTransform).anchorMin        = new Vector2(0f, 0f);
                (_songsTableView.transform as RectTransform).anchorMax        = new Vector2(1f, 1f);
                (_songsTableView.transform as RectTransform).sizeDelta        = new Vector2(0f, 0f);
                (_songsTableView.transform as RectTransform).anchoredPosition = new Vector3(0f, 0f);

                tableGameObject.SetActive(true);

                //ReflectionUtil.SetPrivateField(_songsTableView, "_pageUpButton", _pageUpButton);
                //ReflectionUtil.SetPrivateField(_songsTableView, "_pageDownButton", _pageDownButton);

                _songsTableView.didSelectCellWithIdxEvent += SongsTableView_DidSelectRow;
                _songsTableView.dataSource = this;

                _hostIsSelectingSongText           = BeatSaberUI.CreateText(rectTransform, "Host is selecting song...", new Vector2(0f, 0f));
                _hostIsSelectingSongText.fontSize  = 8f;
                _hostIsSelectingSongText.alignment = TextAlignmentOptions.Center;
                _hostIsSelectingSongText.rectTransform.sizeDelta = new Vector2(120f, 6f);

                SelectTopButtons(TopButtonsState.Select);
            }
            else
            {
                _songsTableView.ReloadData();
            }
        }