public void Show(OnSearchDelegate searchCallback) { gameObject.SetActive(true); transform.SetAsLastSibling(); SearchCallback = searchCallback; stringFilterPanel.gameObject.SetActive(false); integerFilterPanel.gameObject.SetActive(false); toggleFilterPanel.gameObject.SetActive(false); for (int i = FilterPanels.Count - 1; i >= 0; i--) { Destroy(FilterPanels[i].gameObject); FilterPanels.RemoveAt(i); } InputFields.Clear(); Toggles.Clear(); nameInputField.text = Filters.Name; nameInputField.onValidateInput += delegate(string input, int charIndex, char addedChar) { return(Inputs.FilterFocusNameInput(addedChar)); }; InputFields.Add(nameInputField); idInputField.text = Filters.Id; idInputField.onValidateInput += delegate(string input, int charIndex, char addedChar) { return(Inputs.FilterFocusNameInput(addedChar)); }; InputFields.Add(idInputField); setCodeInputField.text = Filters.SetCode; setCodeInputField.onValidateInput += delegate(string input, int charIndex, char addedChar) { return(Inputs.FilterFocusNameInput(addedChar)); }; InputFields.Add(setCodeInputField); foreach (PropertyDef property in CardGameManager.Current.CardProperties) { AddPropertyPanel(property, property.Name); } propertyFiltersContent.sizeDelta = new Vector2(propertyFiltersContent.sizeDelta.x, PropertyPanelHeight * (FilterPanels.Count + 3)); }
private void UpdateToggles() { var selectedToggle = SelectedToggle; var toggleFilter = ToggleFilter; var allToggles = _featureToggleService.GetToggles().OrderBy(x => x).ToList(); if (!string.IsNullOrWhiteSpace(toggleFilter)) { allToggles = allToggles.Where(x => x.Name.IndexOf(toggleFilter, StringComparison.OrdinalIgnoreCase) >= 0).ToList(); } using (Toggles.SuspendChangeNotifications()) { Toggles.Clear(); foreach (var toggle in allToggles) { if (!toggle.IsHidden) { Toggles.Add(toggle); } } } // restore selection if (selectedToggle is not null && Toggles.Any(x => string.Equals(x.Name, selectedToggle))) { SelectedToggle = selectedToggle; } }
public override void Refresh() { base.Refresh(); Toggles.Clear(); ToggleComp[] comps = GetComponentsInChildren <ToggleComp>(); Toggles.AddRange(comps); Toggles.ForEach(toggle => RefreshToggleElement(toggle)); }
public void Show(OnNameChangeDelegate nameChangeCallback, OnSearchDelegate searchCallback) { gameObject.SetActive(true); transform.SetAsLastSibling(); NameChangeCallback = nameChangeCallback; SearchCallback = searchCallback; stringPropertyPanel.gameObject.SetActive(false); integerPropertyPanel.gameObject.SetActive(false); enumPropertyPanel.gameObject.SetActive(false); for (int i = FilterPanels.Count - 1; i >= 0; i--) { Destroy(FilterPanels[i].gameObject); FilterPanels.RemoveAt(i); } InputFields.Clear(); Toggles.Clear(); nameInputField.onValidateInput += delegate(string input, int charIndex, char addedChar) { return(Inputs.FilterFocusNameInput(addedChar)); }; InputFields.Add(nameInputField); idInputField.onValidateInput += delegate(string input, int charIndex, char addedChar) { return(Inputs.FilterFocusNameInput(addedChar)); }; InputFields.Add(idInputField); setCodeInputField.onValidateInput += delegate(string input, int charIndex, char addedChar) { return(Inputs.FilterFocusNameInput(addedChar)); }; InputFields.Add(setCodeInputField); propertyFiltersContent.sizeDelta = new Vector2(propertyFiltersContent.sizeDelta.x, PropertyPanelHeight * CardGameManager.Current.CardProperties.Count + (PropertyPanelHeight * 3)); foreach (PropertyDef property in CardGameManager.Current.CardProperties) { GameObject newPanel; if (CardGameManager.Current.IsEnumProperty(property.Name)) { newPanel = CreateEnumPropertyFilterPanel(property); } else if (property.Type == PropertyType.Integer) { newPanel = CreateIntegerPropertyFilterPanel(property.Name, property.Display); } else //if (property.Type == PropertyType.String) { newPanel = CreateStringPropertyFilterPanel(property.Name, property.Display); } FilterPanels.Add(newPanel); foreach (InputField inputField in newPanel.GetComponentsInChildren <InputField>()) { inputField.onValidateInput += delegate(string input, int charIndex, char addedChar) { return(Inputs.FilterFocusNameInput(addedChar)); }; InputFields.Add(inputField); } foreach (Toggle toggle in newPanel.GetComponentsInChildren <Toggle>()) { Toggles.Add(toggle); } } }
protected override void OnPropertiesSet() { base.OnPropertiesSet(); foreach (var toggle in Toggles) { Destroy(toggle.UIToggle.gameObject); } Toggles.Clear(); foreach (var toggleProperties in Properties.GetToggleProperties()) { var toggle = Instantiate(togglePrefab.UIToggle.gameObject, toggleContainer).GetComponent <TToggleController>(); toggle.UIToggle.transform.SetParent(toggleContainer, false); toggle.UIToggle.Toggle.group = toggleGroup; toggle.ValueChanged += (x, value) => Toggle_ValueChanged(toggle, value); toggle.SetProperties(toggleProperties); toggle.ToggleInteractability(IsInteractable); InitializeToggle(toggle); Toggles.Add(toggle); } }