Esempio n. 1
0
        /// <summary>
        ///     Resets the system.
        /// </summary>
        /// <param name="sender">The sender object</param>
        /// <param name="e">The event arguments</param>
        private void btnReset_Click(object sender, EventArgs e)
        {
            OurSystem.ResetSystem();
            LblSysAge.Content  = "";
            LblSysName.Content = "";

            OurSystem.SysStars.Clear();
            StarTable.Clear();

            LblNumberPlanets.Content = "";
            PlanetTable.Clear();
        }
Esempio n. 2
0
        /// <summary>
        ///     Starts the planetary generator
        /// </summary>
        /// <param name="sender">The sender object</param>
        /// <param name="e">The event arguments</param>
        private void btnGenPlanets_Click(object sender, EventArgs e)
        {
            CreatePlanetsFinished = false;

            //clear the tables.
            if (OurSystem.CountPlanets() > 0)
            {
                OurSystem.ClearPlanets();
                PlanetTable.Clear();
            }

            var pCs = new CreatePlanets(OurSystem, VelvetBag, this);

            //register a closed event here.
            pCs.Closing += createPlanets_Closed;
            pCs.ShowDialog();
        }
Esempio n. 3
0
        /// <summary>
        ///     The object called when the create planets form is closed. Checks to see if we should update the listing
        /// </summary>
        /// <param name="sender">The sender object</param>
        /// <param name="e">The event arguments</param>
        private void createPlanets_Closed(object sender, EventArgs e)
        {
            if (CreatePlanetsFinished)
            {
                LblNumberPlanets.Content = OurSystem.CountPlanets().ToString();
                foreach (var s in OurSystem.SysStars)
                {
                    foreach (var pl in s.SysPlanets)
                    {
                        if (pl.BaseType == Satellite.BasetypeEmpty)
                        {
                            continue;
                        }
                        var ourValues = new object[10];
                        ourValues[0] = pl.Name;

                        if (OptionCont.ExpandAsteroidBelt != null && (pl.BaseType != Satellite.BasetypeAsteroidbelt || (bool)OptionCont.ExpandAsteroidBelt))
                        {
                            ourValues[1] = pl.DescSizeType();
                        }
                        if (pl.BaseType == Satellite.BasetypeAsteroidbelt)
                        {
                            ourValues[1] = "Asteroid Belt";
                        }

                        ourValues[2] = Math.Round(pl.DiameterInKm(), 2);
                        ourValues[3] = Math.Round(pl.OrbitalRadius, 2);
                        ourValues[4] = Math.Round(pl.Gravity * Satellite.Gforce, 2);

                        if (pl.BaseType == Satellite.BasetypeAsteroidbelt)
                        {
                            ourValues[5] = "None.";
                        }

                        if (pl.BaseType == Satellite.BasetypeGasgiant)
                        {
                            ourValues[5] = "Superdense Atmosphere.";
                        }

                        if (pl.BaseType == Satellite.BasetypeMoon || pl.BaseType == Satellite.BasetypeTerrestial)
                        {
                            ourValues[5] = pl.GetDescAtmCategory() + "(" + Math.Round(pl.AtmPres, 2) + ")";
                        }

                        ourValues[6] = pl.DescAtm();
                        ourValues[7] = pl.HydCoverage * 100 + "%";

                        if (pl.BaseType == Satellite.BasetypeMoon || pl.BaseType == Satellite.BasetypeTerrestial)
                        {
                            ourValues[8] = pl.GetClimateDesc(pl.GetClimate(pl.SurfaceTemp)) + "( " + Math.Round(pl.SurfaceTemp, 2) + "K/ " + Math.Round(LibStarGen.ConvertTemp("kelvin", "celsius", pl.SurfaceTemp), 2) + "C)";
                        }
                        else
                        {
                            ourValues[8] = "Blackbody Temperature: " + Math.Round(pl.BlackbodyTemp, 2) + "K";
                        }

                        ourValues[9] = pl.GetRvmDesc();

                        PlanetTable.Rows.Add(ourValues);
                    }
                }
            }
        }