private IModPopupMenu CreateModsMenu(IModTabbedMenu options) { var modsTab = options.InputTab.Copy("MODS"); modsTab.BaseButtons.ForEach(x => x.Hide()); modsTab.Menu.GetComponentsInChildren <Selectable>(true).ToList().ForEach(x => x.gameObject.SetActive(false)); modsTab.Menu.GetValue <TooltipDisplay>("_tooltipDisplay").GetComponent <Text>().color = Color.clear; options.AddTab(modsTab); var modMenuTemplate = _modMenuTemplate.GetComponentInChildren <Menu>(true); var modMenuCopy = Object.Instantiate(modMenuTemplate, _modMenuTemplate.transform); var modInputCombinationElementTemplate = new ModInputCombinationElement(options.InputTab.ToggleInputs[0].Copy().Toggle, _menus.InputCombinationMenu, _menus.InputCombinationElementMenu, _inputHandler); _menus.InputCombinationMenu.Initialize(modMenuCopy, modInputCombinationElementTemplate); foreach (var modConfigMenu in _modConfigMenus) { var modButton = _modButtonTemplate.Copy(modConfigMenu.Manifest.Name); modButton.Button.enabled = true; InitConfigMenu(modConfigMenu, options); modButton.OnClick += modConfigMenu.Open; modsTab.AddButton(modButton); } modsTab.UpdateNavigation(); modsTab.SelectFirst(); return(modsTab); }
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); }