You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
Debug.LogWarning($"{nameof(AutoCompleteComboBox)}.{nameof(SetAvailableOptions)}: items may only exists once. {newOptions.Count-uniqueOptions.Count} duplicates.");
238
+
}
239
+
240
+
this.AvailableOptions.Clear();
241
+
this.AvailableOptions=uniqueOptions;
242
+
this.RebuildPanel();
206
243
}
207
244
245
+
/// <summary>
246
+
/// Sets the given items as new content for the comboBox. Previous entries will be cleared.
247
+
/// </summary>
248
+
/// <param name="newOptions">New entries.</param>
208
249
publicvoidSetAvailableOptions(string[]newOptions)
209
250
{
210
-
AvailableOptions.Clear();
251
+
varuniqueOptions=newOptions.Distinct().ToList();
252
+
if(newOptions.Length!=uniqueOptions.Count)
253
+
{
254
+
Debug.LogWarning($"{nameof(AutoCompleteComboBox)}.{nameof(SetAvailableOptions)}: items may only exists once. {newOptions.Length-uniqueOptions.Count} duplicates.");
255
+
}
211
256
257
+
this.AvailableOptions.Clear();
212
258
for(inti=0;i<newOptions.Length;i++)
213
259
{
214
-
AvailableOptions.Add(newOptions[i]);
260
+
this.AvailableOptions.Add(newOptions[i]);
215
261
}
216
262
217
-
RebuildPanel();
263
+
this.RebuildPanel();
218
264
}
219
265
220
266
publicvoidResetItems()
@@ -264,7 +310,7 @@ private void RebuildPanel()
264
310
if(i<AvailableOptions.Count)
265
311
{
266
312
itemObjs[i].name="Item "+i+" "+_panelItems[i];
267
-
itemObjs[i].transform.Find("Text").GetComponent<Text>().text=_panelItems[i];//set the text value
313
+
itemObjs[i].transform.Find("Text").GetComponent<Text>().text=AvailableOptions[i];//set the text value
0 commit comments