示例#1
0
        public override bool IsOptionSelected(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionAlienAddon addonOption = option as PawnLayerOptionAlienAddon;

            if (addonOption == null)
            {
                return(false);
            }
            if (pawn.AlienRace != null)
            {
                ThingComp alienComp = pawn.Pawn.AllComps.FirstOrDefault((ThingComp comp) => {
                    return(comp.GetType().Name == "AlienComp");
                });
                if (alienComp == null)
                {
                    return(false);
                }
                FieldInfo variantsField = ReflectionUtil.GetPublicField(alienComp, "addonVariants");
                if (variantsField == null)
                {
                    return(false);
                }
                List <int> variants = null;
                try {
                    variants = (List <int>)variantsField.GetValue(alienComp);
                }
                catch (Exception) {
                    return(false);
                }
                int selectedIndex = variants[AlienAddon.VariantIndex];
                return(selectedIndex == addonOption.Index);
            }
            return(false);
        }
示例#2
0
        protected void SelectNextPawnLayerOption(CustomPawn customPawn, int direction)
        {
            int optionCount   = selectedPawnLayer.Options.Count;
            int?optionalIndex = selectedPawnLayer.GetSelectedIndex(customPawn);

            if (optionalIndex == null)
            {
                return;
            }
            int index = optionalIndex.Value;

            index += direction;
            if (index < 0)
            {
                index = optionCount - 1;
            }
            else if (index >= optionCount)
            {
                index = 0;
            }
            PawnLayerOption option = selectedPawnLayer.Options[index];

            selectedPawnLayer.SelectOption(customPawn, option);
            this.pawnLayerLabel = option.Label;
        }
示例#3
0
        public override void SelectOption(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionAlienAddon addonOption = option as PawnLayerOptionAlienAddon;

            if (addonOption == null)
            {
                return;
            }
            if (pawn.AlienRace != null)
            {
                ThingComp alienComp = pawn.Pawn.AllComps.FirstOrDefault((ThingComp comp) => {
                    return(comp.GetType().Name == "AlienComp");
                });
                if (alienComp == null)
                {
                    return;
                }
                FieldInfo variantsField = ReflectionUtil.GetPublicField(alienComp, "addonVariants");
                if (variantsField == null)
                {
                    return;
                }
                List <int> variants = null;
                try {
                    variants = (List <int>)variantsField.GetValue(alienComp);
                }
                catch (Exception) {
                    return;
                }
                variants[AlienAddon.VariantIndex] = addonOption.Index;
                pawn.MarkPortraitAsDirty();
            }
        }
示例#4
0
        public override void SelectOption(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionHead headOption = option as PawnLayerOptionHead;

            if (headOption != null)
            {
                pawn.HeadType = headOption.HeadType;
            }
        }
        public override void SelectOption(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionBody bodyOption = option as PawnLayerOptionBody;

            if (bodyOption != null)
            {
                pawn.BodyType = bodyOption.BodyTypeDef;
            }
        }
示例#6
0
        public override bool IsOptionSelected(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionHead headOption = option as PawnLayerOptionHead;

            if (headOption == null)
            {
                return(false);
            }
            return(pawn.HeadType == headOption.HeadType);
        }
        public override bool IsOptionSelected(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionBody bodyOption = option as PawnLayerOptionBody;

            if (bodyOption == null)
            {
                return(false);
            }
            return(pawn.BodyType == bodyOption.BodyTypeDef);
        }
        public override void SelectOption(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionHair hairOption = option as PawnLayerOptionHair;

            if (hairOption != null)
            {
                pawn.Pawn.story.hairDef = hairOption.HairDef;
                pawn.MarkPortraitAsDirty();
            }
        }
        public override bool IsOptionSelected(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionHair hairOption = option as PawnLayerOptionHair;

            if (hairOption == null)
            {
                return(false);
            }
            return(pawn.Pawn.story.hairDef == hairOption.HairDef);
        }
示例#10
0
 public virtual void SelectOption(CustomPawn pawn, PawnLayerOption option)
 {
 }
示例#11
0
 public virtual bool IsOptionSelected(CustomPawn pawn, PawnLayerOption option)
 {
     return(false);
 }