Пример #1
0
        public void setSpeciesIndex(int speciesIndex)
        {
            if (speciesIndex >= 0 && Values.V.species[speciesIndex].taming != null)
            {
                this.speciesIndex = speciesIndex;

                boneDamageAdjusters = Taming.boneDamageAdjustersImmobilisation(speciesIndex);

                updateCalculation = false;
                this.SuspendLayout();
                TamingData td = Values.V.species[speciesIndex].taming;


                foodDepletion = td.foodConsumptionBase * td.foodConsumptionMult * Values.V.tamingFoodRateMultiplier;

                TamingFoodControl tf;
                int i = 0;
                if (td.eats != null)
                {
                    for (i = 0; i < td.eats.Count; i++)
                    {
                        string f = td.eats[i];
                        if (i >= foodControls.Count)
                        {
                            tf               = new TamingFoodControl(f);
                            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);
                        }
                        else
                        {
                            tf          = foodControls[i];
                            tf.FoodName = f;
                            tf.Show();
                        }
                        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;
                        }
                    }
                }

                for (int fci = foodControls.Count - 1; fci >= i; fci--)
                {
                    foodControls[fci].Hide();
                }

                if (i > 0)
                {
                    foodControls[0].amount = Taming.foodAmountNeeded(speciesIndex, (int)nudLevel.Value, evolutionEvent, foodControls[0].FoodName, td.nonViolent);
                }

                updateCalculation = true;
                updateFirstFeedingWaiting();
                updateTamingData();

                ResumeLayout();
            }
        }