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

            if (headOption != null)
            {
                pawn.HeadType = headOption.HeadType;
            }
        }
コード例 #2
0
        public override bool IsOptionSelected(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionHead headOption = option as PawnLayerOptionHead;

            if (headOption == null)
            {
                return(false);
            }
            return(pawn.HeadType == headOption.HeadType);
        }
コード例 #3
0
        private List <PawnLayerOption> InitializeHeadOptions(ThingDef pawnDef, Gender gender)
        {
            List <PawnLayerOption> options = new List <PawnLayerOption>();

            foreach (var headType in PrepareCarefully.Instance.Providers.HeadTypes.GetHeadTypes(pawnDef, gender))
            {
                PawnLayerOptionHead option = new PawnLayerOptionHead();
                option.HeadType = headType;
                options.Add(option);
            }
            return(options);
        }
コード例 #4
0
        public override int?GetSelectedIndex(CustomPawn pawn)
        {
            int selectedIndex = options.FirstIndexOf((option) => {
                PawnLayerOptionHead headOption = option as PawnLayerOptionHead;
                if (headOption == null)
                {
                    return(false);
                }
                else
                {
                    return(headOption.HeadType == pawn.HeadType);
                }
            });

            if (selectedIndex > -1)
            {
                return(selectedIndex);
            }
            else
            {
                return(null);
            }
        }