private void comboBoxSpecies_SelectedIndexChanged(object sender, EventArgs e)
{
int sI = comboBoxSpecies.SelectedIndex;
if (sI >= 0 && Values.V.species[sI].taming != null)
{
TamingData td = Values.V.species[sI].taming;
this.SuspendLayout();
foreach (TamingFoodControl f in foodControls)
{
Controls.Remove(f);
}
foodControls.Clear();
TamingFoodControl tf;
int i = 0;
foreach (string f in td.eats)
{
tf = new TamingFoodControl(f);
if (f == "Kibble")
{
tf.foodNameDisplay = "Kibble (" + td.favoriteKibble + " Egg)";
}
if (td.specialFoodValues != null && td.specialFoodValues.ContainsKey(f) && td.specialFoodValues[f].quantity > 1)
{
tf.foodNameDisplay = td.specialFoodValues[f].quantity.ToString() + "× " + tf.foodNameDisplay;
}
tf.Location = new Point(20, 80 + 45 * i);
tf.valueChanged += new TamingFoodControl.ValueChangedEventHandler(updateTamingData);
tf.Clicked += new TamingFoodControl.ClickedEventHandler(onlyOneFood);
foodControls.Add(tf);
Controls.Add(tf);
i++;
}
this.ResumeLayout();
if (foodControls.Count > 0)
{
foodControls[0].amount = Taming.foodAmountNeeded(sI, (int)nudLevel.Value, foodControls[0].foodName, td.nonViolent);
}
}
}