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); }
private IEnumerator SetUp() { sectionView = Object.Instantiate((GameObject)Resources.Load(SECTION_VIEW_PREFAB_PATH)).GetComponent <SettingsSectionView>(); sectionController = Substitute.For <ISettingsSectionController>(); yield return(null); }
public void Initialize(ISettingsSectionController settingsSectionController, List <SettingsWidgetModel> widgets) { this.settingsSectionController = settingsSectionController; this.widgets = widgets; CreateWidgets(); }
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(); }