Пример #1
0
 public void Reset()
 {
     this.seedString     = GenText.RandomSeedString();
     this.planetCoverage = ((Prefs.DevMode && UnityData.isEditor) ? 0.05f : 0.3f);
     this.rainfall       = OverallRainfall.Normal;
     this.temperature    = OverallTemperature.Normal;
 }
Пример #2
0
 public void Reset()
 {
     this.seedString     = GenText.RandomSeedString();
     this.planetCoverage = (float)((Prefs.DevMode && UnityData.isEditor) ? 0.05000000074505806 : 0.30000001192092896);
     this.rainfall       = OverallRainfall.Normal;
     this.temperature    = OverallTemperature.Normal;
 }
        protected override bool CanDoNext()
        {
            if (!base.CanDoNext())
            {
                return(false);
            }
            this.rainfall = RainfallModifierUtility.GetModifiedRainfall(Planets_GameComponent.worldType, this.rainfallMod);
            Planets_TemperatureTuning.SetSeasonalCurve();
            string generationString = "GeneratingWorld";

            if (Controller.Settings.randomPlanet.Equals(true))
            {
                generationString = "Planets.GeneratingRandom";
                Controller.Settings.randomPlanet = false;
            }
            LongEventHandler.QueueLongEvent(() =>
            {
                Find.GameInitData.ResetWorldRelatedMapInitData();

                Current.Game.World = WorldGenerator.GenerateWorld(this.planetCoverage, this.seedString, this.rainfall, this.temperature, this.population);
                LongEventHandler.ExecuteWhenFinished(() =>
                {
                    if (this.next != null)
                    {
                        Find.WindowStack.Add(this.next);
                    }
                    MemoryUtility.UnloadUnusedUnityAssets();
                    Find.World.renderer.RegenerateAllLayersNow();
                    this.Close(true);
                });
            }, generationString, doAsynchronously: true, exceptionHandler: null);
            return(false);
        }
Пример #4
0
        public static SimpleCurve GetRainfallCurve(this OverallRainfall overallRainfall)
        {
            switch (overallRainfall)
            {
            case OverallRainfall.AlmostNone:
                return(Curve_AlmostNone);

            case OverallRainfall.Little:
                return(Curve_Little);

            case OverallRainfall.LittleBitLess:
                return(Curve_LittleBitLess);

            case OverallRainfall.LittleBitMore:
                return(Curve_LittleBitMore);

            case OverallRainfall.High:
                return(Curve_High);

            case OverallRainfall.VeryHigh:
                return(Curve_VeryHigh);

            default:
                return(null);
            }
        }
Пример #5
0
 public void Reset()
 {
     _seedString     = GenText.RandomSeedString();
     _planetCoverage = Prefs.DevMode && UnityData.isEditor ? 0.05f : 0.3f;
     _intCoverage    = Prefs.DevMode && UnityData.isEditor ? 5 : 30;
     _rainfall       = OverallRainfall.Normal;
     _temperature    = OverallTemperature.Normal;
 }
Пример #6
0
 public void Reset()
 {
     seedString     = GenText.RandomSeedString();
     planetCoverage = ((!Prefs.DevMode || !UnityData.isEditor) ? 0.3f : 0.05f);
     rainfall       = OverallRainfall.Normal;
     temperature    = OverallTemperature.Normal;
     population     = OverallPopulation.Normal;
 }
 public PagePreciseWorldGeneration(float planetCoverage, string seedString, OverallRainfall rainFall, OverallTemperature temperature, OverallPopulation population, Dictionary <FactionDef, int> factionCounts)
 {
     _planetCoverage = planetCoverage;
     _seedString     = seedString;
     _rainfall       = rainFall;
     _temperature    = temperature;
     _population     = population;
     _factionCounts  = factionCounts;
 }
Пример #8
0
        public override void DoWindowContents(Rect rect)
        {
            DrawPageTitle(rect);
            GUI.BeginGroup(GetMainRect(rect));
            Text.Font = GameFont.Small;
            var num = 0f;

            Widgets.Label(new Rect(0f, num, 200f, 30f), "WorldSeed".Translate());
            var rect2 = new Rect(200f, num, 200f, 30f);

            _seedString = Widgets.TextField(rect2, _seedString);
            num        += 40f;
            var rect3 = new Rect(200f, num, 200f, 30f);

            if (Widgets.ButtonText(rect3, "RandomizeSeed".Translate()))
            {
                SoundDefOf.Tick_Tiny.PlayOneShotOnCamera();
                _seedString = GenText.RandomSeedString();
            }

            num      += 40f;
            Text.Font = GameFont.Tiny;
            var textAnchorBackup = Text.Anchor;

            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(new Rect(0, num, rect3.xMax, 20f), "[Prepare Landing] Precise World Generation %");
            Text.Font   = GameFont.Small;
            Text.Anchor = textAnchorBackup;

            num += 20f;
            Widgets.Label(new Rect(0f, num, 200f, 30f), $"{"PlanetCoverage".Translate()} [1,100]%");
            var rect4 = new Rect(200f, num, 200f, 30f);

            //
            TextFieldNumericCoverage(rect4.LeftHalf());
            ButtonCoverage(rect4.RightHalf());
            //

            TooltipHandler.TipRegion(new Rect(0f, num, rect4.xMax, rect4.height), "PlanetCoverageTip".Translate());
            num += 40f;
            Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetRainfall".Translate());
            var rect5 = new Rect(200f, num, 200f, 30f);

            _rainfall = (OverallRainfall)Mathf.RoundToInt(Widgets.HorizontalSlider(rect5, (float)_rainfall, 0f,
                                                                                   OverallRainfallUtility.EnumValuesCount - 1, true, "PlanetRainfall_Normal".Translate(),
                                                                                   "PlanetRainfall_Low".Translate(), "PlanetRainfall_High".Translate(), 1f));
            num += 40f;
            Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetTemperature".Translate());
            var rect6 = new Rect(200f, num, 200f, 30f);

            _temperature = (OverallTemperature)Mathf.RoundToInt(Widgets.HorizontalSlider(rect6, (float)_temperature,
                                                                                         0f, OverallTemperatureUtility.EnumValuesCount - 1, true, "PlanetTemperature_Normal".Translate(),
                                                                                         "PlanetTemperature_Low".Translate(), "PlanetTemperature_High".Translate(), 1f));
            GUI.EndGroup();
            DoBottomButtons(rect, "WorldGenerate".Translate(), "Reset".Translate(), Reset);
        }
 public static SimpleCurve GetRainfallCurve(this OverallRainfall overallRainfall)
 {
     return(overallRainfall switch
     {
         OverallRainfall.AlmostNone => Curve_AlmostNone,
         OverallRainfall.Little => Curve_Little,
         OverallRainfall.LittleBitLess => Curve_LittleBitLess,
         OverallRainfall.LittleBitMore => Curve_LittleBitMore,
         OverallRainfall.High => Curve_High,
         OverallRainfall.VeryHigh => Curve_VeryHigh,
         _ => null,
     });
Пример #10
0
        public static World GenerateWorld(float planetCoverage, string seedString, OverallRainfall overallRainfall, OverallTemperature overallTemperature)
        {
            DeepProfiler.Start("GenerateWorld");
            Rand.PushState();
            int seedFromSeedString = WorldGenerator.GetSeedFromSeedString(seedString);

            Rand.Seed = seedFromSeedString;
            World creatingWorld;

            try
            {
                Current.CreatingWorld = new World();
                Current.CreatingWorld.info.seedString         = seedString;
                Current.CreatingWorld.info.planetCoverage     = planetCoverage;
                Current.CreatingWorld.info.overallRainfall    = overallRainfall;
                Current.CreatingWorld.info.overallTemperature = overallTemperature;
                Current.CreatingWorld.info.name = NameGenerator.GenerateName(RulePackDefOf.NamerWorld, null, false, null, null);
                WorldGenerator.tmpGenSteps.Clear();
                WorldGenerator.tmpGenSteps.AddRange(WorldGenerator.GenStepsInOrder);
                for (int i = 0; i < WorldGenerator.tmpGenSteps.Count; i++)
                {
                    DeepProfiler.Start("WorldGenStep - " + WorldGenerator.tmpGenSteps[i]);
                    try
                    {
                        Rand.Seed = Gen.HashCombineInt(seedFromSeedString, WorldGenerator.GetSeedPart(WorldGenerator.tmpGenSteps, i));
                        WorldGenerator.tmpGenSteps[i].worldGenStep.GenerateFresh(seedString);
                    }
                    catch (Exception arg)
                    {
                        Log.Error("Error in WorldGenStep: " + arg, false);
                    }
                    finally
                    {
                        DeepProfiler.End();
                    }
                }
                Rand.Seed = seedFromSeedString;
                Current.CreatingWorld.grid.StandardizeTileData();
                Current.CreatingWorld.FinalizeInit();
                Find.Scenario.PostWorldGenerate();
                creatingWorld = Current.CreatingWorld;
            }
            finally
            {
                Rand.PopState();
                DeepProfiler.End();
                Current.CreatingWorld = null;
            }
            return(creatingWorld);
        }
Пример #11
0
        public static World GenerateWorld(float planetCoverage, string seedString, OverallRainfall overallRainfall, OverallTemperature overallTemperature)
        {
            Rand.Seed             = (GenText.StableStringHash(seedString) ^ 4323276);
            Current.CreatingWorld = new World();
            Current.CreatingWorld.info.planetCoverage     = planetCoverage;
            Current.CreatingWorld.info.seedString         = seedString;
            Current.CreatingWorld.info.overallRainfall    = overallRainfall;
            Current.CreatingWorld.info.overallTemperature = overallTemperature;
            Current.CreatingWorld.info.name = NameGenerator.GenerateName(RulePackDefOf.NamerWorld, null, false);
            WorldGenerator_Grid.GenerateGridIntoWorld(seedString);
            Current.CreatingWorld.ConstructComponents();
            FactionGenerator.GenerateFactionsIntoWorld(seedString);
            Current.CreatingWorld.FinalizeInit();
            World creatingWorld = Current.CreatingWorld;

            Current.CreatingWorld = null;
            return(creatingWorld);
        }
Пример #12
0
 public static void Prefix(ref float planetCoverage, ref string seedString, ref OverallRainfall overallRainfall, ref OverallTemperature overallTemperature)
 {
     Loger.Log("Client HarmonyPatch WorldGenerator.GenerateWorld()");
     //параметры генерации мира
     if (GameStarter.SetPlanetCoverage > 0)
     {
         planetCoverage = GameStarter.SetPlanetCoverage;
     }
     if (!string.IsNullOrEmpty(GameStarter.SetSeed))
     {
         seedString = GameStarter.SetSeed;
     }
     if (GameStarter.SetPlanetCoverage > 0 || !string.IsNullOrEmpty(GameStarter.SetSeed))
     {
         overallRainfall    = GameStarter.SetOverallRainfall;
         overallTemperature = GameStarter.SetOverallTemperature;
     }
 }
Пример #13
0
        public static World GenerateWorld(float planetCoverage, string seedString, OverallRainfall overallRainfall, OverallTemperature overallTemperature)
        {
            DeepProfiler.Start("GenerateWorld");
            Rand.Seed             = (GenText.StableStringHash(seedString) ^ 4323276);
            Current.CreatingWorld = new World();
            Current.CreatingWorld.info.planetCoverage     = planetCoverage;
            Current.CreatingWorld.info.seedString         = seedString;
            Current.CreatingWorld.info.overallRainfall    = overallRainfall;
            Current.CreatingWorld.info.overallTemperature = overallTemperature;
            Current.CreatingWorld.info.name = NameGenerator.GenerateName(RulePackDefOf.NamerWorld, null, false, null);
            foreach (WorldGenStepDef current in from gs in DefDatabase <WorldGenStepDef> .AllDefs
                     orderby gs.order
                     select gs)
            {
                DeepProfiler.Start("WorldGenStep - " + current);
                try
                {
                    current.worldGenStep.GenerateFresh(seedString);
                }
                catch (Exception arg)
                {
                    Log.Error("Error in WorldGenStep: " + arg);
                }
                finally
                {
                    DeepProfiler.End();
                }
            }
            Current.CreatingWorld.grid.StandardizeTileData();
            Current.CreatingWorld.FinalizeInit();
            Find.Scenario.PostWorldGenerate();
            World creatingWorld = Current.CreatingWorld;

            Current.CreatingWorld = null;
            DeepProfiler.End();
            return(creatingWorld);
        }
Пример #14
0
        public override void DoWindowContents(Rect rect)
        {
            base.DrawPageTitle(rect);
            GUI.BeginGroup(base.GetMainRect(rect, 0f, false));
            Text.Font = GameFont.Small;
            float num = 0f;

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

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

            if (Widgets.ButtonText(rect3, "RandomizeSeed".Translate(), true, false, true))
            {
                SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(null);
                this.seedString = GenText.RandomSeedString();
            }
            num += 40f;
            Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetCoverage".Translate());
            Rect rect4 = new Rect(200f, num, 200f, 30f);

            if (Widgets.ButtonText(rect4, this.planetCoverage.ToStringPercent(), true, false, true))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                float[] array = (!Prefs.DevMode) ? Page_CreateWorldParams.PlanetCoverages : Page_CreateWorldParams.PlanetCoveragesDev;
                for (int i = 0; i < array.Length; i++)
                {
                    float  coverage = array[i];
                    string text     = coverage.ToStringPercent();
                    if (coverage <= 0.1f)
                    {
                        text += " (dev)";
                    }
                    FloatMenuOption item = new FloatMenuOption(text, delegate
                    {
                        if (this.planetCoverage != coverage)
                        {
                            this.planetCoverage = coverage;
                            if (this.planetCoverage == 1f)
                            {
                                Messages.Message("MessageMaxPlanetCoveragePerformanceWarning".Translate(), MessageTypeDefOf.CautionInput, false);
                            }
                        }
                    }, MenuOptionPriority.Default, null, null, 0f, null, null);
                    list.Add(item);
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
            TooltipHandler.TipRegion(new Rect(0f, num, rect4.xMax, rect4.height), "PlanetCoverageTip".Translate());
            num += 40f;
            Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetRainfall".Translate());
            Rect rect5 = new Rect(200f, num, 200f, 30f);

            this.rainfall = (OverallRainfall)Mathf.RoundToInt(Widgets.HorizontalSlider(rect5, (float)this.rainfall, 0f, (float)(OverallRainfallUtility.EnumValuesCount - 1), true, "PlanetRainfall_Normal".Translate(), "PlanetRainfall_Low".Translate(), "PlanetRainfall_High".Translate(), 1f));
            num          += 40f;
            Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetTemperature".Translate());
            Rect rect6 = new Rect(200f, num, 200f, 30f);

            this.temperature = (OverallTemperature)Mathf.RoundToInt(Widgets.HorizontalSlider(rect6, (float)this.temperature, 0f, (float)(OverallTemperatureUtility.EnumValuesCount - 1), true, "PlanetTemperature_Normal".Translate(), "PlanetTemperature_Low".Translate(), "PlanetTemperature_High".Translate(), 1f));
            GUI.EndGroup();
            base.DoBottomButtons(rect, "WorldGenerate".Translate(), "Reset".Translate(), new Action(this.Reset), true, true);
        }
        protected override bool CanDoNext()
        {
            if (!base.CanDoNext())
            {
                return(false);
            }
            if (Planets_GameComponent.worldType == WorldType.Waterworld)
            {
                if (this.rainfallMod == RainfallModifier.Little)
                {
                    this.rainfall = OverallRainfall.LittleBitMore;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitLess)
                {
                    this.rainfall = OverallRainfall.High;
                }
                else if (this.rainfallMod == RainfallModifier.Normal)
                {
                    this.rainfall = OverallRainfall.VeryHigh;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitMore)
                {
                    this.rainfall = OverallRainfall.VeryHigh;
                }
                else
                {
                    this.rainfall = OverallRainfall.VeryHigh;
                }
            }
            else if (Planets_GameComponent.worldType == WorldType.Islands)
            {
                if (this.rainfallMod == RainfallModifier.Little)
                {
                    this.rainfall = OverallRainfall.Normal;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitLess)
                {
                    this.rainfall = OverallRainfall.LittleBitMore;
                }
                else if (this.rainfallMod == RainfallModifier.Normal)
                {
                    this.rainfall = OverallRainfall.High;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitMore)
                {
                    this.rainfall = OverallRainfall.VeryHigh;
                }
                else
                {
                    this.rainfall = OverallRainfall.VeryHigh;
                }
            }
            else if (Planets_GameComponent.worldType == WorldType.Earthlike)
            {
                if (this.rainfallMod == RainfallModifier.Little)
                {
                    this.rainfall = OverallRainfall.LittleBitLess;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitLess)
                {
                    this.rainfall = OverallRainfall.Normal;
                }
                else if (this.rainfallMod == RainfallModifier.Normal)
                {
                    this.rainfall = OverallRainfall.LittleBitMore;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitMore)
                {
                    this.rainfall = OverallRainfall.High;
                }
                else
                {
                    this.rainfall = OverallRainfall.VeryHigh;
                }
            }
            else if (Planets_GameComponent.worldType == WorldType.Vanilla)
            {
                if (this.rainfallMod == RainfallModifier.Little)
                {
                    this.rainfall = OverallRainfall.Little;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitLess)
                {
                    this.rainfall = OverallRainfall.LittleBitLess;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitMore)
                {
                    this.rainfall = OverallRainfall.LittleBitMore;
                }
                else if (this.rainfallMod == RainfallModifier.High)
                {
                    this.rainfall = OverallRainfall.High;
                }
                else
                {
                    this.rainfall = OverallRainfall.Normal;
                }
            }
            else if (Planets_GameComponent.worldType == WorldType.Dry)
            {
                if (this.rainfallMod == RainfallModifier.Little)
                {
                    this.rainfall = OverallRainfall.AlmostNone;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitLess)
                {
                    this.rainfall = OverallRainfall.Little;
                }
                else if (this.rainfallMod == RainfallModifier.Normal)
                {
                    this.rainfall = OverallRainfall.LittleBitLess;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitMore)
                {
                    this.rainfall = OverallRainfall.Normal;
                }
                else
                {
                    this.rainfall = OverallRainfall.LittleBitMore;
                }
            }
            else if (Planets_GameComponent.worldType == WorldType.VeryDry)
            {
                if (this.rainfallMod == RainfallModifier.Little)
                {
                    this.rainfall = OverallRainfall.AlmostNone;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitLess)
                {
                    this.rainfall = OverallRainfall.AlmostNone;
                }
                else if (this.rainfallMod == RainfallModifier.Normal)
                {
                    this.rainfall = OverallRainfall.Little;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitMore)
                {
                    this.rainfall = OverallRainfall.LittleBitLess;
                }
                else
                {
                    this.rainfall = OverallRainfall.Normal;
                }
            }
            else
            {
                if (this.rainfallMod == RainfallModifier.Little)
                {
                    this.rainfall = OverallRainfall.AlmostNone;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitLess)
                {
                    this.rainfall = OverallRainfall.AlmostNone;
                }
                else if (this.rainfallMod == RainfallModifier.Normal)
                {
                    this.rainfall = OverallRainfall.AlmostNone;
                }
                else if (this.rainfallMod == RainfallModifier.LittleBitMore)
                {
                    this.rainfall = OverallRainfall.Little;
                }
                else
                {
                    this.rainfall = OverallRainfall.LittleBitLess;
                }
            }
            Planets_TemperatureTuning.SetSeasonalCurve();
            string generationString = "GeneratingWorld";

            if (Controller.Settings.randomPlanet.Equals(true))
            {
                generationString = "Planets.GeneratingRandom";
                Controller.Settings.randomPlanet = false;
            }
            LongEventHandler.QueueLongEvent(() => {
                Find.GameInitData.ResetWorldRelatedMapInitData();
                Current.Game.World = WorldGenerator.GenerateWorld(this.planetCoverage, this.seedString, this.rainfall, this.temperature);
                LongEventHandler.ExecuteWhenFinished(() => {
                    if (this.next != null)
                    {
                        Find.WindowStack.Add(this.next);
                    }
                    MemoryUtility.UnloadUnusedUnityAssets();
                    Find.World.renderer.RegenerateAllLayersNow();
                    this.Close(true);
                });
            }, generationString, true, null);
            return(false);
        }
Пример #16
0
        public override void DoWindowContents(Rect rect)
        {
            DrawPageTitle(rect);
            GUI.BeginGroup(GetMainRect(rect));
            Text.Font = GameFont.Small;
            float num = 0f;

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

            seedString = Widgets.TextField(rect2, seedString);
            num       += 40f;
            if (Widgets.ButtonText(new Rect(200f, num, 200f, 30f), "RandomizeSeed".Translate()))
            {
                SoundDefOf.Tick_Tiny.PlayOneShotOnCamera();
                seedString = GenText.RandomSeedString();
            }
            num += 40f;
            Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetCoverage".Translate());
            Rect rect3 = new Rect(200f, num, 200f, 30f);

            if (Widgets.ButtonText(rect3, planetCoverage.ToStringPercent()))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                float[] array = Prefs.DevMode ? PlanetCoveragesDev : PlanetCoverages;
                foreach (float coverage in array)
                {
                    string text = coverage.ToStringPercent();
                    if (coverage <= 0.1f)
                    {
                        text += " (dev)";
                    }
                    FloatMenuOption item = new FloatMenuOption(text, delegate
                    {
                        if (planetCoverage != coverage)
                        {
                            planetCoverage = coverage;
                            if (planetCoverage == 1f)
                            {
                                Messages.Message("MessageMaxPlanetCoveragePerformanceWarning".Translate(), MessageTypeDefOf.CautionInput, historical: false);
                            }
                        }
                    });
                    list.Add(item);
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
            TooltipHandler.TipRegionByKey(new Rect(0f, num, rect3.xMax, rect3.height), "PlanetCoverageTip");
            num += 40f;
            Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetRainfall".Translate());
            Rect rect4 = new Rect(200f, num, 200f, 30f);

            rainfall = (OverallRainfall)Mathf.RoundToInt(Widgets.HorizontalSlider(rect4, (float)rainfall, 0f, OverallRainfallUtility.EnumValuesCount - 1, middleAlignment: true, "PlanetRainfall_Normal".Translate(), "PlanetRainfall_Low".Translate(), "PlanetRainfall_High".Translate(), 1f));
            num     += 40f;
            Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetTemperature".Translate());
            Rect rect5 = new Rect(200f, num, 200f, 30f);

            temperature = (OverallTemperature)Mathf.RoundToInt(Widgets.HorizontalSlider(rect5, (float)temperature, 0f, OverallTemperatureUtility.EnumValuesCount - 1, middleAlignment: true, "PlanetTemperature_Normal".Translate(), "PlanetTemperature_Low".Translate(), "PlanetTemperature_High".Translate(), 1f));
            num        += 40f;
            Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetPopulation".Translate());
            Rect rect6 = new Rect(200f, num, 200f, 30f);

            population = (OverallPopulation)Mathf.RoundToInt(Widgets.HorizontalSlider(rect6, (float)population, 0f, OverallPopulationUtility.EnumValuesCount - 1, middleAlignment: true, "PlanetPopulation_Normal".Translate(), "PlanetPopulation_Low".Translate(), "PlanetPopulation_High".Translate(), 1f));
            num       += 40f;
            Widgets.Label(new Rect(0f, num, 200f, 30f), "AAAA".Translate());
            Rect rect7 = new Rect(200f, num, 200f, 30f);

            GUI.EndGroup();
            DoBottomButtons(rect, "WorldGenerate".Translate(), "Reset".Translate(), Reset);
        }
Пример #17
0
        public override void DoWindowContents(Rect rect)
        {
            base.DrawPageTitle(rect);
            GUI.BeginGroup(base.GetMainRect(rect, 0f, false));
            Text.Font = GameFont.Small;
            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          = single + 40f;
            Rect rect2 = new Rect(200f, single, 200f, 30f);

            if (Widgets.ButtonText(rect2, "RandomizeSeed".Translate(), true, false, true))
            {
                SoundDefOf.TickTiny.PlayOneShotOnCamera(null);
                this.seedString = GenText.RandomSeedString();
            }
            single = single + 40f;
            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 = (!Prefs.DevMode ? ProCWP.PlanetCoverages : ProCWP.PlanetCoveragesDev);
                for (int i = 0; i < (int)singleArray.Length; i++)
                {
                    float  single1       = singleArray[i];
                    string stringPercent = single1.ToStringPercent();
                    if (single1 <= 0.1f)
                    {
                        stringPercent = string.Concat(stringPercent, " (dev)");
                    }
                    FloatMenuOption floatMenuOption = new FloatMenuOption(stringPercent, () => {
                        if (this.planetCoverage != single1)
                        {
                            this.planetCoverage = single1;
                            if (this.planetCoverage == 1f)
                            {
                                Messages.Message("MessageMaxPlanetCoveragePerformanceWarning".Translate(), MessageSound.Standard);
                            }
                        }
                    }, 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());
            single = single + 40f;
            Widgets.Label(new Rect(0f, single, 200f, 30f), "PlanetRainfall".Translate());
            Rect rect4 = new Rect(200f, single, 200f, 30f);

            this.rainfall = (OverallRainfall)Mathf.RoundToInt(Widgets.HorizontalSlider(rect4, (float)this.rainfall, 0f, (float)(OverallRainfallUtility.EnumValuesCount - 1), true, "PlanetRainfall_Normal".Translate(), "PlanetRainfall_Low".Translate(), "PlanetRainfall_High".Translate(), 1f));
            single        = single + 40f;
            Widgets.Label(new Rect(0f, single, 200f, 30f), "PlanetTemperature".Translate());
            Rect rect5 = new Rect(200f, single, 200f, 30f);

            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));
            GUI.EndGroup();
            base.DoBottomButtons(rect, "WorldGenerate".Translate(), "Reset".Translate(), new Action(this.Reset), true);
        }