Esempio n. 1
0
        public static void DrawThingsCard(Rect rect)
        {
            Listing_Standard listingStandard = new Listing_Standard();

            listingStandard.Begin(rect);

            // stuff density
            settings.densityPlant  = ThingsSlider(listingStandard, settings.densityPlant, 1, "ZMD_densityPlant");
            settings.densityAnimal = ThingsSlider(listingStandard, settings.densityAnimal, 1, "ZMD_densityAnimal");
            settings.densityRuins  = ThingsSlider(listingStandard, settings.densityRuins, 3, "ZMD_densityRuins");
            //power is 3 here to match up with actual results
            settings.densityDanger = ThingsSlider(listingStandard, settings.densityDanger, 3, "ZMD_densityDanger");
            settings.densityGeyser = ThingsSlider(listingStandard, settings.densityGeyser, 2, "ZMD_densityGeyser");
            settings.densityOre    = ThingsSlider(listingStandard, settings.densityOre, 2, "ZMD_densityOre");

            if (InterfaceUtility.SizedTextButton(listingStandard, "ZMD_chooseOreTypes".Translate()))
            {
                Find.WindowStack.Add(new OreSelectionDialog());
            }

            listingStandard.CheckboxLabeled("ZMD_flagRockChunks".Translate(), ref settings.flagRockChunks, "ZMD_flagRockChunksTooltip".Translate());


            if (ModsConfig.RoyaltyActive)
            {
                settings.animaCount = (float)Math.Round(InterfaceUtility.LabeledSlider(listingStandard, settings.animaCount, 0f, 15f, "ZMD_animaCount".Translate() + settings.animaCount));
            }

            // Reset
            if (listingStandard.ButtonText("ZMD_resetThings".Translate()))
            {
                ResetThingsSettings();
            }
            listingStandard.End();
        }
Esempio n. 2
0
        public static void DrawLakeOptions(Listing_Standard listing)
        {
            listing.Label("ZMD_featureLakeInfo".Translate());

            settings.lakeSize = InterfaceUtility.LabeledSlider(listing, settings.lakeSize, 0.04f, 1.0f, String.Format("ZMD_lakeSize".Translate(), Math.Round(100 * settings.lakeSize)));

            settings.lakeRoundness = InterfaceUtility.LabeledSlider(listing, settings.lakeRoundness, 0f, 6f, lakeRoundnessLabel, "ZMD_lakeRoundness0".Translate(), "ZMD_lakeRoundness4".Translate());

            settings.lakeBeachSize = InterfaceUtility.LabeledSlider(listing, settings.lakeBeachSize, 0f, 35f, "ZMD_lakeBeachSize".Translate(), "ZMD_size0".Translate(), "ZMD_size6".Translate());

            settings.lakeDepth = InterfaceUtility.LabeledSlider(listing, settings.lakeDepth, 0f, 1f, lakeDepthLabel, "ZMD_lakeDepth0".Translate(), "ZMD_lakeDepth4".Translate());

            listing.CheckboxLabeled("ZMD_flagLakeSalty".Translate(), ref settings.flagLakeSalty, "ZMD_flagLakeSalty".Translate());

            List <TerrainDef> shoreOptions = new List <TerrainDef>();

            shoreOptions.Add(TerrainDefOf.Soil);
            shoreOptions.Add(TerrainDef.Named("SoilRich"));
            shoreOptions.Add(TerrainDefOf.Sand);
            shoreOptions.Add(TerrainDef.Named("MarshyTerrain"));
            shoreOptions.Add(TerrainDef.Named("Mud"));
            shoreOptions.Add(TerrainDefOf.Ice);

            if (listing.ButtonTextLabeled("ZMD_lakeShore".Translate(), TerrainDef.Named(settings.lakeShore).label))
            {
                List <FloatMenuOption> shoreTerrList = new List <FloatMenuOption>();

                foreach (TerrainDef terr in shoreOptions)
                {
                    shoreTerrList.Add(new FloatMenuOption(terr.label, delegate { settings.lakeShore = terr.defName; }, MenuOptionPriority.Default));
                }

                Find.WindowStack.Add(new FloatMenu(shoreTerrList));
            }
        }
Esempio n. 3
0
        public static void DrawThingsCard(Rect rect)
        {
            Listing_Standard listingStandard = new Listing_Standard();

            listingStandard.Begin(rect);

            // stuff density
            settings.densityPlant  = ThingsSlider(listingStandard, settings.densityPlant, 1, "ZMD_densityPlant");
            settings.densityAnimal = ThingsSlider(listingStandard, settings.densityAnimal, 1, "ZMD_densityAnimal");
            settings.densityRuins  = ThingsSlider(listingStandard, settings.densityRuins, 3, "ZMD_densityRuins");
            //power is 3 here to match up with actual results
            settings.densityDanger = ThingsSlider(listingStandard, settings.densityDanger, 3, "ZMD_densityDanger");
            settings.densityGeyser = ThingsSlider(listingStandard, settings.densityGeyser, 2, "ZMD_densityGeyser");
            settings.densityOre    = ThingsSlider(listingStandard, settings.densityOre, 2, "ZMD_densityOre");

            if (ModsConfig.RoyaltyActive)
            {
                settings.animaCount = (float)Math.Round(InterfaceUtility.LabeledSlider(listingStandard, settings.animaCount, 0f, 15f, "ZMD_animaCount".Translate() + settings.animaCount));
            }

            // Reset
            if (listingStandard.ButtonText("ZMD_resetThings".Translate()))
            {
                ResetThingsSettings();
            }
            listingStandard.End();
        }
Esempio n. 4
0
        private static string GetHillRadialAmtLabel(float val)
        {
            int label = 0;

            if (val > -1.7f)        //1
            {
                label++;
            }
            if (val > -1.0f)        //2
            {
                label++;
            }
            if (val > -0.3f)        //no cluster = 3
            {
                label++;
            }
            if (val > 0.3f)         //4
            {
                label++;
            }
            if (val > 1.0f)         //5
            {
                label++;
            }
            if (val > 1.7f)         //6
            {
                label++;
            }
            return(InterfaceUtility.FormatLabel("ZMD_hillRadialAmtLabel", "ZMD_hillRadialAmt" + label));
        }
Esempio n. 5
0
        public static void LocationPicker(Listing_Standard listing, float maxDiff, ref Vector3 offset, float dotSize, string dotTex = "GUI/ZMD_dot", float rotation = 0f)
        {
            Rect riverLocRect = listing.GetRect(125f);

            riverLocRect.xMin += 20f;
            riverLocRect.xMax -= 20f;
            Listing_Standard riverLocListing = new Listing_Standard();

            riverLocListing.Begin(riverLocRect);

            Rect locSelRect = riverLocListing.GetRect(100f);

            Rect dotRect = locSelRect;

            dotRect.xMax = dotRect.xMin + locSelRect.height;
            Widgets.DrawBox(dotRect);

            Listing_Standard dotListing = new Listing_Standard();

            dotListing.Begin(dotRect);
            Rect dot = dotRect;

            dot.yMin   = 50f - 0.5f * dotSize - 100f * offset.z;
            dot.xMin   = 50f - 0.5f * dotSize + 100f * offset.x;
            dot.height = dotSize;
            dot.width  = dotSize;

            Texture2D dotIcon = ContentFinder <Texture2D> .Get(dotTex, true);

            Widgets.DrawTextureRotated(dot, dotIcon, rotation);
            dotListing.End();

            Rect dotSliderRect = locSelRect;

            dotSliderRect.xMin += locSelRect.height + 20f;

            Listing_Standard locSelListing = new Listing_Standard();

            locSelListing.Begin(dotSliderRect);

            offset.z = InterfaceUtility.LabeledSlider(locSelListing, offset.z, 0 - maxDiff, maxDiff, null, "ZMD_south".Translate(), "ZMD_north".Translate());
            offset.x = InterfaceUtility.LabeledSlider(locSelListing, offset.x, 0 - maxDiff, maxDiff, null, "ZMD_west".Translate(), "ZMD_east".Translate());

            locSelListing.End();

            riverLocListing.End();
        }
Esempio n. 6
0
        public static void DrawRoundIslandOptions(Listing_Standard listing)
        {
            listing.Label("ZMD_featurePRIInfo".Translate());

            if (listing.ButtonTextLabeled("ZMD_priIslandStyle".Translate(), priStyleLabel))
            {
                List <FloatMenuOption> featureList = new List <FloatMenuOption>();

                featureList.Add(new FloatMenuOption("ZMD_priSingleLabel".Translate(), delegate
                {
                    settings.priStyle = MapDesignerSettings.PriStyle.Single;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));

                featureList.Add(new FloatMenuOption("ZMD_priMultiLabel".Translate(), delegate
                {
                    settings.priStyle = MapDesignerSettings.PriStyle.Multi;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));

                Find.WindowStack.Add(new FloatMenu(featureList));
            }



            listing.Label("ZMD_priIslandSizeLabel".Translate());
            settings.priIslandSize = listing.Slider(settings.priIslandSize, 5f, 45f);

            if (settings.priStyle == MapDesignerSettings.PriStyle.Single)
            {
                //InterfaceUtility.LocationPicker(listing, 0.0f, ref settings.priSingleCenterDisp, 40f);

                //InterfaceUtility.LocationPicker(listing, 0.0f, ref settings.priSingleCenterDisp, settings.priIslandSize

                InterfaceUtility.LocationPicker(listing, 0.5f, ref settings.priSingleCenterDisp, 2 * settings.priIslandSize);
            }

            listing.Label("ZMD_priBeachSizeLabel".Translate());
            settings.priBeachSize = listing.Slider(settings.priBeachSize, 1f, 18f);

            //listing.CheckboxLabeled("ZMD_priMultiSpawnLabel".Translate(), ref settings.priMultiSpawn);
        }
Esempio n. 7
0
        public static void DrawTerrainCard(Rect rect)
        {
            Listing_Standard listing = new Listing_Standard();

            listing.Begin(rect);
            listing.Label("ZMD_terrainTabInfo".Translate());

            listing.GapLine();

            settings.terrainFert = InterfaceUtility.LabeledSlider(listing, settings.terrainFert, 0.30f, 2f, String.Format("ZMD_terrainFertAmt".Translate(), Math.Round(100 * settings.terrainFert)));

            settings.terrainWater = InterfaceUtility.LabeledSlider(listing, settings.terrainWater, 0.30f, 2f, String.Format("ZMD_terrainWaterAmt".Translate(), Math.Round(100 * settings.terrainWater)), null, null, null, "ZMD_terrainWaterTooltip".Translate());
            listing.CheckboxLabeled("ZMD_flagTerrainWater".Translate(), ref settings.flagCaves, "ZMD_flagTerrainWater".Translate());

            // Rocks
            listing.GapLine();

            List <ThingDef> rockList = HelperMethods.GetRockList();
            int             maxRocks = Math.Min(15, rockList.Count);

            //InterfaceUtility.LabeledIntRange(listing, ref settings.rockTypeRange, 1, 5, "ZMD_rockTypeRange".Translate());
            InterfaceUtility.LabeledIntRange(listing, ref settings.rockTypeRange, 1, maxRocks, "ZMD_rockTypeRange".Translate());

            listing.CheckboxLabeled("ZMD_flagBiomeRocks".Translate(), ref settings.flagBiomeRocks, "ZMD_flagBiomeRocksTooltip".Translate());

            if (InterfaceUtility.SizedTextButton(listing, "ZMD_chooseRockTypes".Translate()))
            {
                Find.WindowStack.Add(new RockSelectionDialog());
            }

            // reset
            listing.GapLine();
            if (listing.ButtonText("ZMD_resetTerrain".Translate()))
            {
                ResetTerrainSettings();
            }

            listing.End();
        }
Esempio n. 8
0
        public override void DoWindowContents(Rect inRect)
        {
            MapDesignerSettings settings = MapDesignerMod.mod.settings;
            List <ThingDef>     list     = HelperMethods.GetMineableList();

            Listing_Standard outerListing = new Listing_Standard();

            outerListing.Begin(inRect);

            if (outerListing.ButtonText("ZMD_resetOreTypes".Translate()))
            {
                ResetAllOre(settings, list);
            }

            Rect windowRect = outerListing.GetRect(inRect.height - outerListing.CurHeight).ContractedBy(4f);

            Rect viewRect = new Rect(0f, 0f, 400f, 50f + 24 * list.Count());

            Widgets.BeginScrollView(windowRect, ref scrollPosition, viewRect, true);

            Listing_Standard listing = new Listing_Standard();

            listing.Begin(viewRect);

            foreach (ThingDef ore in list)
            {
                float commonality = settings.oreCommonality[ore.defName];

                //listing.CheckboxLabeled(ore.label, ref commonality);

                commonality = InterfaceUtility.LabeledSlider(listing, settings.oreCommonality[ore.defName], 0f, 2.5f, ore.label);;

                settings.oreCommonality[ore.defName] = commonality;
            }

            listing.End();

            Widgets.EndScrollView();
        }
Esempio n. 9
0
 private static float ThingsSlider(Listing_Standard listing, float val = 1f, float power = 1f, string label = null)
 {
     return(InterfaceUtility.LabeledSlider(listing, val, 0f, 2.5f, UI.InterfaceUtility.FormatLabel(label, "ZMD_density" + GetDensityLabel(val)), null, null, HelperMethods.GetDisplayValue(val, power) + " x"));
 }
Esempio n. 10
0
        public static void DrawRiversCard(Rect rect)
        {
            // setting up the scrollbar
            Rect rect2 = rect.ContractedBy(4f);

            // initial height with everything collapsed
            float height = 400f;

            if (settings.flagRiverBeach)
            {
                height += 100f;
            }
            if (settings.flagRiverDir)
            {
                height += 70f;
            }
            if (settings.flagRiverLoc)
            {
                height += 150f;
            }

            Rect viewRect = new Rect(0f, 0f, rect2.width - 18f, Math.Max(height, viewHeight));

            Widgets.BeginScrollView(rect2, ref scrollPosition, viewRect, true);


            Listing_Standard listing = new Listing_Standard();

            listing.Begin(viewRect);
            listing.GapLine();

            // River size and style
            settings.sizeRiver = InterfaceUtility.LabeledSlider(listing, settings.sizeRiver, 0.1f, 3f, InterfaceUtility.FormatLabel("ZMD_sizeRiver", "ZMD_size" + ThingsCard.GetDensityLabel(settings.sizeRiver)), "ZMD_size1".Translate(), "ZMD_size6".Translate());
            Rect selStyleRect = listing.GetRect(40f);

            Rect selButtonRect = selStyleRect;
            Rect descRect      = selStyleRect;

            selButtonRect.xMax -= 0.66f * viewRect.width;
            descRect.xMin      += 0.34f * viewRect.width;
            Rect iconRect = new Rect(descRect);

            iconRect.xMin += 10f;
            iconRect.xMax  = iconRect.xMin + 40f;

            string    texPath = String.Format("GUI/{0}", GetRiverStyleLabel(settings.selRiverStyle));
            Texture2D icon    = ContentFinder <Texture2D> .Get(texPath, true);

            Widgets.DrawTextureRotated(iconRect, icon, 0);
            descRect.xMin += 60f;

            Widgets.Label(descRect, (GetRiverStyleLabel(settings.selRiverStyle) + "Desc").Translate());
            Listing_Standard Listing_selRiverStyle = new Listing_Standard();

            Listing_selRiverStyle.Begin(selButtonRect);

            // river style selection
            if (Listing_selRiverStyle.ButtonTextLabeled("ZMD_riverStyle".Translate(), GetRiverStyleLabel(settings.selRiverStyle).Translate()))
            {
                List <FloatMenuOption> riverStyleList = new List <FloatMenuOption>();

                riverStyleList.Add(new FloatMenuOption("ZMD_riverStyleVanilla".Translate(), delegate
                {
                    settings.selRiverStyle = MapDesignerSettings.RiverStyle.Vanilla;
                }));
                riverStyleList.Add(new FloatMenuOption("ZMD_riverStyleSpring".Translate(), delegate
                {
                    settings.selRiverStyle = MapDesignerSettings.RiverStyle.Spring;
                }));
                riverStyleList.Add(new FloatMenuOption("ZMD_riverStyleCanal".Translate(), delegate
                {
                    settings.selRiverStyle = MapDesignerSettings.RiverStyle.Canal;
                }));

                //riverStyleList.Add(new FloatMenuOption("ZMD_riverStyleConfluence".Translate(), delegate
                //{
                //    settings.selRiverStyle = MapDesignerSettings.RiverStyle.Confluence;
                //}));
                //riverStyleList.Add(new FloatMenuOption("ZMD_riverStyleFork".Translate(), delegate
                //{
                //    settings.selRiverStyle = MapDesignerSettings.RiverStyle.Fork;
                //}));
                //riverStyleList.Add(new FloatMenuOption("ZMD_riverStyleOxbow".Translate(), delegate
                //{
                //    settings.selRiverStyle = MapDesignerSettings.RiverStyle.Oxbow;
                //}));
                Find.WindowStack.Add(new FloatMenu(riverStyleList));
            }
            Listing_selRiverStyle.End();

            listing.Gap(listing.verticalSpacing);

            // river banks
            listing.CheckboxLabeled("ZMD_flagRiverBeach".Translate(), ref settings.flagRiverBeach, "ZMD_flagRiverBeach".Translate());

            if (MapDesignerMod.mod.settings.flagRiverBeach)
            {
                Rect riverBeachRect = listing.GetRect(90f);
                riverBeachRect.xMin += 20f;
                riverBeachRect.xMax -= 20f;
                Listing_Standard riverBeachListing = new Listing_Standard();
                riverBeachListing.Begin(riverBeachRect);

                settings.riverBeachSize = InterfaceUtility.LabeledSlider(riverBeachListing, settings.riverBeachSize, 0f, 35f, "ZMD_riverBeachSize".Translate(), "ZMD_size0".Translate(), "ZMD_size6".Translate());

                List <TerrainDef> shoreOptions = new List <TerrainDef>();

                shoreOptions.Add(TerrainDefOf.Soil);
                shoreOptions.Add(TerrainDef.Named("SoilRich"));
                shoreOptions.Add(TerrainDefOf.Sand);
                shoreOptions.Add(TerrainDef.Named("MarshyTerrain"));
                shoreOptions.Add(TerrainDef.Named("Mud"));
                shoreOptions.Add(TerrainDefOf.Ice);

                Rect             selectRect     = riverBeachListing.GetRect(30f).LeftHalf();
                Listing_Standard terrainListing = new Listing_Standard();
                terrainListing.Begin(selectRect);

                if (terrainListing.ButtonTextLabeled("ZMD_lakeShore".Translate(), TerrainDef.Named(settings.riverShore).label))
                {
                    List <FloatMenuOption> shoreTerrList = new List <FloatMenuOption>();
                    foreach (TerrainDef terr in shoreOptions)
                    {
                        shoreTerrList.Add(new FloatMenuOption(terr.label, delegate { settings.riverShore = terr.defName; }, MenuOptionPriority.Default));
                    }
                    Find.WindowStack.Add(new FloatMenu(shoreTerrList));
                }
                terrainListing.End();
                riverBeachListing.End();
            }

            // river direction
            listing.CheckboxLabeled("ZMD_flagRiverDir".Translate(), ref MapDesignerMod.mod.settings.flagRiverDir, "ZMD_flagRiverDir".Translate());
            if (MapDesignerMod.mod.settings.flagRiverDir)
            {
                settings.riverDir = InterfaceUtility.AnglePicker(listing, settings.riverDir, "ZMD_Angle".Translate(), 2, true);
                listing.Gap();
            }

            // river location
            listing.CheckboxLabeled("ZMD_riverPosition".Translate(), ref MapDesignerMod.mod.settings.flagRiverLoc, "ZMD_riverPosition".Translate());
            if (MapDesignerMod.mod.settings.flagRiverLoc)
            {
                if (settings.flagRiverLocAbs)
                {
                    listing.CheckboxLabeled(String.Format("{0}: {1}", "ZMD_riverLocAbs".Translate(), "ZMD_riverLocAbsDesc".Translate()), ref MapDesignerMod.mod.settings.flagRiverLocAbs, "ZMD_riverLocAbsDesc".Translate());
                }
                else
                {
                    listing.CheckboxLabeled(String.Format("{0}: {1}", "ZMD_riverLocRel".Translate(), "ZMD_riverLocRelDesc".Translate()), ref MapDesignerMod.mod.settings.flagRiverLocAbs, "ZMD_riverLocRelDesc".Translate());
                }

                InterfaceUtility.LocationPicker(listing, 0.3f, ref settings.riverCenterDisp, 40f);
            }



            // Beaches
            listing.GapLine();

            Rect selCoastDir = listing.GetRect(35f);

            selCoastDir.xMax -= 0.66f * viewRect.width;
            Listing_Standard Listing_selCoastDir = new Listing_Standard();

            Listing_selCoastDir.Begin(selCoastDir);

            // beach direction
            if (Listing_selCoastDir.ButtonTextLabeled("ZMD_coastDir".Translate(), GetCoastDirLabel(settings.coastDir).Translate()))
            {
                List <FloatMenuOption> coastDirList = new List <FloatMenuOption>();

                coastDirList.Add(new FloatMenuOption("ZMD_coastDirVanilla".Translate(), delegate
                {
                    settings.coastDir = MapDesignerSettings.CoastDirection.Vanilla;
                }));
                coastDirList.Add(new FloatMenuOption("ZMD_north".Translate(), delegate
                {
                    settings.coastDir = MapDesignerSettings.CoastDirection.North;
                }));
                coastDirList.Add(new FloatMenuOption("ZMD_east".Translate(), delegate
                {
                    settings.coastDir = MapDesignerSettings.CoastDirection.East;
                }));
                coastDirList.Add(new FloatMenuOption("ZMD_south".Translate(), delegate
                {
                    settings.coastDir = MapDesignerSettings.CoastDirection.South;
                }));
                coastDirList.Add(new FloatMenuOption("ZMD_west".Translate(), delegate
                {
                    settings.coastDir = MapDesignerSettings.CoastDirection.West;
                }));

                Find.WindowStack.Add(new FloatMenu(coastDirList));
            }
            Listing_selCoastDir.End();

            // beach terrain
            Rect beachTerrRect = listing.GetRect(35f);

            beachTerrRect.xMax -= 0.66f * viewRect.width;

            //beachTerrRect.xMin += 20f;
            //beachTerrRect.xMax -= 20f;
            //Listing_Standard riverBeachListing = new Listing_Standard();
            //riverBeachListing.Begin(beachTerrRect);

            List <string> beachTerrOptions = new List <string>();

            beachTerrOptions.Add("Sand");
            beachTerrOptions.Add("Soil");
            beachTerrOptions.Add("SoilRich");
            beachTerrOptions.Add("MarshyTerrain");
            beachTerrOptions.Add("Mud");
            beachTerrOptions.Add("Ice");

            Listing_Standard beachTerrListing = new Listing_Standard();

            beachTerrListing.Begin(beachTerrRect);

            if (beachTerrListing.ButtonTextLabeled("ZMD_coastTerr".Translate(), settings.beachTerr == "Vanilla" ? "ZMD_coastTerrVanilla".Translate().ToString() : TerrainDef.Named(settings.beachTerr).label))
            {
                List <FloatMenuOption> beachTerrList = new List <FloatMenuOption>();
                beachTerrList.Add(new FloatMenuOption("ZMD_coastTerrVanilla".Translate(), delegate { settings.beachTerr = "Vanilla"; }, MenuOptionPriority.Default));

                foreach (string terr in beachTerrOptions)
                {
                    beachTerrList.Add(new FloatMenuOption(TerrainDef.Named(terr).label, delegate { settings.beachTerr = terr; }, MenuOptionPriority.Default));
                }
                Find.WindowStack.Add(new FloatMenu(beachTerrList));
            }
            beachTerrListing.End();



            // reset
            listing.GapLine();

            if (listing.ButtonText("ZMD_resetRivers".Translate()))
            {
                ResetRiversSettings();
            }

            listing.End();

            viewHeight = listing.CurHeight;
            Widgets.EndScrollView();
        }
Esempio n. 11
0
        public static void DrawMountainCard(Rect rect)
        {
            Rect rect2 = rect.ContractedBy(4f);

            // to correctly initialize scrollview height
            float height = 500f;

            if (settings.flagHillRadial)
            {
                height += 100f;
            }
            if (settings.flagHillSplit)
            {
                height += 140f;
            }
            if (settings.flagHillSide)
            {
                height += 100f;
            }

            Rect viewRect = new Rect(0f, 0f, rect2.width - 18f, Math.Max(height, viewHeight + 200f));

            Widgets.BeginScrollView(rect2, ref scrollPosition, viewRect, true);
            Listing_Standard listingStandard = new Listing_Standard();

            listingStandard.Begin(viewRect);

            // mountains
            settings.hillAmount = InterfaceUtility.LabeledSlider(listingStandard, settings.hillAmount, 0.70f, 1.4f, hillAmountLabel, "ZMD_hillAmount0".Translate(), "ZMD_hillAmount5".Translate());

            // It's reversed because that's more intuitive for the user. Smaller numbers = bigger hills
            settings.hillSize       = InterfaceUtility.LabeledSlider(listingStandard, settings.hillSize, 0.1f, 0.010f, hillSizeLabel, "ZMD_size1".Translate(), "ZMD_size5".Translate());
            settings.hillSmoothness = InterfaceUtility.LabeledSlider(listingStandard, settings.hillSmoothness, 0f, 5f, hillSmoothnessLabel, "ZMD_hillSmoothness0".Translate(), "ZMD_hillSmoothness4".Translate());

            // general mountain related
            listingStandard.CheckboxLabeled("ZMD_flagMtnExit".Translate(), ref MapDesignerMod.mod.settings.flagMtnExit, "ZMD_flagMtnExitTooltip".Translate());
            listingStandard.CheckboxLabeled("ZMD_flagCaves".Translate(), ref MapDesignerMod.mod.settings.flagCaves, "ZMD_flagCavesTooltip".Translate());

            // hill distribution
            listingStandard.GapLine();

            listingStandard.Label("ZMD_hillArrangementDesc".Translate());
            listingStandard.Gap();

            if (settings.hillSize > 0.022f)
            {
                listingStandard.CheckboxLabeled("ZMD_flagHillClumping".Translate(), ref MapDesignerMod.mod.settings.flagHillClumping, "ZMD_flagHillClumpingTooltip".Translate());
            }

            listingStandard.CheckboxLabeled("ZMD_flagHillRadial".Translate(), ref MapDesignerMod.mod.settings.flagHillRadial, "ZMD_flagHillRadialTooltip".Translate());
            if (MapDesignerMod.mod.settings.flagHillRadial)
            {
                Rect hillRadialRect = listingStandard.GetRect(100f);
                hillRadialRect.xMin += 20f;
                hillRadialRect.xMax -= 20f;

                Listing_Standard hillRadialListing = new Listing_Standard();
                hillRadialListing.Begin(hillRadialRect);

                //settings.hillRadialAmt = InterfaceUtility.LabeledSlider(hillRadialListing, settings.hillRadialAmt, -3.0f, 3.0f, GetHillRadialAmtLabel(settings.hillRadialAmt), "ZMD_center".Translate(), "ZMD_edges".Translate(), "ZMD_hillRadialAmtTooltip".Translate());
                settings.hillRadialAmt = InterfaceUtility.LabeledSlider(hillRadialListing, settings.hillRadialAmt, -2.0f, 2.0f, GetHillRadialAmtLabel(settings.hillRadialAmt), "ZMD_center".Translate(), "ZMD_edges".Translate(), null, "ZMD_hillRadialAmtTooltip".Translate());

                //settings.hillRadialSize = InterfaceUtility.LabeledSlider(hillRadialListing, settings.hillRadialSize, 0.2f, 1.1f, hillRadialSizeLabel, "ZMD_center".Translate(), "ZMD_edges".Translate(), null, "ZMD_hillRadialSizeTooltip".Translate());
                settings.hillRadialSize = InterfaceUtility.LabeledSlider(hillRadialListing, settings.hillRadialSize, 0.2f, 1.1f, hillRadialSizeLabel, null, null, String.Format("ZMD_pctOfMap".Translate(), 100 * Math.Round(settings.hillRadialSize, 1)), "ZMD_hillRadialSizeTooltip".Translate());



                hillRadialListing.End();
                listingStandard.Gap();
            }

            listingStandard.CheckboxLabeled("ZMD_flagHillSplit".Translate(), ref MapDesignerMod.mod.settings.flagHillSplit, "ZMD_flagHillSplit".Translate());
            if (MapDesignerMod.mod.settings.flagHillSplit)
            {
                Rect hillSplitRect = listingStandard.GetRect(140f);
                hillSplitRect.xMin += 20f;
                hillSplitRect.xMax -= 20f;
                Listing_Standard hillSplitListing = new Listing_Standard();
                hillSplitListing.Begin(hillSplitRect);
                settings.hillSplitAmt = InterfaceUtility.LabeledSlider(hillSplitListing, settings.hillSplitAmt, -2.5f, 2.5f, GetHillRadialAmtLabel(settings.hillSplitAmt), "ZMD_center".Translate(), "ZMD_edges".Translate(), null, "ZMD_hillRadialAmtTooltip".Translate());

                settings.hillSplitSize = InterfaceUtility.LabeledSlider(hillSplitListing, settings.hillSplitSize, 0.05f, 1.1f, "ZMD_size".Translate(), null, null, String.Format("ZMD_pctOfMap".Translate(), 100 * Math.Round(settings.hillSplitSize, 1)), "ZMD_hillRadialSizeTooltip".Translate());

                settings.hillSplitDir = InterfaceUtility.AnglePicker(hillSplitListing, settings.hillSplitDir, "ZMD_Angle".Translate());

                hillSplitListing.End();
                listingStandard.Gap();
            }

            listingStandard.CheckboxLabeled("ZMD_flagHillSide".Translate(), ref MapDesignerMod.mod.settings.flagHillSide, "ZMD_flagHillSide".Translate());
            if (MapDesignerMod.mod.settings.flagHillSide)
            {
                Rect hillSideRect = listingStandard.GetRect(100f);
                hillSideRect.xMin += 20f;
                hillSideRect.xMax -= 20f;
                Listing_Standard hillSideListing = new Listing_Standard();
                hillSideListing.Begin(hillSideRect);

                settings.hillSideAmt = InterfaceUtility.LabeledSlider(hillSideListing, settings.hillSideAmt, 0.2f, 3.0f, GetHillSideAmtLabel(settings.hillSideAmt));

                settings.hillSideDir = InterfaceUtility.AnglePicker(hillSideListing, settings.hillSideDir, "ZMD_Angle".Translate(), 3, true);

                hillSideListing.End();
            }

            // reset
            listingStandard.GapLine();
            //if (InterfaceUtility.SizedTextButton(listingStandard, "ZMD_resetMountain".Translate(), -1, true))
            if (listingStandard.ButtonText("ZMD_resetMountain".Translate()))
            {
                ResetMountainSettings();
            }

            listingStandard.End();

            viewHeight = listingStandard.CurHeight;
            Widgets.EndScrollView();
        }
Esempio n. 12
0
        public static void DrawRiversCard(Rect rect)
        {
            Listing_Standard listing = new Listing_Standard();

            listing.Begin(rect);
            listing.GapLine();

            // size and style
            settings.sizeRiver = InterfaceUtility.LabeledSlider(listing, settings.sizeRiver, 0.1f, 3f, InterfaceUtility.FormatLabel("ZMD_sizeRiver", "ZMD_size" + ThingsCard.GetDensityLabel(settings.sizeRiver)), "ZMD_size1".Translate(), "ZMD_size6".Translate());
            Rect selStyleRect = listing.GetRect(40f);

            Rect selButtonRect = selStyleRect;
            Rect descRect      = selStyleRect;

            selButtonRect.xMax -= 0.66f * rect.width;
            descRect.xMin      += 0.34f * rect.width;
            Rect iconRect = new Rect(descRect);

            iconRect.xMin += 10f;
            iconRect.xMax  = iconRect.xMin + 40f;

            string    texPath = String.Format("GUI/{0}", GetRiverStyleLabel(settings.selRiverStyle));
            Texture2D icon    = ContentFinder <Texture2D> .Get(texPath, true);

            Widgets.DrawTextureRotated(iconRect, icon, 0);
            descRect.xMin += 60f;

            Widgets.Label(descRect, (GetRiverStyleLabel(settings.selRiverStyle) + "Desc").Translate());
            //Rect descRect = listing.GetRect(60f).RightHalf();
            Listing_Standard Listing_selRiverStyle = new Listing_Standard();

            Listing_selRiverStyle.Begin(selButtonRect);

            // river style selection
            if (Listing_selRiverStyle.ButtonTextLabeled("ZMD_riverStyle".Translate(), GetRiverStyleLabel(settings.selRiverStyle).Translate()))
            {
                List <FloatMenuOption> riverStyleList = new List <FloatMenuOption>();

                riverStyleList.Add(new FloatMenuOption("ZMD_riverStyleVanilla".Translate(), delegate
                {
                    settings.selRiverStyle = MapDesignerSettings.RiverStyle.Vanilla;
                }));
                riverStyleList.Add(new FloatMenuOption("ZMD_riverStyleSpring".Translate(), delegate
                {
                    settings.selRiverStyle = MapDesignerSettings.RiverStyle.Spring;
                }));
                //riverStyleList.Add(new FloatMenuOption("ZMD_riverStyleConfluence".Translate(), delegate
                //{
                //    settings.selRiverStyle = MapDesignerSettings.RiverStyle.Confluence;
                //}));
                //riverStyleList.Add(new FloatMenuOption("ZMD_riverStyleFork".Translate(), delegate
                //{
                //    settings.selRiverStyle = MapDesignerSettings.RiverStyle.Fork;
                //}));
                //riverStyleList.Add(new FloatMenuOption("ZMD_riverStyleOxbow".Translate(), delegate
                //{
                //    settings.selRiverStyle = MapDesignerSettings.RiverStyle.Oxbow;
                //}));
                Find.WindowStack.Add(new FloatMenu(riverStyleList));
            }
            Listing_selRiverStyle.End();

            listing.Gap(listing.verticalSpacing);

            // river beaches
            listing.CheckboxLabeled("ZMD_flagRiverBeach".Translate(), ref settings.flagRiverBeach, "ZMD_flagRiverBeach".Translate());

            if (MapDesignerMod.mod.settings.flagRiverBeach)
            {
                Rect riverBeachRect = listing.GetRect(90f);
                riverBeachRect.xMin += 20f;
                riverBeachRect.xMax -= 20f;
                Listing_Standard riverBeachListing = new Listing_Standard();
                riverBeachListing.Begin(riverBeachRect);

                settings.riverBeachSize = InterfaceUtility.LabeledSlider(riverBeachListing, settings.riverBeachSize, 0f, 35f, "ZMD_riverBeachSize".Translate(), "ZMD_size0".Translate(), "ZMD_size6".Translate());

                List <TerrainDef> shoreOptions = new List <TerrainDef>();

                shoreOptions.Add(TerrainDefOf.Soil);
                shoreOptions.Add(TerrainDef.Named("SoilRich"));
                shoreOptions.Add(TerrainDefOf.Sand);
                shoreOptions.Add(TerrainDef.Named("MarshyTerrain"));
                shoreOptions.Add(TerrainDef.Named("Mud"));
                shoreOptions.Add(TerrainDefOf.Ice);

                Rect             selectRect     = riverBeachListing.GetRect(30f).LeftHalf();
                Listing_Standard terrainListing = new Listing_Standard();
                terrainListing.Begin(selectRect);

                if (terrainListing.ButtonTextLabeled("ZMD_lakeShore".Translate(), TerrainDef.Named(settings.riverShore).label))
                {
                    List <FloatMenuOption> shoreTerrList = new List <FloatMenuOption>();
                    foreach (TerrainDef terr in shoreOptions)
                    {
                        shoreTerrList.Add(new FloatMenuOption(terr.label, delegate { settings.riverShore = terr.defName; }, MenuOptionPriority.Default));
                    }
                    Find.WindowStack.Add(new FloatMenu(shoreTerrList));
                }
                terrainListing.End();
                riverBeachListing.End();
            }

            // river direction
            listing.CheckboxLabeled("ZMD_flagRiverDir".Translate(), ref MapDesignerMod.mod.settings.flagRiverDir, "ZMD_flagRiverDir".Translate());
            if (MapDesignerMod.mod.settings.flagRiverDir)
            {
                settings.riverDir = InterfaceUtility.AnglePicker(listing, settings.riverDir, "ZMD_Angle".Translate(), 2, true);
            }

            // reset
            listing.GapLine();
            if (listing.ButtonText("ZMD_resetRivers".Translate()))
            {
                ResetRiversSettings();
            }

            listing.End();
        }