private void SetupUI() { if (initialized) { return; } try { var _menuMasterViewController = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First(); prompt = ReflectionUtil.GetPrivateField <SimpleDialogPromptViewController>(_menuMasterViewController, "_simpleDialogPromptViewController"); _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First(); settingsMenu = Resources.FindObjectsOfTypeAll <SettingsNavigationController>().FirstOrDefault(); mainSettingsMenu = Resources.FindObjectsOfTypeAll <MainSettingsMenuViewController>().FirstOrDefault(); _mainSettingsTableView = mainSettingsMenu.GetPrivateField <MainSettingsTableView>("_mainSettingsTableView"); subMenuTableView = _mainSettingsTableView.GetPrivateField <TableView>("_tableView"); subMenuTableViewHelper = subMenuTableView.gameObject.AddComponent <TableViewHelper>(); othersSubmenu = settingsMenu.transform.Find("OtherSettings"); initialized = true; } catch (Exception ex) { Console.WriteLine($"[SettingsUI] Crash when trying to setup UI! Exception: {ex.ToString()}"); } }
private void SetupUI() { if (initialized) { return; } try { var _menuMasterViewController = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First(); prompt = ReflectionUtil.GetPrivateField <SimpleDialogPromptViewController>(_menuMasterViewController, "_simpleDialogPromptViewController"); _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First(); settingsMenu = Resources.FindObjectsOfTypeAll <SettingsNavigationController>().FirstOrDefault(); mainSettingsMenu = Resources.FindObjectsOfTypeAll <MainSettingsMenuViewController>().FirstOrDefault(); _mainSettingsTableView = mainSettingsMenu.GetPrivateField <MainSettingsTableView>("_mainSettingsTableView"); subMenuTableView = _mainSettingsTableView.GetComponentInChildren <TableView>(); subMenuTableViewHelper = subMenuTableView.gameObject.AddComponent <TableViewHelper>(); othersSubmenu = settingsMenu.transform.Find("OtherSettings"); AddPageButtons(); if (tableCell == null) { tableCell = Resources.FindObjectsOfTypeAll <MainSettingsTableCell>().FirstOrDefault(); // Get a refence to the Settings Table cell text in case we want to change font size, etc var text = tableCell.GetPrivateField <TextMeshProUGUI>("_settingsSubMenuText"); } } catch (Exception ex) { Console.WriteLine($"[SettingsUI] Crash when trying to setup UI! Exception: {ex.ToString()}"); } }