示例#1
0
        public static float CalculatedMovementDifficultyAt(int tile, bool perceivedStatic, int?ticksAbs = null, StringBuilder explanation = null)
        {
            Tile tile2 = Find.WorldGrid[tile];

            if (explanation != null && explanation.Length > 0)
            {
                explanation.AppendLine();
            }
            if (tile2.biome.impassable || tile2.hilliness == Hilliness.Impassable)
            {
                if (explanation != null)
                {
                    explanation.Append("Impassable".Translate());
                }
                return(1000f);
            }
            float num = 0f;

            num += tile2.biome.movementDifficulty;
            if (explanation != null)
            {
                explanation.Append(tile2.biome.LabelCap + ": " + tile2.biome.movementDifficulty.ToStringWithSign("0.#"));
            }
            float num2 = WorldPathGrid.HillinessMovementDifficultyOffset(tile2.hilliness);

            num += num2;
            if (explanation != null && num2 != 0f)
            {
                explanation.AppendLine();
                explanation.Append(tile2.hilliness.GetLabelCap() + ": " + num2.ToStringWithSign("0.#"));
            }
            return(num + WorldPathGrid.GetCurrentWinterMovementDifficultyOffset(tile, new int?((!ticksAbs.HasValue) ? GenTicks.TicksAbs : ticksAbs.Value), explanation));
        }
示例#2
0
        protected override void FillTab()
        {
            Rect outRect = new Rect(0f, 0f, WITab_Terrain.WinSize.x, WITab_Terrain.WinSize.y).ContractedBy(10f);
            Rect rect    = new Rect(0f, 0f, outRect.width - 16f, Mathf.Max(this.lastDrawnHeight, outRect.height));

            Widgets.BeginScrollView(outRect, ref this.scrollPosition, rect, true);
            Rect rect2 = rect;
            Rect rect3 = rect2;

            Text.Font = GameFont.Medium;
            Widgets.Label(rect3, base.SelTile.biome.LabelCap);
            Rect rect4 = rect2;

            rect4.yMin  += 35f;
            rect4.height = 99999f;
            Text.Font    = GameFont.Small;
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.verticalSpacing = 0f;
            listing_Standard.Begin(rect4);
            Tile selTile   = base.SelTile;
            int  selTileID = base.SelTileID;

            listing_Standard.Label(selTile.biome.description, -1f, null);
            listing_Standard.Gap(8f);
            listing_Standard.GapLine(12f);
            if (!selTile.biome.implemented)
            {
                listing_Standard.Label(selTile.biome.LabelCap + " " + "BiomeNotImplemented".Translate(), -1f, null);
            }
            listing_Standard.LabelDouble("Terrain".Translate(), selTile.hilliness.GetLabelCap(), null);
            if (selTile.Roads != null)
            {
                listing_Standard.LabelDouble("Road".Translate(), (from roadlink in selTile.Roads
                                                                  select roadlink.road.label).Distinct <string>().ToCommaList(true).CapitalizeFirst(), null);
            }
            if (selTile.Rivers != null)
            {
                listing_Standard.LabelDouble("River".Translate(), selTile.Rivers.MaxBy((Tile.RiverLink riverlink) => riverlink.river.degradeThreshold).river.LabelCap, null);
            }
            if (!Find.World.Impassable(selTileID))
            {
                StringBuilder stringBuilder   = new StringBuilder();
                int           tile            = selTileID;
                bool          perceivedStatic = false;
                StringBuilder explanation     = stringBuilder;
                string        rightLabel      = (WorldPathGrid.CalculatedMovementDifficultyAt(tile, perceivedStatic, null, explanation) * Find.WorldGrid.GetRoadMovementDifficultyMultiplier(selTileID, -1, stringBuilder)).ToString("0.#");
                if (WorldPathGrid.WillWinterEverAffectMovementDifficulty(selTileID) && WorldPathGrid.GetCurrentWinterMovementDifficultyOffset(selTileID, null, null) < 2f)
                {
                    stringBuilder.AppendLine();
                    stringBuilder.AppendLine();
                    stringBuilder.Append(" (");
                    stringBuilder.Append("MovementDifficultyOffsetInWinter".Translate(new object[]
                    {
                        "+" + 2f.ToString("0.#")
                    }));
                    stringBuilder.Append(")");
                }
                listing_Standard.LabelDouble("MovementDifficulty".Translate(), rightLabel, stringBuilder.ToString());
            }
            if (selTile.biome.canBuildBase)
            {
                listing_Standard.LabelDouble("StoneTypesHere".Translate(), (from rt in Find.World.NaturalRockTypesIn(selTileID)
                                                                            select rt.label).ToCommaList(true).CapitalizeFirst(), null);
            }
            listing_Standard.LabelDouble("Elevation".Translate(), selTile.elevation.ToString("F0") + "m", null);
            listing_Standard.GapLine(12f);
            listing_Standard.LabelDouble("AvgTemp".Translate(), GenTemperature.GetAverageTemperatureLabel(selTileID), null);
            listing_Standard.LabelDouble("OutdoorGrowingPeriod".Translate(), Zone_Growing.GrowingQuadrumsDescription(selTileID), null);
            listing_Standard.LabelDouble("Rainfall".Translate(), selTile.rainfall.ToString("F0") + "mm", null);
            if (selTile.biome.foragedFood != null && selTile.biome.forageability > 0f)
            {
                listing_Standard.LabelDouble("Forageability".Translate(), selTile.biome.forageability.ToStringPercent() + " (" + selTile.biome.foragedFood.label + ")", null);
            }
            else
            {
                listing_Standard.LabelDouble("Forageability".Translate(), "0%", null);
            }
            listing_Standard.LabelDouble("AnimalsCanGrazeNow".Translate(), (!VirtualPlantsUtility.EnvironmentAllowsEatingVirtualPlantsNowAt(selTileID)) ? "No".Translate() : "Yes".Translate(), null);
            listing_Standard.GapLine(12f);
            listing_Standard.LabelDouble("AverageDiseaseFrequency".Translate(), string.Format("{0} {1}", (60f / selTile.biome.diseaseMtbDays).ToString("F1"), "PerYear".Translate()), null);
            listing_Standard.LabelDouble("TimeZone".Translate(), GenDate.TimeZoneAt(Find.WorldGrid.LongLatOf(selTileID).x).ToStringWithSign(), null);
            StringBuilder stringBuilder2 = new StringBuilder();
            Rot4          rot            = Find.World.CoastDirectionAt(selTileID);

            if (rot.IsValid)
            {
                stringBuilder2.AppendWithComma(("HasCoast" + rot.ToString()).Translate());
            }
            if (Find.World.HasCaves(selTileID))
            {
                stringBuilder2.AppendWithComma("HasCaves".Translate());
            }
            if (stringBuilder2.Length > 0)
            {
                listing_Standard.LabelDouble("SpecialFeatures".Translate(), stringBuilder2.ToString().CapitalizeFirst(), null);
            }
            if (Prefs.DevMode)
            {
                listing_Standard.LabelDouble("Debug world tile ID", selTileID.ToString(), null);
            }
            this.lastDrawnHeight = rect4.y + listing_Standard.CurHeight;
            listing_Standard.End();
            Widgets.EndScrollView();
        }