private static float GetGene(Pawn pawn, StatDef gene) { if (gene == AnimalGenetics.GatherYield && !Genes.Gatherable(pawn)) { return(0.0f); } return(Genes.GetGene(pawn, gene)); }
public override void DoCell(Rect rect, Pawn pawn, PawnTable table) { float gene = Genes.GetGene(pawn, statDef); GUI.color = Utilities.TextColor(gene); Text.Anchor = TextAnchor.MiddleCenter; Widgets.Label(rect, (gene * 100).ToString("F0") + "%"); Text.Anchor = TextAnchor.UpperLeft; GUI.color = Color.white; }
protected override void FillTab() { Rect rect = new Rect(0f, 0f, this.size.x, this.size.y).ContractedBy(17f); rect.yMin += 10f; Pawn pawn = base.SelPawn; string str; if (pawn.gender != Gender.None) { str = "PawnSummaryWithGender".Translate(pawn.Named("PAWN")); } else { str = "PawnSummary".Translate(pawn.Named("PAWN")); } Text.Font = GameFont.Small; Widgets.Label(new Rect(15f, 15f, rect.width * 0.9f, 30f), "AG.GeneticsOf".Translate() + ": " + pawn.Label); Text.Font = GameFont.Tiny; Widgets.Label(new Rect(15f, 35f, rect.width * 0.9f, 30f), str); float curY = 55f; var affectedStats = Constants.affectedStats; Text.Anchor = TextAnchor.MiddleCenter; Rect rectValue = new Rect(rect.width * 0.6f, curY, rect.width * 0.2f, 20f); Widgets.Label(rectValue, "AG.Value".Translate()); TooltipHandler.TipRegion(rectValue, "AG.ValueTooltop".Translate()); Rect rectParent = new Rect(rect.width * 0.8f, curY, rect.width * 0.2f, 20f); Widgets.Label(rectParent, "AG.Parent".Translate()); TooltipHandler.TipRegion(rectParent, "AG.ParentTooltop".Translate()); curY += 21; foreach (var stat in affectedStats) { if (stat != AnimalGenetics.GatherYield || Genes.Gatherable(pawn)) { curY += DrawRow(rect, curY, Constants.GetLabel(stat), Genes.GetGene(pawn, stat), Genes.GetInheritString(pawn, stat), Genes.GetInheritValue(pawn, stat), Genes.GetTooltip(stat)); } } }
public override float GetValueUnfinalized(StatRequest req, bool applyPostProcess = true) { return(Genes.GetGene(req.Thing as Pawn, ((StatDefWrapper)this.stat).Underlying)); }
public override int Compare(Pawn a, Pawn b) { return(Genes.GetGene(a, statDef).CompareTo(Genes.GetGene(b, statDef))); }