示例#1
0
        private void setBreedingData(string species = "")
        {
            int si = Values.V.speciesNames.IndexOf(species);

            listViewRaisingTimes.Items.Clear();
            if (si < 0 || Values.V.species[si].breeding == null)
            {
                listViewRaisingTimes.Items.Add("n/a yet");
                labelBreedingInfos.Text = "";
            }
            else
            {
                string   incubationMode;
                TimeSpan babyTime, maturationTime, nextMatingMin, nextMatingMax;
                if (Raising.getRaisingTimes(speciesIndex, out incubationMode, out incubationTime, out babyTime, out maturationTime, out nextMatingMin, out nextMatingMax))
                {
                    TimeSpan totalTime = incubationTime;
                    DateTime until     = DateTime.Now.Add(totalTime);
                    string[] times     = new string[] { incubationMode, incubationTime.ToString("d':'hh':'mm':'ss"), totalTime.ToString("d':'hh':'mm':'ss"), Utils.shortTimeDate(until) };
                    listViewRaisingTimes.Items.Add(new ListViewItem(times));

                    totalTime += babyTime;
                    until      = DateTime.Now.Add(totalTime);
                    times      = new string[] { "Baby", babyTime.ToString("d':'hh':'mm':'ss"), totalTime.ToString("d':'hh':'mm':'ss"), Utils.shortTimeDate(until) };
                    listViewRaisingTimes.Items.Add(new ListViewItem(times));

                    totalTime = incubationTime + maturationTime;
                    until     = DateTime.Now.Add(totalTime);
                    times     = new string[] { "Maturation", maturationTime.ToString("d':'hh':'mm':'ss"), totalTime.ToString("d':'hh':'mm':'ss"), Utils.shortTimeDate(until) };
                    listViewRaisingTimes.Items.Add(new ListViewItem(times));

                    string eggInfo = Raising.eggTemperature(speciesIndex);
                    if (eggInfo.Length > 0)
                    {
                        eggInfo = "\n\n" + eggInfo;
                    }

                    labelBreedingInfos.Text = "Time between mating: " + nextMatingMin.ToString("d':'hh':'mm':'ss") + " to " + nextMatingMax.ToString("d':'hh':'mm':'ss")
                                              + eggInfo;
                }
            }
        }
示例#2
0
        private void setBreedingData(string species = "")
        {
            int si = Values.V.speciesNames.IndexOf(species);

            listViewRaisingTimes.Items.Clear();
            if (si < 0 || Values.V.species[si].breeding == null)
            {
                listViewRaisingTimes.Items.Add(Loc.s("naYet"));
                labelBreedingInfos.Text = "";
            }
            else
            {
                bool isGlowSpecies = Values.V.IsGlowSpecies(species);
                pedigreeCreature1.IsGlowSpecies = isGlowSpecies;
                pedigreeCreature2.IsGlowSpecies = isGlowSpecies;
                if (Raising.getRaisingTimes(speciesIndex, out string incubationMode, out incubationTime, out TimeSpan babyTime, out TimeSpan maturationTime, out TimeSpan nextMatingMin, out TimeSpan nextMatingMax))
                {
                    TimeSpan totalTime = incubationTime;
                    DateTime until     = DateTime.Now.Add(totalTime);
                    string[] times     = { incubationMode, incubationTime.ToString("d':'hh':'mm':'ss"), totalTime.ToString("d':'hh':'mm':'ss"), Utils.shortTimeDate(until) };
                    listViewRaisingTimes.Items.Add(new ListViewItem(times));

                    totalTime += babyTime;
                    until      = DateTime.Now.Add(totalTime);
                    times      = new[] { Loc.s("Baby"), babyTime.ToString("d':'hh':'mm':'ss"), totalTime.ToString("d':'hh':'mm':'ss"), Utils.shortTimeDate(until) };
                    listViewRaisingTimes.Items.Add(new ListViewItem(times));

                    totalTime = incubationTime + maturationTime;
                    until     = DateTime.Now.Add(totalTime);
                    times     = new[] { Loc.s("Maturation"), maturationTime.ToString("d':'hh':'mm':'ss"), totalTime.ToString("d':'hh':'mm':'ss"), Utils.shortTimeDate(until) };
                    listViewRaisingTimes.Items.Add(new ListViewItem(times));

                    string eggInfo = Raising.eggTemperature(speciesIndex);
                    if (eggInfo.Length > 0)
                    {
                        eggInfo = "\n\n" + eggInfo;
                    }

                    labelBreedingInfos.Text = $"{Loc.s("TimeBetweenMating")}: {nextMatingMin:d':'hh':'mm':'ss} to {nextMatingMax:d':'hh':'mm':'ss}{eggInfo}";
                }
            }
        }
        public void updateRaisingData(int speciesIndex, bool forceUpdate = false)
        {
            if (forceUpdate || this.speciesIndex != speciesIndex)
            {
                this.speciesIndex = speciesIndex;
                if (speciesIndex >= 0 && Values.V.species[speciesIndex].taming != null && Values.V.species[speciesIndex].breeding != null)
                {
                    this.SuspendLayout();
                    BreedingData bd = Values.V.species[speciesIndex].breeding;
                    string incubationMode;
                    TimeSpan incubationTime, nextMatingMin, nextMatingMax;

                listViewRaisingTimes.Items.Clear();

                if (Raising.getRaisingTimes(speciesIndex, out incubationMode, out incubationTime, out babyTime, out maturationTime, out nextMatingMin, out nextMatingMax)) {
                    string eggInfo = Raising.eggTemperature(speciesIndex);
                    if (eggInfo.Length > 0)
                        eggInfo = "\n\n" + eggInfo;

                    TimeSpan totalTime = incubationTime;
                    DateTime until = DateTime.Now.Add(totalTime);
                    string[] times = new string[] { incubationMode, incubationTime.ToString("d':'hh':'mm':'ss"), totalTime.ToString("d':'hh':'mm':'ss"), Utils.shortTimeDate(until) };
                    listViewRaisingTimes.Items.Add(new ListViewItem(times));

                    totalTime += babyTime;
                    until = DateTime.Now.Add(totalTime);
                    times = new string[] { "Baby", babyTime.ToString("d':'hh':'mm':'ss"), totalTime.ToString("d':'hh':'mm':'ss"), Utils.shortTimeDate(until) };
                    listViewRaisingTimes.Items.Add(new ListViewItem(times));

                    totalTime = incubationTime + maturationTime;
                    until = DateTime.Now.Add(totalTime);
                    times = new string[] { "Maturation", maturationTime.ToString("d':'hh':'mm':'ss"), totalTime.ToString("d':'hh':'mm':'ss"), Utils.shortTimeDate(until) };
                    listViewRaisingTimes.Items.Add(new ListViewItem(times));

                        // food amount needed
                        string foodadmount = "";
                        double babyfood, totalfood;
                        if (Values.V.species[speciesIndex].taming.eats != null &&
                            uiControls.Trough.foodAmount(speciesIndex, Values.V.babyFoodConsumptionSpeedMultiplier, out babyfood, out totalfood))
                        {
                            if (Values.V.species[speciesIndex].taming.eats.IndexOf("Raw Meat") >= 0)
                            {
                                foodadmount = "\n\nFood for Baby-Phase: ~" + Math.Ceiling(babyfood / 50) + " Raw Meat"
                                    + "\nTotal Food for maturation: ~" + Math.Ceiling(totalfood / 50) + " Raw Meat";
                            }
                            else if (Values.V.species[speciesIndex].taming.eats.IndexOf("Mejoberry") >= 0)
                            {
                                foodadmount = "\n\nFood for Baby-Phase: ~" + Math.Ceiling(babyfood / 30) + " Mejoberries"
                                    + "\nTotal Food for maturation: ~" + Math.Ceiling(totalfood / 30) + " Mejoberries";
                            }
                            foodadmount += "\n - Loss by spoiling is only a rough estimate and may vary.";
                        }

                        labelRaisingInfos.Text = "Time between mating: " + nextMatingMin.ToString("d':'hh':'mm':'ss") + " to " + nextMatingMax.ToString("d':'hh':'mm':'ss")
                            + eggInfo
                            + foodadmount;

                        tabPageMaturationProgress.Enabled = true;
                    }
                    else
                    {
                        labelRaisingInfos.Text = "No raising-data available.";
                        tabPageMaturationProgress.Enabled = false;
                    }

                    labelRaisingInfos.Text = "Time between mating: " + nextMatingMin.ToString("d':'hh':'mm':'ss") + " to " + nextMatingMax.ToString("d':'hh':'mm':'ss")
                        + eggInfo
                        + foodadmount;

                        tabPageMaturationProgress.Enabled = true;
                    }
                    else
                    {
                        labelRaisingInfos.Text = "No raising-data available.";
                        tabPageMaturationProgress.Enabled = false;
                    }

                    ResumeLayout();
                }
                else
                {
                    // no taming- or breeding-data available
                    labelRaisingInfos.Text = "No raising-data available.";
                    tabPageMaturationProgress.Enabled = false;
                }
            }