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); }
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; }
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(); } }
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; } }
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); }
public virtual void SelectOption(CustomPawn pawn, PawnLayerOption option) { }
public virtual bool IsOptionSelected(CustomPawn pawn, PawnLayerOption option) { return(false); }