private void updateComboBoxDataModel() { if (cachedNifEntries == null) { IEnumerable <entry> entries = db.getEntriesForID(7305); List <string> nIFModelEntries = new List <string>(); List <entry> lentries = new List <entry>(entries); nIFModelEntries.Clear(); nifDictionary.Clear(); foreach (entry e in lentries) { try { Model model = AnimatedModelLoader.load7305(adb, e.key); if (model != null) { string nifFile = model.nifFile; if (!model.mount && mountsOnly) { continue; } if (model.animated) { if (!nifDictionary.ContainsKey(nifFile)) { nIFModelEntries.Add(model.displayname); nifDictionary[nifFile] = model; //new AnimatedNif(adb, nifFile, model.kfmFile, model.kfbFile); } } else { // normal model if (!nifDictionary.ContainsKey(nifFile)) { nifDictionary[nifFile] = model; } } } } catch (Exception ex) { Debug.Log("Unable to parse entry " + e.id + ":" + e.key + ":" + ex.Message); } } cachedNifEntries = nIFModelEntries; } nIFModelDropdown.GetComponent <FavDropDown2>().SetOptions(cachedNifEntries.Where(x => { if (filter != null && filter.Length > 0) { return(x.Contains(filter)); } return(true); }).Select(x => new DOption(x, null, false)).ToList()); }
// Use this for initialization void Start() { List <DOption> options = new List <DOption>(); for (int i = 0; i < 1116; i++) { options.Add(new DOption(i + "123", null, true)); options.Add(new DOption(i + "1234", null)); options.Add(new DOption(i + "1235", null)); options.Add(new DOption(i + "1236", null, true)); } d.GetComponent <FavDropDown2>().setSortedOptions(options); }
public void updateWorldDropdown() { List <DOption> options = new List <DOption>(); foreach (WorldSpawn spawn in worlds) { DOption option = new DOption(spawn.worldName + " - " + spawn.spawnName + " - " + spawn.pos, spawn); options.Add(option); } dropdown.options.Clear(); string filter = this.filter.text.ToLower(); dropdown.GetComponent <FavDropDown2>().SetOptions(options.Where(x => x.text.ToLower().Contains(filter)).ToList()); //dropdown.GetComponent<FavDropDown2>().readFavs(); //dropdown.value = startIndex; dropdown.RefreshShownValue(); }