public override void SelectOption(CustomPawn pawn, PawnLayerOption option) { PawnLayerOptionBody bodyOption = option as PawnLayerOptionBody; if (bodyOption != null) { pawn.BodyType = bodyOption.BodyTypeDef; } }
public override bool IsOptionSelected(CustomPawn pawn, PawnLayerOption option) { PawnLayerOptionBody bodyOption = option as PawnLayerOptionBody; if (bodyOption == null) { return(false); } return(pawn.BodyType == bodyOption.BodyTypeDef); }
private List <PawnLayerOption> InitializeBodyOptions(ThingDef pawnDef, Gender gender) { List <PawnLayerOption> options = new List <PawnLayerOption>(); foreach (var bodyType in PrepareCarefully.Instance.Providers.BodyTypes.GetBodyTypesForPawn(pawnDef, gender)) { PawnLayerOptionBody option = new PawnLayerOptionBody(); option.BodyTypeDef = bodyType; options.Add(option); } return(options); }
public override int?GetSelectedIndex(CustomPawn pawn) { int selectedIndex = options.FirstIndexOf((option) => { PawnLayerOptionBody bodyOption = option as PawnLayerOptionBody; if (bodyOption == null) { return(false); } else { return(bodyOption.BodyTypeDef == pawn.BodyType); } }); if (selectedIndex > -1) { return(selectedIndex); } else { return(null); } }