private static void DoRow(Rect rect, Thing thing, CompVehicle vehicle, ref Pawn specificNeedsTabForPawn, bool doNeeds) { GUI.BeginGroup(rect); Rect rect2 = rect.AtZero(); Pawn pawn = thing as Pawn; //if (listingUsesAbandonSpecificCountButtons) //{ // if (thing.stackCount != 1) // { // CaravanPeopleAndItemsTabUtility.DoAbandonSpecificCountButton(rect2, thing, caravan); // } // rect2.width -= 24f; //} //CaravanPeopleAndItemsTabUtility.DoAbandonButton(rect2, thing, caravan); rect2.width -= 24f; Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, thing); rect2.width -= 24f; if (pawn != null && !pawn.Dead) { CaravanPeopleAndItemsTabUtility.DoOpenSpecificTabButton(rect2, pawn, ref specificNeedsTabForPawn); rect2.width -= 24f; } if (pawn == null) { Rect rect3 = rect2; rect3.xMin = rect3.xMax - 60f; CaravanPeopleAndItemsTabUtility.TryDrawMass(thing, rect3); rect2.width -= 60f; } if (Mouse.IsOver(rect2)) { Widgets.DrawHighlight(rect2); } Rect rect4 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f); Widgets.ThingIcon(rect4, thing, 1f); if (pawn != null) { Rect bgRect = new Rect(rect4.xMax + 4f, 16f, 100f, 18f); GenMapUI.DrawPawnLabel(pawn, bgRect, 1f, 100f, null, GameFont.Small, false, false); if (doNeeds) { GetNeedsToDisplay(pawn, tmpNeeds); float xMax = bgRect.xMax; for (int i = 0; i < tmpNeeds.Count; i++) { Need need = tmpNeeds[i]; int maxThresholdMarkers = 0; bool doTooltip = true; Rect rect5 = new Rect(xMax, 0f, 100f, 50f); #pragma warning disable IDE0019 // Use pattern matching Need_Mood mood = need as Need_Mood; #pragma warning restore IDE0019 // Use pattern matching if (mood != null) { maxThresholdMarkers = 1; doTooltip = false; //TooltipHandler.TipRegion(rect5, new TipSignal(() => CaravanPeopleAndItemsTabUtility.CustomMoodNeedTooltip(mood), rect5.GetHashCode())); } need.DrawOnGUI(rect5, maxThresholdMarkers, 10f, false, doTooltip); xMax = rect5.xMax; } } if (pawn.Downed) { GUI.color = new Color(1f, 0f, 0f, 0.5f); Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width); GUI.color = Color.white; } } else { Rect rect6 = new Rect(rect4.xMax + 4f, 0f, 300f, 30f); Text.Anchor = TextAnchor.MiddleLeft; Text.WordWrap = false; Widgets.Label(rect6, thing.LabelCap); Text.Anchor = TextAnchor.UpperLeft; Text.WordWrap = true; } GUI.EndGroup(); }
private void DrawThingRow(ref float y, float width, Thing thing, bool inventory = false) { Rect rect = new Rect(0f, y, width, 28f); Widgets.InfoCardButton((float)(rect.width - 24.0), y, thing); rect.width -= 24f; if (this.CanControl && (inventory || this.CanControlColonist || (this.SelPawnForGear.Spawned && !this.SelPawnForGear.Map.IsPlayerHome))) { Rect rect2 = new Rect((float)(rect.width - 24.0), y, 24f, 24f); TooltipHandler.TipRegion(rect2, "DropThing".Translate()); if (Widgets.ButtonImage(rect2, TexButton.Drop)) { SoundDefOf.TickHigh.PlayOneShotOnCamera(null); this.InterfaceDrop(thing); } rect.width -= 24f; } if (this.CanControlColonist) { if (thing.def.IsNutritionGivingIngestible && thing.IngestibleNow && base.SelPawn.RaceProps.CanEverEat(thing)) { Rect rect3 = new Rect((float)(rect.width - 24.0), y, 24f, 24f); TooltipHandler.TipRegion(rect3, "ConsumeThing".Translate(thing.LabelNoCount)); if (Widgets.ButtonImage(rect3, TexButton.Ingest)) { SoundDefOf.TickHigh.PlayOneShotOnCamera(null); this.InterfaceIngest(thing); } } rect.width -= 24f; } Rect rect4 = rect; rect4.xMin = (float)(rect4.xMax - 60.0); CaravanPeopleAndItemsTabUtility.TryDrawMass(thing, rect4); rect.width -= 60f; if (Mouse.IsOver(rect)) { GUI.color = ITab_Pawn_Gear.HighlightColor; GUI.DrawTexture(rect, TexUI.HighlightTex); } if ((UnityEngine.Object)thing.def.DrawMatSingle != (UnityEngine.Object)null && (UnityEngine.Object)thing.def.DrawMatSingle.mainTexture != (UnityEngine.Object)null) { Widgets.ThingIcon(new Rect(4f, y, 28f, 28f), thing, 1f); } Text.Anchor = TextAnchor.MiddleLeft; GUI.color = ITab_Pawn_Gear.ThingLabelColor; Rect rect5 = new Rect(36f, y, (float)(rect.width - 36.0), rect.height); string text = thing.LabelCap; Apparel apparel = thing as Apparel; if (apparel != null && this.SelPawnForGear.outfits != null && this.SelPawnForGear.outfits.forcedHandler.IsForced(apparel)) { text = text + ", " + "ApparelForcedLower".Translate(); } Text.WordWrap = false; Widgets.Label(rect5, text.Truncate(rect5.width, null)); Text.WordWrap = true; string text2 = thing.LabelCap; if (thing.def.useHitPoints) { string text3 = text2; text2 = text3 + "\n" + thing.HitPoints + " / " + thing.MaxHitPoints; } TooltipHandler.TipRegion(rect, text2); y += 28f; }