Ejemplo n.º 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);
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 4
0
        public override void SelectOption(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionHead headOption = option as PawnLayerOptionHead;

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

            if (bodyOption != null)
            {
                pawn.BodyType = bodyOption.BodyTypeDef;
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 7
0
        public override bool IsOptionSelected(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionBody bodyOption = option as PawnLayerOptionBody;

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

            if (hairOption != null)
            {
                pawn.Pawn.story.hairDef = hairOption.HairDef;
                pawn.MarkPortraitAsDirty();
            }
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
 public virtual void SelectOption(CustomPawn pawn, PawnLayerOption option)
 {
 }
Ejemplo n.º 11
0
 public virtual bool IsOptionSelected(CustomPawn pawn, PawnLayerOption option)
 {
     return(false);
 }