예제 #1
0
        public static int MovementTicksAddOn(SnowCategory category)
        {
            int result;

            switch (category)
            {
            case SnowCategory.None:
                result = 0;
                break;

            case SnowCategory.Dusting:
                result = 0;
                break;

            case SnowCategory.Thin:
                result = 4;
                break;

            case SnowCategory.Medium:
                result = 8;
                break;

            case SnowCategory.Thick:
                result = 12;
                break;

            default:
                result = 0;
                break;
            }
            return(result);
        }
예제 #2
0
        public static string GetDescription(SnowCategory category)
        {
            string result;

            switch (category)
            {
            case SnowCategory.None:
                result = "SnowNone".Translate();
                break;

            case SnowCategory.Dusting:
                result = "SnowDusting".Translate();
                break;

            case SnowCategory.Thin:
                result = "SnowThin".Translate();
                break;

            case SnowCategory.Medium:
                result = "SnowMedium".Translate();
                break;

            case SnowCategory.Thick:
                result = "SnowThick".Translate();
                break;

            default:
                result = "Unknown snow";
                break;
            }
            return(result);
        }
예제 #3
0
 public static string GetDescription(SnowCategory category)
 {
     return(category switch
     {
         SnowCategory.None => "SnowNone".Translate(),
         SnowCategory.Dusting => "SnowDusting".Translate(),
         SnowCategory.Thin => "SnowThin".Translate(),
         SnowCategory.Medium => "SnowMedium".Translate(),
         SnowCategory.Thick => "SnowThick".Translate(),
         _ => "Unknown snow",
     });
예제 #4
0
		public static int MovementTicksAddOn(SnowCategory category)
		{
			switch (category)
			{
			case SnowCategory.None:
				return 0;
			case SnowCategory.Dusting:
				return 0;
			case SnowCategory.Thin:
				return 4;
			case SnowCategory.Medium:
				return 8;
			case SnowCategory.Thick:
				return 12;
			default:
				return 0;
			}
		}
예제 #5
0
		public static string GetDescription(SnowCategory category)
		{
			switch (category)
			{
			case SnowCategory.None:
				return "SnowNone".Translate();
			case SnowCategory.Dusting:
				return "SnowDusting".Translate();
			case SnowCategory.Thin:
				return "SnowThin".Translate();
			case SnowCategory.Medium:
				return "SnowMedium".Translate();
			case SnowCategory.Thick:
				return "SnowThick".Translate();
			default:
				return "Unknown snow";
			}
		}
예제 #6
0
        public static int MovementTicksAddOnIgnoreZero(SnowCategory category)
        {
            switch (category)
            {
            case SnowCategory.None:
                return(-100);

            case SnowCategory.Dusting:
                return(0);

            case SnowCategory.Thin:
                return(4);

            case SnowCategory.Medium:
                return(8);

            case SnowCategory.Thick:
                return(12);

            default:
                return(0);
            }
        }
예제 #7
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;
        }
예제 #8
0
        public void MouseoverReadoutOnGUI()
        {
            if (Find.MainTabsRoot.OpenTab != null)
            {
                return;
            }
            GenUI.DrawTextWinterShadow(new Rect(256f, (float)(Screen.height - 256), -256f, 256f));
            Text.Font = GameFont.Small;
            GUI.color = new Color(1f, 1f, 1f, 0.8f);
            IntVec3 c = Gen.MouseCell();

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

            if (c.Fogged())
            {
                rect = new Rect(MouseoverReadout.BotLeft.x, (float)Screen.height - MouseoverReadout.BotLeft.y - num, 999f, 999f);
                Widgets.Label(rect, "Undiscovered".Translate());
                GUI.color = Color.white;
                return;
            }
            rect = new Rect(MouseoverReadout.BotLeft.x, (float)Screen.height - MouseoverReadout.BotLeft.y - num, 999f, 999f);
            Widgets.Label(rect, Find.GlowGrid.PsychGlowAt(c).GetLabel() + " (" + Find.GlowGrid.GameGlowAt(c).ToStringPercent() + ")");
            num += 19f;
            rect = new Rect(MouseoverReadout.BotLeft.x, (float)Screen.height - MouseoverReadout.BotLeft.y - num, 999f, 999f);
            TerrainDef terrain = c.GetTerrain();

            if (terrain != this.cachedTerrain)
            {
                this.cachedTerrainString = terrain.LabelCap + ((terrain.passability != Traversability.Impassable) ? (" (" + "WalkSpeed".Translate(new object[]
                {
                    this.SpeedPercentString((float)terrain.pathCost)
                }) + ")") : null);
                this.cachedTerrain = terrain;
            }
            Widgets.Label(rect, this.cachedTerrainString);
            num += 19f;
            Zone zone = c.GetZone();

            if (zone != null)
            {
                rect = new Rect(MouseoverReadout.BotLeft.x, (float)Screen.height - MouseoverReadout.BotLeft.y - num, 999f, 999f);
                string label = zone.label;
                Widgets.Label(rect, label);
                num += 19f;
            }
            float depth = Find.SnowGrid.GetDepth(c);

            if ((double)depth > 0.03)
            {
                rect = new Rect(MouseoverReadout.BotLeft.x, (float)Screen.height - 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;
            }
            List <Thing> list = Find.ThingGrid.ThingsListAt(c);

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

            if (roof != null)
            {
                rect = new Rect(MouseoverReadout.BotLeft.x, (float)Screen.height - MouseoverReadout.BotLeft.y - num, 999f, 999f);
                Widgets.Label(rect, roof.LabelCap);
                num += 19f;
            }
            GUI.color = Color.white;
        }
예제 #9
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;
                 }
             }
         }
     }
 }
예제 #10
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;
             }
         }
     }
 }
        public static bool MouseoverReadoutOnGUI(MouseoverReadout __instance)
        {
            IntVec3 c = UI.MouseCell();

            if (!c.InBounds(Find.CurrentMap) ||
                Event.current.type != EventType.Repaint ||
                Find.MainTabsRoot.OpenTab != null)
            {
                return(false);
            }

            if (Find.CurrentMap.GetComponent <MapComponent_FertilityMods>().Get is MapComponent_FertilityMods fert &&
                fert.ActiveCells.Contains(c))
            {
                //Original Variables
                Vector2 BotLeft = new Vector2(15f, 65f);

                GenUI.DrawTextWinterShadow(new Rect(256f, (float)(UI.screenHeight - 256), -256f, 256f));
                Text.Font = GameFont.Small;
                GUI.color = new Color(1f, 1f, 1f, 0.8f);

                float num = 0f;
                Rect  rect;
                if (c.Fogged(Find.CurrentMap))
                {
                    rect = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f);
                    Widgets.Label(rect, "Undiscovered".Translate());
                    GUI.color = Color.white;
                    return(false);
                }
                rect = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f);
                int      num2        = Mathf.RoundToInt(Find.CurrentMap.glowGrid.GameGlowAt(c) * 100f);
                string[] glowStrings = Traverse.Create(__instance).Field("glowStrings").GetValue <string[]>();
                Widgets.Label(rect, glowStrings[num2]);
                num += 19f;
                rect = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f);
                TerrainDef terrain = c.GetTerrain(Find.CurrentMap);
                //string SpeedPercentString = Traverse.Create(__instance).Method("SpeedPercentString", (float)terrain.pathCost).GetValue<string>();
                //TerrainDef cachedTerrain = Traverse.Create(__instance).Field("cachedTerrain").GetValue<TerrainDef>();
                string cachedTerrainString =
                    Traverse.Create(__instance).Field("cachedTerrainString").GetValue <string>();

                //if (terrain != cachedTerrain)
                //{
                float  fertNum = Find.CurrentMap.fertilityGrid.FertilityAt(c);
                string str     = ((double)fertNum <= 0.0001)
                    ? string.Empty
                    : (" " + "FertShort".Translate() + " " + fertNum.ToStringPercent());
                cachedTerrainString = terrain.LabelCap + ((terrain.passability == Traversability.Impassable)
                                          ? null
                                          : (" (" + "WalkSpeed".Translate(new object[]
                {
                    SpeedPercentString((float)terrain.pathCost)
                }) + str + ")"));
                //cachedTerrain = terrain;
                //}
                Widgets.Label(rect, cachedTerrainString);
                num += 19f;
                Zone zone = c.GetZone(Find.CurrentMap);
                if (zone != null)
                {
                    rect = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.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)
                {
                    rect = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f);
                    SnowCategory snowCategory = SnowUtility.GetSnowCategory(depth);
                    string       label2       = SnowUtility.GetDescription(snowCategory) + " (" + "WalkSpeed".Translate(new object[]
                    {
                        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)
                    {
                        rect = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f);
                        string labelMouseover = thing.LabelMouseover;
                        Widgets.Label(rect, labelMouseover);
                        num += 19f;
                    }
                }
                RoofDef roof = c.GetRoof(Find.CurrentMap);
                if (roof != null)
                {
                    rect = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f);
                    Widgets.Label(rect, roof.LabelCap);
                    num += 19f;
                }
                GUI.color = Color.white;
                return(false);
            }
            return(true);
        }