public void AddSection( SettingsButtonEntry newMenuButton, ISettingsSectionView newSection, ISettingsSectionController newSectionController, SettingsSectionModel sectionConfig) { newMenuButton?.Initialize(sectionConfig.icon, sectionConfig.text); newSection.Initialize(newSectionController, sectionConfig.widgets.ToList()); newSection.SetActive(false); sections.Add(newSection); newMenuButton?.ConfigureAction(() => { foreach (var button in menuButtons) { button.MarkAsSelected(false); } newMenuButton.MarkAsSelected(true); OpenSection(newSection); }); menuButtons.Add(newMenuButton); }
public void OpenSection(ISettingsSectionView sectionToOpen) { foreach (var section in sections) { if (section == sectionToOpen) { continue; } section.SetActive(false); } sectionToOpen.SetActive(true); }
public void SetUp() { panelController = new SettingsPanelHUDController(); newSectionView = Substitute.For <ISettingsSectionView>(); newSectionController = Substitute.For <ISettingsSectionController>(); testSprite = Sprite.Create(new Texture2D(10, 10), new Rect(), new Vector2()); newSectionConfig = ScriptableObject.CreateInstance <SettingsSectionModel>(); newSectionConfig.icon = testSprite; newSectionConfig.text = "TestSection"; newSectionConfig.menuButtonPrefab = new GameObject().AddComponent <SettingsButtonEntry>(); newSectionConfig.sectionPrefab = new GameObject().AddComponent <SettingsSectionView>(); newSectionConfig.sectionController = ScriptableObject.CreateInstance <SettingsSectionController>(); newSectionConfig.widgets = new SettingsWidgetList(); }