Esempio n. 1
0
        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()}");
            }
        }
Esempio n. 2
0
        private void AddHooks(object obj)
        {
            if (navInstance == null)
            {
                navInstance = Resources.FindObjectsOfTypeAll <SettingsNavigationController>().First();
            }
            Action <FinishAction> del = null;

            needsInit.Add(obj as CustomSetting);
            del = delegate(FinishAction finishAction)
            {
                try
                {
                    if (obj is CustomSetting)
                    {
                        CustomSetting customSetting = (obj as CustomSetting);
                        if (finishAction == FinishAction.Apply || finishAction == FinishAction.Ok)
                        {
                            customSetting.ApplySettings();
                        }
                        if (finishAction == FinishAction.Cancel)
                        {
                            customSetting.CancelSettings();
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"[SettingsUI] Crash when trying to apply or cancel settings UI! Exception: {ex.ToString()}");
                }
                navInstance.didFinishEvent -= del;
            };
            navInstance.didFinishEvent += del;
        }
Esempio n. 3
0
        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()}");
            }
        }
Esempio n. 4
0
 internal LanguageSettingCreator(DiContainer container, GameplaySetupViewController gameplaySetupViewController, SettingsNavigationController settingsNavigationController, StandardLevelDetailViewController standardLevelDetailViewController)
 {
     _container = container;
     _gameplaySetupViewController       = gameplaySetupViewController;
     _settingsNavigationController      = settingsNavigationController;
     _standardLevelDetailViewController = standardLevelDetailViewController;
 }
Esempio n. 5
0
        private void AddHooks(object obj)
        {
            if (navInstance == null)
            {
                navInstance = Resources.FindObjectsOfTypeAll <SettingsNavigationController>().First();
            }
            Action <FinishAction> del = null;

            needsInit.Add(obj as CustomSetting);
            del = delegate(FinishAction finishAction){
                if (obj is CustomSetting)
                {
                    CustomSetting customSetting = (obj as CustomSetting);
                    if (finishAction == FinishAction.Apply || finishAction == FinishAction.Ok)
                    {
                        customSetting.ApplySettings();
                    }
                    if (finishAction == FinishAction.Cancel)
                    {
                        customSetting.CancelSettings();
                    }
                    navInstance.didFinishEvent -= del;
                }
            };
            navInstance.didFinishEvent += del;
        }
Esempio n. 6
0
        public void Awake()
        {
            _dropdown = GetComponentInChildren <SimpleTextDropdown>();
            _settingsNavigationController = GetComponentInParent <SettingsNavigationController>();

            // AsReadOnly to avoid accidentally messing around with values inside Polyglot
            _languages            = Localization.Instance.SupportedLanguages.AsReadOnly();
            _languageDisplayNames = Localization.Instance.LocalizedLanguageNames.AsReadOnly();

            _selectedLanguage = _languageManager.selectedLanguage;
        }
Esempio n. 7
0
        public void Awake()
        {
            _dropdown = GetComponentInChildren <SimpleTextDropdown>();
            _settingsNavigationController = GetComponentInParent <SettingsNavigationController>();

            // AsReadOnly to avoid accidentally messing around with values inside Polyglot
            _languages            = Localization.Instance.SupportedLanguages.Select(l => (Locale)l).ToList().AsReadOnly();
            _languageDisplayNames = Localization.Instance.LocalizedLanguageNames.AsReadOnly();

            _selectedLanguage = _config.language;
            selectedLanguageChanged?.Invoke(_selectedLanguage);
        }
Esempio n. 8
0
        private void AddHooks(object obj)
        {
            if (navInstance == null)
            {
                navInstance = Resources.FindObjectsOfTypeAll <SettingsNavigationController>().First();
            }
            Action <FinishAction> del = null;

            needsInit.Add(obj as CustomSetting);
            del = delegate(FinishAction finishAction)
            {
                try
                {
                    if (obj is CustomSetting)
                    {
                        CustomSetting customSetting = (obj as CustomSetting);

                        // Only call our apply/cancel callbacks if the setting was properly initialized
                        if (customSetting.IsInitialized)
                        {
                            switch (finishAction)
                            {
                            case FinishAction.Apply:
                            case FinishAction.Ok:
                                customSetting.ApplySettings();
                                break;

                            case FinishAction.Cancel:
                                customSetting.CancelSettings();
                                break;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Plugin.Log(ex.ToString(), IPA.Logging.Logger.Level.Error);
                }
                if (finishAction != FinishAction.Cancel)
                {
                    navInstance.didFinishEvent -= del;
                }
            };
            navInstance.didFinishEvent += del;
        }