protected override void DoDisplay() { m_StatusFoldOut = new Foldout { text = L10n.Tr("Status"), name = k_StatusFoldOutName, classList = { k_FoldoutClass } }; foreach (var status in k_Statuses) { var toggle = new Toggle(status) { name = status.ToLower(), classList = { k_ToggleClass } }; toggle.RegisterValueChangedCallback(evt => { if (evt.newValue) { foreach (var t in m_StatusFoldOut.Children().OfType <Toggle>()) { if (t == toggle) { continue; } t.SetValueWithoutNotify(false); } } UpdateFiltersIfNeeded(); }); m_StatusFoldOut.Add(toggle); } m_Container.Add(m_StatusFoldOut); }
protected override void DoDisplay() { m_StatusFoldOut = new Foldout { text = L10n.Tr("Status"), name = k_StatusFoldOutName, classList = { k_FoldoutClass } }; foreach (var status in k_Statuses) { var toggle = new Toggle(status) { name = status.ToLower(), classList = { k_ToggleClass } }; toggle.RegisterValueChangedCallback(evt => { if (evt.newValue) { foreach (var t in m_StatusFoldOut.Children().OfType <Toggle>()) { if (t == toggle) { continue; } t.SetValueWithoutNotify(false); } if (status == k_Statuses[0] && m_LabelsFoldOut != null) { // Uncheck labels if checked foreach (var t in m_LabelsFoldOut.Children().OfType <Toggle>()) { t.value = false; } } } UpdateFiltersIfNeeded(); }); m_StatusFoldOut.Add(toggle); } m_Container.Add(m_StatusFoldOut); if (m_Categories.Any()) { m_CategoriesFoldOut = new Foldout { text = L10n.Tr("Categories"), name = k_CategoriesFoldOutName, classList = { k_FoldoutClass } }; foreach (var category in m_Categories) { var toggle = new Toggle(L10n.Tr(category)) { name = category.ToLower(), classList = { k_ToggleClass } }; toggle.RegisterValueChangedCallback(evt => UpdateFiltersIfNeeded()); m_CategoriesFoldOut.Add(toggle); } m_CategoriesFoldOut.Query <Label>().ForEach(UIUtils.TextTooltipOnSizeChange); m_Container.Add(m_CategoriesFoldOut); } if (m_Labels.Any()) { m_LabelsFoldOut = new Foldout { text = L10n.Tr("Labels"), name = k_LabelsFoldOutName, classList = { k_FoldoutClass } }; var i = 0; foreach (var label in m_Labels) { var toggle = new Toggle(L10n.Tr(label)) { name = label, classList = { k_ToggleClass } }; toggle.RegisterValueChangedCallback(evt => { if (evt.newValue) { // Uncheck Unlabeled if checked m_StatusFoldOut.Q <Toggle>(k_Statuses[0].ToLower()).value = false; } UpdateFiltersIfNeeded(); }); m_LabelsFoldOut.Add(toggle); if (++i > k_MaxDisplayLabels) { UIUtils.SetElementDisplay(toggle, false); } } m_LabelsFoldOut.Query <Label>().ForEach(UIUtils.TextTooltipOnSizeChange); m_Container.Add(m_LabelsFoldOut); } }
protected override void DoDisplay(IPage page) { m_StatusFoldOut = new Foldout { text = L10n.Tr("Status"), name = k_StatusFoldOutName, classList = { k_FoldoutClass } }; foreach (var status in k_Statuses) { var toggle = new Toggle(status) { name = status.ToLower(), classList = { k_ToggleClass } }; toggle.RegisterValueChangedCallback(evt => { if (evt.newValue) { foreach (var t in m_StatusFoldOut.Children().OfType <Toggle>()) { if (t == toggle) { continue; } t.SetValueWithoutNotify(false); } if (status == PageFilters.k_UnlabeledStatus && m_LabelsFoldOut != null) { foreach (var t in m_LabelsFoldOut.Children().OfType <Toggle>()) { t.value = false; } } if (status == PageFilters.k_UpdateAvailableStatus) { m_AssetStoreCallQueue.CheckUpdateForUncheckedLocalInfos(); } } UpdateFiltersIfNeeded(); }); m_StatusFoldOut.Add(toggle); } m_Container.Add(m_StatusFoldOut); if (m_Categories.Any()) { m_CategoriesFoldOut = new Foldout { text = L10n.Tr("Categories"), name = k_CategoriesFoldOutName, classList = { k_FoldoutClass } }; foreach (var category in m_Categories) { var toggle = new Toggle(L10n.Tr(category)) { name = category.ToLower(), classList = { k_ToggleClass } }; toggle.RegisterValueChangedCallback(evt => UpdateFiltersIfNeeded()); m_CategoriesFoldOut.Add(toggle); } m_CategoriesFoldOut.Query <Label>().ForEach(UIUtils.TextTooltipOnSizeChange); m_Container.Add(m_CategoriesFoldOut); } }