private void CreatePlatformsButton() { Button _platformsButton = CreateUIButton(_mainMenuRectTransform, "SettingsButton"); try { (_platformsButton.transform as RectTransform).anchoredPosition += new Vector2(0f, 20f); (_platformsButton.transform as RectTransform).sizeDelta = new Vector2(28f, 10f); SetButtonText(ref _platformsButton, "Platforms"); _platformsButton.onClick.AddListener(delegate() { try { if (_platformMasterViewController == null) { _platformMasterViewController = CreateViewController <PlatformMasterViewController>(); } _mainMenuViewController.PresentModalViewController(_platformMasterViewController, null, false); } catch (Exception e) { Console.WriteLine("EXCETPION IN BUTTON: " + e.Message); } }); } catch (Exception e) { Console.WriteLine("EXCEPTION: " + e.Message); } }
protected override void DidActivate(bool firstActivation, ActivationType type) { ui = PlatformUI._instance; _parentMasterViewController = transform.parent.GetComponent <PlatformMasterViewController>(); try { _songListTableCellInstance = Resources.FindObjectsOfTypeAll <StandardLevelListTableCell>().First(x => (x.name == "StandardLevelListTableCell")); if (_platformsTableView == null) { _platformsTableView = new GameObject().AddComponent <TableView>(); _platformsTableView.transform.SetParent(rectTransform, false); _platformsTableView.dataSource = this; (_platformsTableView.transform as RectTransform).anchorMin = new Vector2(0f, 0.5f); (_platformsTableView.transform as RectTransform).anchorMax = new Vector2(1f, 0.5f); (_platformsTableView.transform as RectTransform).sizeDelta = new Vector2(0f, 60f); (_platformsTableView.transform as RectTransform).position = new Vector3(0f, 0f, 2.4f); (_platformsTableView.transform as RectTransform).anchoredPosition = new Vector3(0f, 0f); // -3 _platformsTableView.didSelectRowEvent += _PlatformTableView_DidSelectRowEvent; } else { _platformsTableView.ReloadData(); } if (_pageUpButton == null) { _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, -10f);//-14 _pageUpButton.interactable = true; _pageUpButton.onClick.AddListener(delegate() { _platformsTableView.PageScrollUp(); }); } if (_pageDownButton == null) { _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, 10);//8 _pageDownButton.interactable = true; _pageDownButton.onClick.AddListener(delegate() { _platformsTableView.PageScrollDown(); }); } if (_versionNumber == null) { _versionNumber = Instantiate(Resources.FindObjectsOfTypeAll <TextMeshProUGUI>().First(x => (x.name == "BuildInfoText")), rectTransform, false); DestroyImmediate(_versionNumber.GetComponent <BuildInfoText>()); (_versionNumber.transform as RectTransform).anchoredPosition = new Vector2(44f, 2f); string versionNumber = (IllusionInjector.PluginManager.Plugins.Where(x => x.Name == "Custom Platforms").First()).Version; _versionNumber.text = versionNumber; _versionNumber.fontSize = 5; } _platformsTableView.SelectRow(PlatformLoader.Instance.GetPlatformIndex()); _platformsTableView.ScrollToRow(PlatformLoader.Instance.GetPlatformIndex(), true); } catch (Exception e) { Console.WriteLine("EXCEPTION IN DidActivate: " + e); } }