Пример #1
0
 private void CheckVisualOrPathCostChange(IntVec3 c, float oldDepth, float newDepth)
 {
     if (!Mathf.Approximately(oldDepth, newDepth))
     {
         if (Mathf.Abs(oldDepth - newDepth) > 0.15f || Rand.Value < 0.0125f)
         {
             map.mapDrawer.MapMeshDirty(c, MapMeshFlag.Snow, regenAdjacentCells: true, regenAdjacentSections: false);
             map.mapDrawer.MapMeshDirty(c, MapMeshFlag.Things, regenAdjacentCells: true, regenAdjacentSections: false);
         }
         else if (newDepth == 0f)
         {
             map.mapDrawer.MapMeshDirty(c, MapMeshFlag.Snow, regenAdjacentCells: true, regenAdjacentSections: false);
         }
         if (SnowUtility.GetSnowCategory(oldDepth) != SnowUtility.GetSnowCategory(newDepth))
         {
             map.pathGrid.RecalculatePerceivedPathCostAt(c);
         }
     }
 }
Пример #2
0
 private void CheckVisualOrPathCostChange(IntVec3 c, float oldDepth, float newDepth)
 {
     if (!Mathf.Approximately(oldDepth, newDepth))
     {
         if (Mathf.Abs(oldDepth - newDepth) > 0.15000000596046448 || Rand.Value < 0.012500000186264515)
         {
             this.map.mapDrawer.MapMeshDirty(c, MapMeshFlag.Snow, true, false);
             this.map.mapDrawer.MapMeshDirty(c, MapMeshFlag.Things, true, false);
         }
         else if (newDepth == 0.0)
         {
             this.map.mapDrawer.MapMeshDirty(c, MapMeshFlag.Snow, true, false);
         }
         if (SnowUtility.GetSnowCategory(oldDepth) != SnowUtility.GetSnowCategory(newDepth))
         {
             this.map.pathGrid.RecalculatePerceivedPathCostAt(c);
         }
     }
 }
Пример #3
0
        public void MouseoverReadoutOnGUI()
        {
            if (Event.current.type != EventType.Repaint || Find.MainTabsRoot.OpenTab != null)
            {
                return;
            }
            GenUI.DrawTextWinterShadow(new Rect(256f, UI.screenHeight - 256, -256f, 256f));
            Text.Font = GameFont.Small;
            GUI.color = new Color(1f, 1f, 1f, 0.8f);
            IntVec3 c = UI.MouseCell();

            if (!c.InBounds(Find.CurrentMap))
            {
                return;
            }
            float num = 0f;

            if (c.Fogged(Find.CurrentMap))
            {
                Widgets.Label(new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f), "Undiscovered".Translate());
                GUI.color = Color.white;
                return;
            }
            Rect rect = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f);
            int  num2 = Mathf.RoundToInt(Find.CurrentMap.glowGrid.GameGlowAt(c) * 100f);

            Widgets.Label(rect, glowStrings[num2]);
            num += 19f;
            Rect       rect2   = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f);
            TerrainDef terrain = c.GetTerrain(Find.CurrentMap);

            if (terrain != cachedTerrain)
            {
                string t = ((double)terrain.fertility > 0.0001) ? (" " + "FertShort".TranslateSimple() + " " + terrain.fertility.ToStringPercent()) : "";
                cachedTerrainString = terrain.LabelCap + ((terrain.passability != Traversability.Impassable) ? (" (" + "WalkSpeed".Translate(SpeedPercentString(terrain.pathCost)) + t + ")") : ((TaggedString)null));
                cachedTerrain       = terrain;
            }
            Widgets.Label(rect2, cachedTerrainString);
            num += 19f;
            Zone zone = c.GetZone(Find.CurrentMap);

            if (zone != null)
            {
                Rect   rect3 = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f);
                string label = zone.label;
                Widgets.Label(rect3, label);
                num += 19f;
            }
            float depth = Find.CurrentMap.snowGrid.GetDepth(c);

            if (depth > 0.03f)
            {
                Rect         rect4        = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f);
                SnowCategory snowCategory = SnowUtility.GetSnowCategory(depth);
                string       label2       = SnowUtility.GetDescription(snowCategory) + " (" + "WalkSpeed".Translate(SpeedPercentString(SnowUtility.MovementTicksAddOn(snowCategory))) + ")";
                Widgets.Label(rect4, label2);
                num += 19f;
            }
            List <Thing> thingList = c.GetThingList(Find.CurrentMap);

            for (int i = 0; i < thingList.Count; i++)
            {
                Thing thing = thingList[i];
                if (thing.def.category != ThingCategory.Mote)
                {
                    Rect   rect5          = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f);
                    string labelMouseover = thing.LabelMouseover;
                    Widgets.Label(rect5, labelMouseover);
                    num += 19f;
                }
            }
            RoofDef roof = c.GetRoof(Find.CurrentMap);

            if (roof != null)
            {
                Widgets.Label(new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f), roof.LabelCap);
                num += 19f;
            }
            GUI.color = Color.white;
        }
Пример #4
0
 public SnowCategory GetCategory(IntVec3 c)
 {
     return(SnowUtility.GetSnowCategory(GetDepth(c)));
 }
Пример #5
0
 private static void RemoveSnow()
 {
     SnowUtility.AddSnowRadial(UI.MouseCell(), Find.CurrentMap, 5f, -1f);
 }
Пример #6
0
 public void MouseoverReadoutOnGUI()
 {
     if (Event.current.type == EventType.Repaint)
     {
         if (Find.MainTabsRoot.OpenTab == null)
         {
             GenUI.DrawTextWinterShadow(new Rect(256f, (float)(UI.screenHeight - 256), -256f, 256f));
             Text.Font = GameFont.Small;
             GUI.color = new Color(1f, 1f, 1f, 0.8f);
             IntVec3 c = UI.MouseCell();
             if (c.InBounds(Find.CurrentMap))
             {
                 float num = 0f;
                 Profiler.BeginSample("fog");
                 if (c.Fogged(Find.CurrentMap))
                 {
                     Rect rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f);
                     Widgets.Label(rect, "Undiscovered".Translate());
                     GUI.color = Color.white;
                     Profiler.EndSample();
                 }
                 else
                 {
                     Profiler.EndSample();
                     Profiler.BeginSample("light");
                     Rect rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f);
                     int  num2 = Mathf.RoundToInt(Find.CurrentMap.glowGrid.GameGlowAt(c, false) * 100f);
                     Widgets.Label(rect, this.glowStrings[num2]);
                     num += 19f;
                     Profiler.EndSample();
                     Profiler.BeginSample("terrain");
                     rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f);
                     TerrainDef terrain = c.GetTerrain(Find.CurrentMap);
                     if (terrain != this.cachedTerrain)
                     {
                         string str = ((double)terrain.fertility <= 0.0001) ? "" : (" " + "FertShort".Translate() + " " + terrain.fertility.ToStringPercent());
                         this.cachedTerrainString = terrain.LabelCap + ((terrain.passability == Traversability.Impassable) ? null : (" (" + "WalkSpeed".Translate(new object[]
                         {
                             this.SpeedPercentString((float)terrain.pathCost)
                         }) + str + ")"));
                         this.cachedTerrain = terrain;
                     }
                     Widgets.Label(rect, this.cachedTerrainString);
                     num += 19f;
                     Profiler.EndSample();
                     Profiler.BeginSample("zone");
                     Zone zone = c.GetZone(Find.CurrentMap);
                     if (zone != null)
                     {
                         rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f);
                         string label = zone.label;
                         Widgets.Label(rect, label);
                         num += 19f;
                     }
                     Profiler.EndSample();
                     float depth = Find.CurrentMap.snowGrid.GetDepth(c);
                     if (depth > 0.03f)
                     {
                         rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f);
                         SnowCategory snowCategory = SnowUtility.GetSnowCategory(depth);
                         string       label2       = SnowUtility.GetDescription(snowCategory) + " (" + "WalkSpeed".Translate(new object[]
                         {
                             this.SpeedPercentString((float)SnowUtility.MovementTicksAddOn(snowCategory))
                         }) + ")";
                         Widgets.Label(rect, label2);
                         num += 19f;
                     }
                     Profiler.BeginSample("things");
                     List <Thing> thingList = c.GetThingList(Find.CurrentMap);
                     for (int i = 0; i < thingList.Count; i++)
                     {
                         Thing thing = thingList[i];
                         if (thing.def.category != ThingCategory.Mote)
                         {
                             rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f);
                             string labelMouseover = thing.LabelMouseover;
                             Widgets.Label(rect, labelMouseover);
                             num += 19f;
                         }
                     }
                     Profiler.EndSample();
                     Profiler.BeginSample("roof");
                     RoofDef roof = c.GetRoof(Find.CurrentMap);
                     if (roof != null)
                     {
                         rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f);
                         Widgets.Label(rect, roof.LabelCap);
                         num += 19f;
                     }
                     Profiler.EndSample();
                     GUI.color = Color.white;
                 }
             }
         }
     }
 }
Пример #7
0
 public void MouseoverReadoutOnGUI()
 {
     if (Event.current.type == EventType.Repaint && Find.MainTabsRoot.OpenTab == null)
     {
         GenUI.DrawTextWinterShadow(new Rect(256f, (float)(UI.screenHeight - 256), -256f, 256f));
         Text.Font = GameFont.Small;
         GUI.color = new Color(1f, 1f, 1f, 0.8f);
         IntVec3 c = UI.MouseCell();
         if (c.InBounds(Find.CurrentMap))
         {
             float num  = 0f;
             Rect  rect = default(Rect);
             if (c.Fogged(Find.CurrentMap))
             {
                 Vector2 botLeft  = BotLeft;
                 float   x        = botLeft.x;
                 float   num2     = (float)UI.screenHeight;
                 Vector2 botLeft2 = BotLeft;
                 rect = new Rect(x, num2 - botLeft2.y - num, 999f, 999f);
                 Widgets.Label(rect, "Undiscovered".Translate());
                 GUI.color = Color.white;
             }
             else
             {
                 Vector2 botLeft3 = BotLeft;
                 float   x2       = botLeft3.x;
                 float   num3     = (float)UI.screenHeight;
                 Vector2 botLeft4 = BotLeft;
                 rect = new Rect(x2, num3 - botLeft4.y - num, 999f, 999f);
                 int num4 = Mathf.RoundToInt(Find.CurrentMap.glowGrid.GameGlowAt(c) * 100f);
                 Widgets.Label(rect, glowStrings[num4]);
                 num += 19f;
                 Vector2 botLeft5 = BotLeft;
                 float   x3       = botLeft5.x;
                 float   num5     = (float)UI.screenHeight;
                 Vector2 botLeft6 = BotLeft;
                 rect = new Rect(x3, num5 - botLeft6.y - num, 999f, 999f);
                 TerrainDef terrain = c.GetTerrain(Find.CurrentMap);
                 if (terrain != cachedTerrain)
                 {
                     string str = (!((double)terrain.fertility > 0.0001)) ? string.Empty : (" " + "FertShort".Translate() + " " + terrain.fertility.ToStringPercent());
                     cachedTerrainString = terrain.LabelCap + ((terrain.passability == Traversability.Impassable) ? null : (" (" + "WalkSpeed".Translate(SpeedPercentString((float)terrain.pathCost)) + str + ")"));
                     cachedTerrain       = terrain;
                 }
                 Widgets.Label(rect, cachedTerrainString);
                 num += 19f;
                 Zone zone = c.GetZone(Find.CurrentMap);
                 if (zone != null)
                 {
                     Vector2 botLeft7 = BotLeft;
                     float   x4       = botLeft7.x;
                     float   num6     = (float)UI.screenHeight;
                     Vector2 botLeft8 = BotLeft;
                     rect = new Rect(x4, num6 - botLeft8.y - num, 999f, 999f);
                     string label = zone.label;
                     Widgets.Label(rect, label);
                     num += 19f;
                 }
                 float depth = Find.CurrentMap.snowGrid.GetDepth(c);
                 if (depth > 0.03f)
                 {
                     Vector2 botLeft9  = BotLeft;
                     float   x5        = botLeft9.x;
                     float   num7      = (float)UI.screenHeight;
                     Vector2 botLeft10 = BotLeft;
                     rect = new Rect(x5, num7 - botLeft10.y - num, 999f, 999f);
                     SnowCategory snowCategory = SnowUtility.GetSnowCategory(depth);
                     string       label2       = SnowUtility.GetDescription(snowCategory) + " (" + "WalkSpeed".Translate(SpeedPercentString((float)SnowUtility.MovementTicksAddOn(snowCategory))) + ")";
                     Widgets.Label(rect, label2);
                     num += 19f;
                 }
                 List <Thing> thingList = c.GetThingList(Find.CurrentMap);
                 for (int i = 0; i < thingList.Count; i++)
                 {
                     Thing thing = thingList[i];
                     if (thing.def.category != ThingCategory.Mote)
                     {
                         Vector2 botLeft11 = BotLeft;
                         float   x6        = botLeft11.x;
                         float   num8      = (float)UI.screenHeight;
                         Vector2 botLeft12 = BotLeft;
                         rect = new Rect(x6, num8 - botLeft12.y - num, 999f, 999f);
                         string labelMouseover = thing.LabelMouseover;
                         Widgets.Label(rect, labelMouseover);
                         num += 19f;
                     }
                 }
                 RoofDef roof = c.GetRoof(Find.CurrentMap);
                 if (roof != null)
                 {
                     Vector2 botLeft13 = BotLeft;
                     float   x7        = botLeft13.x;
                     float   num9      = (float)UI.screenHeight;
                     Vector2 botLeft14 = BotLeft;
                     rect = new Rect(x7, num9 - botLeft14.y - num, 999f, 999f);
                     Widgets.Label(rect, roof.LabelCap);
                     num += 19f;
                 }
                 GUI.color = Color.white;
             }
         }
     }
 }