private void ConstructListView(GameObject leftPane) { var titleObj = UIFactory.CreateLabel(leftPane, TextAnchor.MiddleLeft); var titleLayout = titleObj.AddComponent <LayoutElement>(); titleLayout.minHeight = 25; var titleText = titleObj.GetComponent <Text>(); titleText.text = "SLPack Category:"; var subfolderDropObj = UIFactory.CreateDropdown(leftPane, out Dropdown subDrop); var subdropLayout = subfolderDropObj.AddComponent <LayoutElement>(); subdropLayout.minHeight = 25; var list = new List <ITemplateCategory>(); foreach (var ctg in SLPackManager.SLPackCategories) { if (ctg is ITemplateCategory category) { list.Add(category); } } list = list.OrderBy(it => it.FolderName).ToList(); subDrop.options = new List <Dropdown.OptionData>(); foreach (var entry in list) { subDrop.options.Add(new Dropdown.OptionData { text = entry.FolderName }); } var itemCtg = SLPackManager.GetCategoryInstance <ItemCategory>(); subDrop.value = list.IndexOf(itemCtg); subDrop.onValueChanged.AddListener((int val) => { m_currentCategory = list[val]; RefreshGeneratorTypeDropdown(); RefreshSLPackContentList(); }); m_scrollObj = UIFactory.CreateScrollView(leftPane, out m_pageContent, out SliderScrollbar scroller, new Color(0.1f, 0.1f, 0.1f)); }
private IList<ITemplate> GetTemplateInCategory(ITemplateCategory category) { try { return AllTemplates.Where(t => t.Category == category.Name).ToList(); } catch { return new List<ITemplate>(); } }