Пример #1
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();
        }
Пример #2
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();
        }
Пример #3
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();
        }