コード例 #1
0
        private IModPopupMenu CreateModsMenu(IModTabbedMenu options)
        {
            var toggleTemplate = options.InputTab.ToggleInputs[0];
            var sliderTemplate = options.InputTab.SliderInputs[0];
            var modsTab        = options.InputTab.Copy("MODS");

            modsTab.Buttons.ForEach(x => x.Hide());
            modsTab.Menu.GetComponentsInChildren <Selectable>().ToList().ForEach(x => x.gameObject.SetActive(false));
            modsTab.Menu.GetValue <TooltipDisplay>("_tooltipDisplay").GetComponent <Text>().color = Color.clear;
            options.AddTab(modsTab);
            foreach (var modConfigMenu in _modConfigMenus)
            {
                var modButton = _modButtonTemplate.Copy(modConfigMenu.ModData.Manifest.Name);
                modButton.Button.enabled = true;
                var modMenuTemplate   = _modMenuTemplate.GetComponentInChildren <Menu>(true);
                var modMenuCopy       = GameObject.Instantiate(modMenuTemplate, _modMenuTemplate.transform);
                var textInputTemplate = new ModTextInput(toggleTemplate.Copy().Toggle, modConfigMenu, _menus.InputMenu);
                textInputTemplate.Hide();
                var numberInputTemplate = new ModNumberInput(toggleTemplate.Copy().Toggle, modConfigMenu, _menus.InputMenu);
                numberInputTemplate.Hide();
                modConfigMenu.Initialize(modMenuCopy, toggleTemplate, sliderTemplate, textInputTemplate, numberInputTemplate);
                modButton.OnClick += () => modConfigMenu.Open();
                modsTab.AddButton(modButton);
            }
            modsTab.UpdateNavigation();
            modsTab.SelectFirst();
            return(modsTab);
        }
コード例 #2
0
ファイル: ModsMenu.cs プロジェクト: TAImatem/owml
        private void InitConfigMenu(IModConfigMenuBase modConfigMenu, IModTabbedMenu options)
        {
            var toggleTemplate    = options.InputTab.ToggleInputs[0];
            var sliderTemplate    = options.InputTab.SliderInputs[0];
            var modMenuTemplate   = _modMenuTemplate.GetComponentInChildren <Menu>(true);
            var modMenuCopy       = Object.Instantiate(modMenuTemplate, _modMenuTemplate.transform);
            var textInputTemplate = new ModTextInput(toggleTemplate.Copy().Toggle, modConfigMenu, _menus.InputMenu);

            textInputTemplate.Hide();
            var comboInputTemplate = new ModComboInput(toggleTemplate.Copy().Toggle, modConfigMenu, _menus.InputCombinationMenu, _inputHandler);

            comboInputTemplate.Hide();
            var numberInputTemplate = new ModNumberInput(toggleTemplate.Copy().Toggle, modConfigMenu, _menus.InputMenu);

            numberInputTemplate.Hide();
            modConfigMenu.Initialize(modMenuCopy, toggleTemplate, sliderTemplate, textInputTemplate, numberInputTemplate, comboInputTemplate);
        }