public static void DrawPawnLabel(Pawn pawn, Vector2 pos, float alpha = 1f, float truncateToWidth = 9999f, Dictionary <string, string> truncatedLabelsCache = null, GameFont font = GameFont.Tiny, bool alwaysDrawBg = true, bool alignCenter = true) { float pawnLabelNameWidth = GenMapUI.GetPawnLabelNameWidth(pawn, truncateToWidth, truncatedLabelsCache, font); Rect bgRect = new Rect(pos.x - pawnLabelNameWidth / 2f - 4f, pos.y, pawnLabelNameWidth + 8f, 12f); if (!pawn.RaceProps.Humanlike) { bgRect.y -= 4f; } GenMapUI.DrawPawnLabel(pawn, bgRect, alpha, truncateToWidth, truncatedLabelsCache, font, alwaysDrawBg, alignCenter); }
public virtual void DrawGUIOverlay() { if (Find.CameraDriver.CurrentZoom == CameraZoomRange.Closest) { QualityCategory cat = default(QualityCategory); if (this.def.stackLimit > 1) { GenMapUI.DrawThingLabel(this, this.stackCount.ToStringCached()); } else if (this.TryGetQuality(out cat)) { GenMapUI.DrawThingLabel(this, cat.GetLabelShort()); } } }
public virtual void DrawGUIOverlay() { if (Find.CameraDriver.CurrentZoom == CameraZoomRange.Closest) { QualityCategory qc; if (def.stackLimit > 1) { GenMapUI.DrawThingLabel(this, stackCount.ToStringCached()); } else if (def.drawGUIOverlayQuality && this.TryGetQuality(out qc)) { GenMapUI.DrawThingLabel(this, qc.GetLabelShort()); } } }
public static void DrawBeautyAroundMouse() { BeautyUtility.FillBeautyRelevantCells(UI.MouseCell(), Find.VisibleMap); for (int i = 0; i < BeautyUtility.beautyRelevantCells.Count; i++) { IntVec3 intVec = BeautyUtility.beautyRelevantCells[i]; float num = BeautyUtility.CellBeauty(intVec, Find.VisibleMap, BeautyDrawer.beautyCountedThings); if (num != 0f) { Vector3 v = GenMapUI.LabelDrawPosFor(intVec); GenMapUI.DrawThingLabel(v, Mathf.RoundToInt(num).ToStringCached(), BeautyDrawer.BeautyColor(num, 8f)); } } BeautyDrawer.beautyCountedThings.Clear(); }
public static void DrawPawnLabel(Pawn pawn, Rect bgRect, float alpha = 1f, float truncateToWidth = 9999f, Dictionary <string, string> truncatedLabelsCache = null, GameFont font = GameFont.Tiny, bool alwaysDrawBg = true, bool alignCenter = true) { GUI.color = new Color(1f, 1f, 1f, alpha); Text.Font = font; string pawnLabel = GenMapUI.GetPawnLabel(pawn, truncateToWidth, truncatedLabelsCache, font); float pawnLabelNameWidth = GenMapUI.GetPawnLabelNameWidth(pawn, truncateToWidth, truncatedLabelsCache, font); float summaryHealthPercent = pawn.health.summaryHealth.SummaryHealthPercent; if (alwaysDrawBg || summaryHealthPercent < 0.99900001287460327) { GUI.DrawTexture(bgRect, TexUI.GrayTextBG); } if (summaryHealthPercent < 0.99900001287460327) { Rect rect = bgRect.ContractedBy(1f); Widgets.FillableBar(rect, summaryHealthPercent, GenMapUI.OverlayHealthTex, BaseContent.ClearTex, false); } Color color = PawnNameColorUtility.PawnNameColorOf(pawn); color.a = alpha; GUI.color = color; Rect rect2 = default(Rect); if (alignCenter) { Text.Anchor = TextAnchor.UpperCenter; Vector2 center = bgRect.center; rect2 = new Rect((float)(center.x - pawnLabelNameWidth / 2.0), (float)(bgRect.y - 2.0), pawnLabelNameWidth, 100f); } else { Text.Anchor = TextAnchor.UpperLeft; double x = bgRect.x + 2.0; Vector2 center2 = bgRect.center; float y = center2.y; Vector2 vector = Text.CalcSize(pawnLabel); rect2 = new Rect((float)x, (float)(y - vector.y / 2.0), pawnLabelNameWidth, 100f); } Widgets.Label(rect2, pawnLabel); if (pawn.Drafted) { Vector2 center3 = bgRect.center; Widgets.DrawLineHorizontal((float)(center3.x - pawnLabelNameWidth / 2.0), (float)(bgRect.y + 11.0), pawnLabelNameWidth); } GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; }
private static void DrawBeautyAroundMouse() { if (!Find.PlaySettings.showBeauty) { return; } BeautyUtility.FillBeautyRelevantCells(UI.MouseCell(), Find.CurrentMap); for (int i = 0; i < BeautyUtility.beautyRelevantCells.Count; i++) { IntVec3 intVec = BeautyUtility.beautyRelevantCells[i]; float num = BeautyUtility.CellBeauty(intVec, Find.CurrentMap, beautyCountedThings); if (num != 0f) { GenMapUI.DrawThingLabel((Vector3)GenMapUI.LabelDrawPosFor(intVec), Mathf.RoundToInt(num).ToStringCached(), BeautyColor(num, 8f)); } } beautyCountedThings.Clear(); }
public void DrawPawnGUIOverlay() { if (!pawn.Spawned || pawn.Map.fogGrid.IsFogged(pawn.Position)) { return; } if (!pawn.RaceProps.Humanlike) { switch (Prefs.AnimalNameMode) { case AnimalNameDisplayMode.None: return; case AnimalNameDisplayMode.TameAll: if (pawn.Name == null) { return; } break; case AnimalNameDisplayMode.TameNamed: if (pawn.Name == null || pawn.Name.Numerical) { return; } break; } } Vector2 pos = GenMapUI.LabelDrawPosFor(pawn, -0.6f); GenMapUI.DrawPawnLabel(pawn, pos); if (pawn.CanTradeNow) { pawn.Map.overlayDrawer.DrawOverlay(pawn, OverlayTypes.QuestionMark); } Lord lord = pawn.GetLord(); if (lord != null && lord.CurLordToil != null) { lord.CurLordToil.DrawPawnGUIOverlay(pawn); } }
private static float GetPawnLabelNameWidth(Pawn pawn, float truncateToWidth, Dictionary <string, string> truncatedLabelsCache, GameFont font) { GameFont font2 = Text.Font; Text.Font = font; string pawnLabel = GenMapUI.GetPawnLabel(pawn, truncateToWidth, truncatedLabelsCache, font); float num; if (font == GameFont.Tiny) { num = pawnLabel.GetWidthCached(); } else { num = Text.CalcSize(pawnLabel).x; } if (num < 20f) { num = 20f; } Text.Font = font2; return(num); }
public void DrawPawnGUIOverlay() { if (!this.pawn.Spawned || this.pawn.Map.fogGrid.IsFogged(this.pawn.Position)) { return; } if (!this.pawn.RaceProps.Humanlike) { AnimalNameDisplayMode animalNameMode = Prefs.AnimalNameMode; if (animalNameMode == AnimalNameDisplayMode.None) { return; } if (animalNameMode != AnimalNameDisplayMode.TameAll) { if (animalNameMode == AnimalNameDisplayMode.TameNamed) { if (this.pawn.Name == null || this.pawn.Name.Numerical) { return; } } } else if (this.pawn.Name == null) { return; } } Vector2 pos = GenMapUI.LabelDrawPosFor(this.pawn, -0.6f); GenMapUI.DrawPawnLabel(this.pawn, pos, 1f, 9999f, null, GameFont.Tiny, true, true); if (this.pawn.CanTradeNow) { this.pawn.Map.overlayDrawer.DrawOverlay(this.pawn, OverlayTypes.QuestionMark); } }
public override void DrawGUIOverlay() { float a = 1f - (base.AgeSecs - TimeBeforeStartFadeout) / def.mote.fadeOutTime; GenMapUI.DrawText(textColor: new Color(textColor.r, textColor.g, textColor.b, a), worldPos: new Vector2(exactPosition.x, exactPosition.z), text: text); }
public static void DrawThingLabel(Thing thing, string text, Color textColor) { GenMapUI.DrawThingLabel(GenMapUI.LabelDrawPosFor(thing, -0.4f), text, textColor); }
public static void DrawThingLabel(Thing thing, string text) { GenMapUI.DrawThingLabel(thing, text, GenMapUI.DefaultThingLabelColor); }