private void UpdateInputFieldsWithString (InputFieldToggler toggler, List<string> stringDatas) { for (int i=0; i<stringDatas.Count; i++) { UIWidget container; if (i > 0) { toggler.AddField(); container = toggler.widgets[toggler.widgets.Count-1]; } else { container = toggler.prefab; } var stringData = stringDatas[i]; var fields = container.GetComponentsInChildren<UIInput>(true); foreach (var field in fields) { field.value = stringData; } } }
private void UpdateInputFieldsWithPairDatas (InputFieldToggler toggler, List<PairData> pairDatas) { while ((toggler.widgets.Count > pairDatas.Count) && (toggler.widgets.Count != 1 && pairDatas.Count != 0)) { toggler.DeleteLastField(); } for (int i=0; i<pairDatas.Count; i++) { UIWidget container; if (i >= toggler.widgets.Count) { toggler.AddField(); container = toggler.widgets[toggler.widgets.Count-1]; } else { container = toggler.widgets[i]; } var dataPair = pairDatas[i]; var fields = container.GetComponentsInChildren<UIInput>(true); foreach (var field in fields) { if (field.name.Contains("count") || field.name.Contains("Count")) { field.value = dataPair.count.ToString(); } if (field.name.Contains("data") || field.name.Contains("Data")) { field.value = dataPair.data.ToString(); } } } }