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)); }
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); } } }