public WorldPreset(string name, WorldType worldType, AxialTilt axialTilt, RainfallModifier rainfallModifier, OverallTemperature temperature, OverallPopulation population)
 {
     Name             = name ?? throw new ArgumentNullException(nameof(name));
     WorldType        = worldType;
     AxialTilt        = axialTilt;
     RainfallModifier = rainfallModifier;
     Temperature      = temperature;
     Population       = population;
 }
        private void DoAxialTiltSlider(float single)
        {
            Widgets.Label(new Rect(0f, single, 200f, 30f), "Planets.AxialTilt".Translate());
            Rect      rect           = new Rect(200f, single, 200f, 30f);
            AxialTilt axialTiltCheck = Planets_GameComponent.axialTilt;

            Planets_GameComponent.axialTilt = (AxialTilt)Mathf.RoundToInt(Widgets.HorizontalSlider(rect, (float)Planets_GameComponent.axialTilt, 0f, (float)(AxialTiltUtility.EnumValuesCount - 1), true, "Planets.AxialTilt_Normal".Translate(), "Planets.AxialTilt_Low".Translate(), "Planets.AxialTilt_High".Translate(), 1f));
            if (Planets_GameComponent.axialTilt != axialTiltCheck)
            {
                this.CurrentWorldPreset = "Planets.Custom";
            }
            TooltipHandler.TipRegion(new Rect(0f, single, rect.xMax, rect.height), "Planets.AxialTiltTip".Translate());
        }
 public WorldPresetBuilder AxialTilt(AxialTilt value)
 {
     this.axialTilt = value;
     return(this);
 }
        public override void DoWindowContents(Rect rect)
        {
            base.DrawPageTitle(rect);
            GUI.BeginGroup(base.GetMainRect(rect, 0f, false));
            Text.Font = GameFont.Small;
            //
            // PLANET SEED
            //
            float single = 0f;

            Widgets.Label(new Rect(0f, single, 200f, 30f), "WorldSeed".Translate());
            Rect rect1 = new Rect(200f, single, 200f, 30f);

            this.seedString = Widgets.TextField(rect1, this.seedString);
            single         += 40f;
            Rect rect2 = new Rect(200f, single, 200f, 30f);

            if (Widgets.ButtonText(rect2, "RandomizeSeed".Translate(), true, false, true))
            {
                SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(null);
                this.seedString = GenText.RandomSeedString();
            }
            //
            // PLANET SIZE (IF "MY LITTLE PLANET" IS IN USE)
            //
            if (ModsConfig.ActiveModsInLoadOrder.Any(mod => mod.Name.Contains("My Little Planet")))
            {
                single += 80f;
                Widgets.Label(new Rect(0f, single, 200f, 30f), "MLPWorldPlanetSize".Translate());
                Rect rect7 = new Rect(200f, single, 200f, 30f);
                Planets_GameComponent.subcount = Mathf.RoundToInt(Widgets.HorizontalSlider(rect7, Planets_GameComponent.subcount, 6f, 10f, true, null, "MLPWorldTiny".Translate(), "MLPWorldDefault".Translate(), 1f));
            }
            //
            // PLANET COVERAGE
            //
            single += 80f;
            Widgets.Label(new Rect(0f, single, 200f, 30f), "PlanetCoverage".Translate());
            Rect rect3 = new Rect(200f, single, 200f, 30f);

            if (Widgets.ButtonText(rect3, this.planetCoverage.ToStringPercent(), true, false, true))
            {
                List <FloatMenuOption> floatMenuOptions = new List <FloatMenuOption>();
                float[] singleArray = Planets_CreateWorldParams.PlanetCoverages;
                for (int i = 0; i < (int)singleArray.Length; i++)
                {
                    float           single1         = singleArray[i];
                    string          stringPercent   = single1.ToStringPercent();
                    FloatMenuOption floatMenuOption = new FloatMenuOption(stringPercent, () => {
                        if (this.planetCoverage != single1)
                        {
                            this.planetCoverage = single1;
                            if (this.planetCoverage < 0.15f)
                            {
                                Messages.Message("Planets.MessageLowPlanetCoverageWarning".Translate(), MessageTypeDefOf.CautionInput, false);
                            }
                            if (this.planetCoverage > 0.7f)
                            {
                                Messages.Message("MessageMaxPlanetCoveragePerformanceWarning".Translate(), MessageTypeDefOf.CautionInput, false);
                            }
                        }
                    }, MenuOptionPriority.Default, null, null, 0f, null, null);
                    floatMenuOptions.Add(floatMenuOption);
                }
                Find.WindowStack.Add(new FloatMenu(floatMenuOptions));
            }
            TooltipHandler.TipRegion(new Rect(0f, single, rect3.xMax, rect3.height), "PlanetCoverageTip".Translate());
            //
            // WORLD TYPE PRESETS
            //
            single += 80f;
            Widgets.Label(new Rect(0f, single, 200f, 30f), "Planets.WorldPresets".Translate());
            Rect rect8 = new Rect(200f, single, 200f, 30f);

            if (Widgets.ButtonText(rect8, this.worldPreset.Translate(), true, false, true))
            {
                List <FloatMenuOption> floatMenuOptions = new List <FloatMenuOption>();
                string[] singleArray = Planets_CreateWorldParams.WorldPresets;
                for (int i = 0; i < (int)singleArray.Length; i++)
                {
                    string          single1           = singleArray[i];
                    string          single1Translated = single1.Translate();
                    FloatMenuOption floatMenuOption   = new FloatMenuOption(single1Translated, () => {
                        if (this.worldPreset != single1)
                        {
                            this.worldPreset = single1;
                            if (this.worldPreset == "Planets.Vanilla")
                            {
                                Planets_GameComponent.worldType = WorldType.Vanilla;
                                Planets_GameComponent.axialTilt = AxialTilt.Normal;
                                this.rainfallMod = RainfallModifier.Normal;
                                this.temperature = OverallTemperature.Normal;
                            }
                            else if (this.worldPreset == "Planets.Desert")
                            {
                                Planets_GameComponent.worldType = WorldType.Dry;
                                Planets_GameComponent.axialTilt = AxialTilt.Normal;
                                this.rainfallMod = RainfallModifier.LittleBitLess;
                                this.temperature = OverallTemperature.LittleBitWarmer;
                            }
                            else if (this.worldPreset == "Planets.Frozen")
                            {
                                Planets_GameComponent.worldType = WorldType.VeryDry;
                                Planets_GameComponent.axialTilt = AxialTilt.Normal;
                                this.rainfallMod = RainfallModifier.LittleBitLess;
                                this.temperature = OverallTemperature.Cold;
                            }
                            else if (this.worldPreset == "Planets.Earthlike")
                            {
                                Planets_GameComponent.worldType = WorldType.Earthlike;
                                Planets_GameComponent.axialTilt = AxialTilt.Normal;
                                this.rainfallMod = RainfallModifier.Normal;
                                this.temperature = OverallTemperature.Normal;
                            }
                            else if (this.worldPreset == "Planets.Forest")
                            {
                                Planets_GameComponent.worldType = WorldType.Vanilla;
                                Planets_GameComponent.axialTilt = AxialTilt.Normal;
                                this.rainfallMod = RainfallModifier.LittleBitMore;
                                this.temperature = OverallTemperature.LittleBitColder;
                            }
                            else if (this.worldPreset == "Planets.Iceball")
                            {
                                Planets_GameComponent.worldType = WorldType.Vanilla;
                                Planets_GameComponent.axialTilt = AxialTilt.Normal;
                                this.rainfallMod = RainfallModifier.Normal;
                                this.temperature = OverallTemperature.VeryCold;
                            }
                            else if (this.worldPreset == "Planets.Jungle")
                            {
                                Planets_GameComponent.worldType = WorldType.Earthlike;
                                Planets_GameComponent.axialTilt = AxialTilt.Normal;
                                this.rainfallMod = RainfallModifier.LittleBitMore;
                                this.temperature = OverallTemperature.LittleBitWarmer;
                            }
                            else if (this.worldPreset == "Planets.Ocean")
                            {
                                Planets_GameComponent.worldType = WorldType.Waterworld;
                                Planets_GameComponent.axialTilt = AxialTilt.Normal;
                                this.rainfallMod = RainfallModifier.Normal;
                                this.temperature = OverallTemperature.Normal;
                            }
                            else
                            {
                            }
                        }
                    }, MenuOptionPriority.Default, null, null, 0f, null, null);
                    floatMenuOptions.Add(floatMenuOption);
                }
                Find.WindowStack.Add(new FloatMenu(floatMenuOptions));
            }
            TooltipHandler.TipRegion(new Rect(0f, single, rect8.xMax, rect8.height), "Planets.WorldPresetsTip".Translate());
            //
            // OCEAN SLIDER
            //
            single += 80f;
            Widgets.Label(new Rect(0f, single, 200f, 30f), "Planets.OceanType".Translate());
            Rect      rect6          = new Rect(200f, single, 200f, 30f);
            WorldType worldTypeCheck = Planets_GameComponent.worldType;

            Planets_GameComponent.worldType = (WorldType)Mathf.RoundToInt(Widgets.HorizontalSlider(rect6, (float)Planets_GameComponent.worldType, 0f, (float)(WorldTypeUtility.EnumValuesCount - 1), true, "Planets.OceanType_Earthlike".Translate(), "Planets.OceanType_Waterworld".Translate(), "Planets.OceanType_Barren".Translate(), 1f));
            if (Planets_GameComponent.worldType != worldTypeCheck)
            {
                this.worldPreset = "Planets.Custom";
            }
            TooltipHandler.TipRegion(new Rect(0f, single, rect6.xMax, rect6.height), "Planets.OceanTypeTip".Translate());
            //
            // RAINFALL SLIDER
            //
            single += 40f;
            Widgets.Label(new Rect(0f, single, 200f, 30f), "PlanetRainfall".Translate());
            Rect             rect4            = new Rect(200f, single, 200f, 30f);
            RainfallModifier rainfallModCheck = this.rainfallMod;

            this.rainfallMod = (RainfallModifier)Mathf.RoundToInt(Widgets.HorizontalSlider(rect4, (float)this.rainfallMod, 0f, (float)(RainfallModifierUtility.EnumValuesCount - 1), true, "PlanetRainfall_Normal".Translate(), "PlanetRainfall_Low".Translate(), "PlanetRainfall_High".Translate(), 1f));
            if (this.rainfallMod != rainfallModCheck)
            {
                this.worldPreset = "Planets.Custom";
            }
            TooltipHandler.TipRegion(new Rect(0f, single, rect4.xMax, rect4.height), "Planets.RainfallTip".Translate());
            //
            // TEMPERATURE SLIDER
            //
            single += 40f;
            Widgets.Label(new Rect(0f, single, 200f, 30f), "PlanetTemperature".Translate());
            Rect rect5 = new Rect(200f, single, 200f, 30f);
            OverallTemperature temperatureCheck = this.temperature;

            this.temperature = (OverallTemperature)Mathf.RoundToInt(Widgets.HorizontalSlider(rect5, (float)this.temperature, 0f, (float)(OverallTemperatureUtility.EnumValuesCount - 1), true, "PlanetTemperature_Normal".Translate(), "PlanetTemperature_Low".Translate(), "PlanetTemperature_High".Translate(), 1f));
            if (this.temperature != temperatureCheck)
            {
                this.worldPreset = "Planets.Custom";
            }
            //
            // AXIAL TILT
            //
            single += 40f;
            Widgets.Label(new Rect(0f, single, 200f, 30f), "Planets.AxialTilt".Translate());
            Rect      rect9          = new Rect(200f, single, 200f, 30f);
            AxialTilt axialTiltCheck = Planets_GameComponent.axialTilt;

            Planets_GameComponent.axialTilt = (AxialTilt)Mathf.RoundToInt(Widgets.HorizontalSlider(rect9, (float)Planets_GameComponent.axialTilt, 0f, (float)(AxialTiltUtility.EnumValuesCount - 1), true, "Planets.AxialTilt_Normal".Translate(), "Planets.AxialTilt_Low".Translate(), "Planets.AxialTilt_High".Translate(), 1f));
            if (Planets_GameComponent.axialTilt != axialTiltCheck)
            {
                this.worldPreset = "Planets.Custom";
            }
            TooltipHandler.TipRegion(new Rect(0f, single, rect9.xMax, rect9.height), "Planets.AxialTiltTip".Translate());
            GUI.EndGroup();
            //
            // BOTTOM BUTTONS
            //
            base.DoBottomButtons(rect, "WorldGenerate".Translate(), "Planets.Random".Translate(), new Action(this.Randomize), true, true);
        }