/// <summary> /// Set the current species. /// </summary> /// <returns>True if the species was recognized and was or is set.</returns> public bool SetSpecies(Species species, bool alsoTriggerOnSameSpecies = false, bool ignoreInRecent = false) { if (species == null) { return(false); } if (SelectedSpecies == species) { if (alsoTriggerOnSameSpecies) { OnSpeciesSelected?.Invoke(false); } return(true); } if (!ignoreInRecent) { _lastSpeciesBPs.Remove(species.blueprintPath); _lastSpeciesBPs.Insert(0, species.blueprintPath); if (_lastSpeciesBPs.Count > Properties.Settings.Default.SpeciesSelectorCountLastSpecies ) // only keep keepNrLastSpecies of the last species in this list { _lastSpeciesBPs.RemoveRange(Properties.Settings.Default.SpeciesSelectorCountLastSpecies, _lastSpeciesBPs.Count - Properties.Settings.Default.SpeciesSelectorCountLastSpecies); } UpdateLastSpecies(); } SelectedSpecies = species; OnSpeciesSelected?.Invoke(true); return(true); }
public void SetSpecies(Species species) { if (species == null || SelectedSpecies == species) { return; } lastSpeciesBPs.Remove(species.blueprintPath); lastSpeciesBPs.Insert(0, species.blueprintPath); if (lastSpeciesBPs.Count > Properties.Settings.Default.SpeciesSelectorCountLastSpecies) // only keep keepNrLastSpecies of the last species in this list { lastSpeciesBPs.RemoveRange(Properties.Settings.Default.SpeciesSelectorCountLastSpecies, lastSpeciesBPs.Count - Properties.Settings.Default.SpeciesSelectorCountLastSpecies); } UpdateLastSpecies(); SelectedSpecies = species; OnSpeciesSelected?.Invoke(true); }