コード例 #1
0
        public override void SelectOption(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionBody bodyOption = option as PawnLayerOptionBody;

            if (bodyOption != null)
            {
                pawn.BodyType = bodyOption.BodyTypeDef;
            }
        }
コード例 #2
0
        public override bool IsOptionSelected(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionBody bodyOption = option as PawnLayerOptionBody;

            if (bodyOption == null)
            {
                return(false);
            }
            return(pawn.BodyType == bodyOption.BodyTypeDef);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
            }
        }