private void updateButtonSelection(ModButton button, IReadOnlyList <Mod> newSelectedMods) { foreach (var mod in newSelectedMods) { var index = Array.FindIndex(button.Mods, m1 => mod.GetType() == m1.GetType()); if (index < 0) { continue; } var buttonMod = button.Mods[index]; buttonMod.CopyFrom(mod); button.SelectAt(index); return; } button.Deselect(); }
private void updateButtonSelection(ModButton button, IReadOnlyList <Mod> newSelectedMods) { foreach (var mod in newSelectedMods) { var index = Array.FindIndex(button.Mods, m1 => mod.GetType() == m1.GetType()); if (index < 0) { continue; } var buttonMod = button.Mods[index]; // as this is likely coming from an external change, ensure the settings of the mod are in sync. buttonMod.CopyFrom(mod); button.SelectAt(index, false); return; } button.Deselect(); }