Class CharacterCreator
The character creator is displayed when a person (or household) is being edited in terms of their Clothes and PersonalityTypes.
public class CharacterCreator
- Inheritance
-
CharacterCreator
- Inherited Members
- Extension Methods
Fields
MaxHouseholdSize
The maximum amount of people allowed in one household at a time. This is a constant that is set to 8.
public const int MaxHouseholdSize = 8
Field Value
MaxOutfitAmount
The maximum amount of outfits that any given person can have. This is a constant that is set to 10.
public const int MaxOutfitAmount = 10
Field Value
Properties
Active
The currently displayed CharacterCreator instance, or null if the character editor is closed
public static CharacterCreator Active { get; }
Property Value
Person
The person for whom the character creator is currently open.
public PersonLike Person { get; }
Property Value
Methods
BoughtItem(PersonLike, WornClothes)
A method that is called in CharacterCreator when a PersonLike buys the given clothes.
This method also causes OnBoughtItem to be raised.
public static void BoughtItem(PersonLike person, WornClothes clothes)
Parameters
personPersonLikeThe person who is buying the
clothes.clothesWornClothesThe clothes bought.
CanCloseOrExport()
Returns whether the character creator currently allows being closed or for the current household to be exported. The return value is based on IsPersonComplete(PersonLike) and HasAdultPerson(IEnumerable<PersonLike>).
public CharacterCreator.CharacterCompletion CanCloseOrExport()
Returns
- CharacterCreator.CharacterCompletion
Whether the character creator can currently be closed or exported.
CreateNameSelector(PersonLike, Element)
Creates a name selector element for the given person and adds it to the given parent.
public static void CreateNameSelector(PersonLike person, Element parent)
Parameters
personPersonLikeThe person.
parentElementThe parent element to add the name selector to.
CreatePerson(Type, Map, Household)
Creates a person of the given type using CreateCharacterCreator and adds them to the given household.
This method should only be called for person types whose CreateCharacterCreator method is nonnull.
public static PersonLike CreatePerson(Type type, Map map, Household household)
Parameters
typeTypeThe person type of which an instance should be created.
mapMapThe map.
householdHouseholdThe household to add them to.
Returns
- PersonLike
The created person.
CreatePersonalitySelector(PersonLike, int?)
Creates a personality selector element for the given person and returns it as a MLEM.Ui.Elements.Group.
public static Group CreatePersonalitySelector(PersonLike person, int? amountRemovable)
Parameters
personPersonLikeThe person.
amountRemovableint?The amount of personalities that can be removed from the
person's current PersonalityTypes. If this is 0, no current personalities are removable. If this is null, the personality selector is considered to be in "full edit mode", meaning all personalities can be removed or changed.
Returns
- Group
CreatePregnancyAbilitySelector(PersonLike, Element)
Creates a pregnancy ability selector element for the given person and adds it to the given parent.
public static void CreatePregnancyAbilitySelector(PersonLike person, Element parent)
Parameters
personPersonLikeThe person.
parentElementThe parent element to add the pregnancy ability selector to.
CreatePronounSelector(Person, Element)
Creates a pronoun selector element for the given person and adds it to the given parent.
public static bool CreatePronounSelector(Person person, Element parent)
Parameters
personPersonThe person.
parentElementThe parent element to add the pronoun selector to.
Returns
CreateVoiceSelector(PersonLike, Element)
Creates a voice selector element for the given person and adds it to the given parent.
public static void CreateVoiceSelector(PersonLike person, Element parent)
Parameters
personPersonLikeThe person.
parentElementThe parent element to add the voice selector to.
GetCustomPrice(PersonLike, WornClothes)
Returns the custom price that the given WornClothes should be sold with in the CharacterCreator.
This is influenced by the given person's personalities, as well as the OnGetCustomPrice event.
public static float? GetCustomPrice(PersonLike person, WornClothes clothes)
Parameters
personPersonLikeThe person who is buying the
clothes.clothesWornClothesThe clothes whose price to get.
Returns
IsPersonComplete(PersonLike)
A method that determines whether the given person is complete, meaning the character creator can now be exited.
A person is considered complete if their PersonalityType set is full based on MaxMajorPersonalities, as well as if their FirstName, LastName and Pronouns are set.
public static CharacterCreator.CharacterCompletion IsPersonComplete(PersonLike person)
Parameters
personPersonLikeThe person.
Returns
- CharacterCreator.CharacterCompletion
Whether the person is complete.
Open(PersonLike, bool)
Opens a new CharacterCreator for the given person (and their household).
public static void Open(PersonLike person, bool full)
Parameters
personPersonLikeThe person to open in the character creator
fullboolIf this value is true, editing the person's name, skin and eye color and personality is possible
Events
OnBoughtItem
An event that is invoked when a Clothes item is bought in BoughtItem(PersonLike, WornClothes). Use this event to add emotion modifiers based on the clothing item bought in the character creator.
public static event CharacterCreator.BoughtItemDelegate OnBoughtItem
Event Type
OnBuildModeButton
An event that is invoked when this tool's build mode buttons are created using BuildModeButton(string, string, GenericCallback, DrawCallback, float, IEnumerable<TextureRegion>, string, IEnumerable<string>, float?). The button that is created is passed as the second argument, and can be modified based on the object type.
public static event Action<Clothes, WornClothes, Button> OnBuildModeButton
Event Type
- Action<Clothes, WornClothes, Button>
OnGetCustomPrice
An event that is invoked when GetCustomPrice(PersonLike, WornClothes) is called. Use this event to change the custom price of a clothing item bought in the character creator.
public static event CharacterCreator.GetCustomPriceDelegate OnGetCustomPrice