public override void DoCell(Rect rect, Pawn pawn, PawnTable table) { // bail out if showing worksettings is nonsensical if (pawn.Dead || !pawn.workSettings.EverWork) { return; } var incapable = IncapableOfWholeWorkType(pawn); var worktype = def.workType; // create rect in centre of cell var pos = rect.center - new Vector2(WorkTypeBoxSize, WorkTypeBoxSize) / 2f; var box = new Rect(pos.x, pos.y, WorkTypeBoxSize, WorkTypeBoxSize); // plop in the tooltip Func <string> tipGetter = delegate { return(WorkUtilities.TipForPawnWorker(pawn, worktype, incapable)); }; TooltipHandler.TipRegion(box, tipGetter, pawn.thingIDNumber ^ worktype.GetHashCode()); // bail out if worktype is disabled (or pawn has no background story). if (!ShouldDrawCell(pawn)) { return; } // draw the workbox Text.Font = GameFont.Medium; DrawWorkTypeBoxFor(box, pawn, worktype, incapable); Text.Font = GameFont.Small; // handle interactions HandleInteractions(rect, pawn); }
public override void DoCell(Rect rect, Pawn pawn, PawnTable table) { // bail out if showing worksettings is nonsensical if (pawn.Dead || !pawn.workSettings.EverWork) { return; } var workgiver = WorkGiver; // create rect in centre of cell, slightly offsetting left to give the appearance of aligning to worktype. var pos = rect.center - new Vector2(WorkGiverBoxSize, WorkGiverBoxSize) / 2f; var box = new Rect(pos.x - 2f, pos.y, WorkGiverBoxSize, WorkGiverBoxSize); // is the pawn currently capable of doing this job? var incapable = !pawn.CapableOf(workgiver); // plop in the tooltip Func <string> tipGetter = delegate { return(WorkUtilities.TipForPawnWorker(pawn, workgiver, incapable)); }; TooltipHandler.TipRegion(box, tipGetter, pawn.thingIDNumber ^ workgiver.workType.GetHashCode()); // bail out if pawn can't actually do this work if (!ShouldDrawCell(pawn)) { return; } // draw the workbox Text.Font = GameFont.Tiny; DrawWorkGiverBoxFor(box, pawn, workgiver, incapable); // handle interactions HandleInteractions(rect, pawn); }