public static void DoExtraAnimalIcons(Transferable trad, Rect rect, ref float curX)
        {
            Pawn pawn = trad.AnyThing as Pawn;

            if (pawn != null && pawn.RaceProps.Animal)
            {
                if (pawn.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Bond, null) != null)
                {
                    Rect rect2 = new Rect(curX - TransferableUIUtility.BondIconWidth, (rect.height - TransferableUIUtility.BondIconWidth) / 2f, TransferableUIUtility.BondIconWidth, TransferableUIUtility.BondIconWidth);
                    curX -= TransferableUIUtility.BondIconWidth;
                    GUI.DrawTexture(rect2, TransferableUIUtility.BondIcon);
                    string iconTooltipText = TrainableUtility.GetIconTooltipText(pawn);
                    if (!iconTooltipText.NullOrEmpty())
                    {
                        TooltipHandler.TipRegion(rect2, iconTooltipText);
                    }
                }
                if (pawn.health.hediffSet.HasHediff(HediffDefOf.Pregnant, true))
                {
                    Rect rect3 = new Rect(curX - TransferableUIUtility.PregnancyIconWidth, (rect.height - TransferableUIUtility.PregnancyIconWidth) / 2f, TransferableUIUtility.PregnancyIconWidth, TransferableUIUtility.PregnancyIconWidth);
                    curX -= TransferableUIUtility.PregnancyIconWidth;
                    TooltipHandler.TipRegion(rect3, PawnColumnWorker_Pregnant.GetTooltipText(pawn));
                    GUI.DrawTexture(rect3, TransferableUIUtility.PregnantIcon);
                }
            }
        }
        public static void DoExtraAnimalIcons(Transferable trad, Rect rect, ref float curX)
        {
            Pawn pawn = trad.AnyThing as Pawn;

            if (pawn == null || !pawn.RaceProps.Animal)
            {
                return;
            }
            if (pawn.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Bond) != null)
            {
                Rect rect2 = new Rect(curX - BondIconWidth, (rect.height - BondIconWidth) / 2f, BondIconWidth, BondIconWidth);
                curX -= BondIconWidth;
                GUI.DrawTexture(rect2, BondIcon);
                if (Mouse.IsOver(rect2))
                {
                    string iconTooltipText = TrainableUtility.GetIconTooltipText(pawn);
                    if (!iconTooltipText.NullOrEmpty())
                    {
                        TooltipHandler.TipRegion(rect2, iconTooltipText);
                    }
                }
            }
            if (pawn.health.hediffSet.HasHediff(HediffDefOf.Pregnant, mustBeVisible: true))
            {
                Rect rect3 = new Rect(curX - PregnancyIconWidth, (rect.height - PregnancyIconWidth) / 2f, PregnancyIconWidth, PregnancyIconWidth);
                curX -= PregnancyIconWidth;
                if (Mouse.IsOver(rect3))
                {
                    TooltipHandler.TipRegion(rect3, PawnColumnWorker_Pregnant.GetTooltipText(pawn));
                }
                GUI.DrawTexture(rect3, PregnantIcon);
            }
        }
        public static string GetTooltipText(Pawn pawn)
        {
            Hediff_Pregnant pregnantHediff    = PawnColumnWorker_Pregnant.GetPregnantHediff(pawn);
            float           gestationProgress = pregnantHediff.GestationProgress;
            int             num      = (int)(pawn.RaceProps.gestationPeriodDays * 60000f);
            int             numTicks = (int)(gestationProgress * (float)num);

            return("PregnantIconDesc".Translate(numTicks.ToStringTicksToDays("F0"), num.ToStringTicksToDays("F0")));
        }
Esempio n. 4
0
        private void DoRow(Rect rect, TransferableOneWay trad, int index, float availableMass)
        {
            if (index % 2 == 1)
            {
                Widgets.DrawLightHighlight(rect);
            }
            Text.Font = GameFont.Small;
            GUI.BeginGroup(rect);
            float num      = rect.width;
            int   maxCount = trad.MaxCount;
            Rect  rect2    = new Rect(num - 240f, 0f, 240f, rect.height);

            TransferableOneWayWidget.stoppingPoints.Clear();
            if (this.availableMassGetter != null && (!(trad.AnyThing is Pawn) || this.includePawnsMassInMassUsage))
            {
                float num2      = availableMass + this.GetMass(trad.AnyThing) * (float)trad.CountToTransfer;
                int   threshold = (num2 > 0f) ? Mathf.FloorToInt(num2 / this.GetMass(trad.AnyThing)) : 0;
                TransferableOneWayWidget.stoppingPoints.Add(new TransferableCountToTransferStoppingPoint(threshold, "M<", ">M"));
            }
            Pawn pawn  = trad.AnyThing as Pawn;
            bool flag  = pawn != null && (pawn.IsColonist || pawn.IsPrisonerOfColony);
            Rect rect3 = rect2;
            int  min   = 0;
            int  max   = maxCount;
            List <TransferableCountToTransferStoppingPoint> extraStoppingPoints = TransferableOneWayWidget.stoppingPoints;

            TransferableUIUtility.DoCountAdjustInterface(rect3, trad, index, min, max, false, extraStoppingPoints, this.playerPawnsReadOnly && flag);
            num -= 240f;
            if (this.drawMarketValue)
            {
                Rect rect4 = new Rect(num - 100f, 0f, 100f, rect.height);
                Text.Anchor = TextAnchor.MiddleLeft;
                this.DrawMarketValue(rect4, trad);
                num -= 100f;
            }
            if (this.drawMass)
            {
                Rect rect5 = new Rect(num - 100f, 0f, 100f, rect.height);
                Text.Anchor = TextAnchor.MiddleLeft;
                this.DrawMass(rect5, trad, availableMass);
                num -= 100f;
            }
            if (this.drawDaysUntilRot)
            {
                Rect rect6 = new Rect(num - 75f, 0f, 75f, rect.height);
                Text.Anchor = TextAnchor.MiddleLeft;
                this.DrawDaysUntilRot(rect6, trad);
                num -= 75f;
            }
            if (this.drawItemNutrition)
            {
                Rect rect7 = new Rect(num - 75f, 0f, 75f, rect.height);
                Text.Anchor = TextAnchor.MiddleLeft;
                this.DrawItemNutrition(rect7, trad);
                num -= 75f;
            }
            if (this.drawForagedFoodPerDay)
            {
                Rect rect8 = new Rect(num - 75f, 0f, 75f, rect.height);
                Text.Anchor = TextAnchor.MiddleLeft;
                if (!this.DrawGrazeability(rect8, trad))
                {
                    this.DrawForagedFoodPerDay(rect8, trad);
                }
                num -= 75f;
            }
            if (this.drawNutritionEatenPerDay)
            {
                Rect rect9 = new Rect(num - 75f, 0f, 75f, rect.height);
                Text.Anchor = TextAnchor.MiddleLeft;
                this.DrawNutritionEatenPerDay(rect9, trad);
                num -= 75f;
            }
            if (this.ShouldShowCount(trad))
            {
                Rect rect10 = new Rect(num - 75f, 0f, 75f, rect.height);
                Widgets.DrawHighlightIfMouseover(rect10);
                Text.Anchor = TextAnchor.MiddleLeft;
                Rect rect11 = rect10;
                rect11.xMin += 5f;
                rect11.xMax -= 5f;
                Widgets.Label(rect11, maxCount.ToStringCached());
                TooltipHandler.TipRegion(rect10, this.sourceCountDesc);
            }
            num -= 75f;
            if (this.drawEquippedWeapon)
            {
                Rect rect12   = new Rect(num - 30f, 0f, 30f, rect.height);
                Rect iconRect = new Rect(num - 30f, (rect.height - 30f) / 2f, 30f, 30f);
                this.DrawEquippedWeapon(rect12, iconRect, trad);
                num -= 30f;
            }
            Pawn pawn2 = trad.AnyThing as Pawn;

            if (pawn2 != null && pawn2.def.race.Animal)
            {
                Rect rect13 = new Rect(num - TransferableOneWayWidget.BondIconWidth, (rect.height - TransferableOneWayWidget.BondIconWidth) / 2f, TransferableOneWayWidget.BondIconWidth, TransferableOneWayWidget.BondIconWidth);
                num -= TransferableOneWayWidget.BondIconWidth;
                Rect rect14 = new Rect(num - TransferableOneWayWidget.PregnancyIconWidth, (rect.height - TransferableOneWayWidget.PregnancyIconWidth) / 2f, TransferableOneWayWidget.PregnancyIconWidth, TransferableOneWayWidget.PregnancyIconWidth);
                num -= TransferableOneWayWidget.PregnancyIconWidth;
                string iconTooltipText = TrainableUtility.GetIconTooltipText(pawn2);
                if (!iconTooltipText.NullOrEmpty())
                {
                    TooltipHandler.TipRegion(rect13, iconTooltipText);
                }
                if (pawn2.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Bond, null) != null)
                {
                    GUI.DrawTexture(rect13, TransferableOneWayWidget.BondIcon);
                }
                if (pawn2.health.hediffSet.HasHediff(HediffDefOf.Pregnant, true))
                {
                    TooltipHandler.TipRegion(rect14, PawnColumnWorker_Pregnant.GetTooltipText(pawn2));
                    GUI.DrawTexture(rect14, TransferableOneWayWidget.PregnantIcon);
                }
            }
            Rect idRect = new Rect(0f, 0f, num, rect.height);

            TransferableUIUtility.DrawTransferableInfo(trad, idRect, Color.white);
            GenUI.ResetLabelAlign();
            GUI.EndGroup();
        }
 protected override string GetIconTip(Pawn pawn)
 {
     return(PawnColumnWorker_Pregnant.GetTooltipText(pawn));
 }
        protected override Texture2D GetIconFor(Pawn pawn)
        {
            Hediff_Pregnant pregnantHediff = PawnColumnWorker_Pregnant.GetPregnantHediff(pawn);

            return((pregnantHediff == null) ? null : PawnColumnWorker_Pregnant.Icon);
        }