Class CharacterCreationMenuManager
- Assembly
- Assembly-CSharp.dll
[DefaultExecutionOrder(-50)]
[DisallowMultipleComponent]
public class CharacterCreationMenuManager : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourCharacterCreationMenuManager
Fields
OnCharacterSaved
Invoked when the ActiveCharacterDraft is saved.
[Space]
[BoxGroup("Events")]
public UnityEvent<LayeredCharacter> OnCharacterSaved
Field Value
- UnityEvent<LayeredCharacter>
OnMenuDisabled
[BoxGroup("Events")]
public UnityEvent OnMenuDisabled
Field Value
- UnityEvent
Properties
ActiveCharacterDraft
public CharacterDraft ActiveCharacterDraft { get; }
Property Value
ActiveCharacterType
The LayeredCharacterTypeSO being used when the Character Creation Menu is active.
public LayeredCharacterTypeSO ActiveCharacterType { get; }
Property Value
AutoEnableWithPrimaryCharacter
Automatically enables the character creation menu in the start method with the SingleSlotCharacterGroup a part of the Character Type used.
public bool AutoEnableWithPrimaryCharacter { get; }
Property Value
DefaultCharacterType
The LayeredCharacterTypeSO that is assigned if ActiveCharacterType is null.
public LayeredCharacterTypeSO DefaultCharacterType { get; }
Property Value
EnabledAndSetup
True if the Character Creation Menu is currently enabled and finished loading.
public bool EnabledAndSetup { get; }
Property Value
Instance
Property for accessing the single instance of CharacterCreationMenuManager.
public static CharacterCreationMenuManager Instance { get; }
Property Value
MenuContents
The root game object of the Character Creation Menu. Must be separate from the game object this script is attached to
public GameObject MenuContents { get; }
Property Value
- GameObject
NewCharacterTemplate
If assigned, the template will be used when creating a new character instead of creating a blank character.
public LayeredCharacterTemplateSO NewCharacterTemplate { get; }
Property Value
Methods
DisableMenu()
Disable the Character Creation Menu.
public void DisableMenu()
EnableMenu_EditCharacter(LayeredCharacter, bool)
Enable the Character Creation Menu to edit a pre existing character.
public void EnableMenu_EditCharacter(LayeredCharacter character, bool enableMenuContents = true)
Parameters
character
LayeredCharacterThe character to be edited in the Character Creation Menu.
enableMenuContents
boolOptional bool. When not toggled the Character Creation Menu will not automatically open but will still be active and enabled.
Remarks
A copy of the character will be created and editable. When saved any changes made to the copy will be applied to the original character.
Exceptions
- ArgumentNullException
Thrown when the
character
is null.
EnableMenu_NewCharacterInFlexibleGroup(string, FlexibleCharacterGroup, bool)
Enable the Character Creation Menu to create a new character inside a FlexibleCharacterGroup.
public void EnableMenu_NewCharacterInFlexibleGroup(string characterName, FlexibleCharacterGroup flexibleGroup, bool enableMenuContents = true)
Parameters
characterName
stringThe name of the new character.
flexibleGroup
FlexibleCharacterGroupThe FlexibleCharacterGroup the new character will be added to when saved.
enableMenuContents
boolOptional bool. When not toggled the Character Creation Menu will not automatically open but will still be active and enabled.
Remarks
A new character will be created and editable. When saved any changes made to the copy will be applied to the original character.
Exceptions
- ArgumentNullException
Thrown when the
flexibleGroup
is null.- ArgumentException
Thrown when the
characterName
is blank.
EnableMenu_NewPrimaryCharacterSlot(LayeredCharacterTypeSO, bool)
Enable the Character Creation Menu for the SingleSlotCharacterGroup in a Character Type located in the LayeredCharacterGroupManager. Creates a new character, Overrides the character if one already exists.
public void EnableMenu_NewPrimaryCharacterSlot(LayeredCharacterTypeSO characterType = null, bool enableMenuContents = true)
Parameters
characterType
LayeredCharacterTypeSOThe Character Type used to find the SingleSlotCharacterGroup.
enableMenuContents
boolOptional bool. When not toggled the Character Creation Menu will not automatically open but will still be active and enabled.
Remarks
If a character does not exist in the group, the new character will be put in the group when saved. If a character already exists it will overridden when the new character is saved.
Exceptions
- ArgumentNullException
Thrown when
characterType
is null.- ArgumentException
Thrown when
characterType
is invalid.
EnableMenu_PrimaryCharacterSlot(LayeredCharacterTypeSO, bool)
Enable the Character Creation Menu for the SingleSlotCharacterGroup in a Character Type located in the LayeredCharacterGroupManager. If a character exists, use it; otherwise, create a new one.
public void EnableMenu_PrimaryCharacterSlot(LayeredCharacterTypeSO characterType = null, bool enableMenuContents = true)
Parameters
characterType
LayeredCharacterTypeSOThe Character Type used to find the SingleSlotCharacterGroup.
enableMenuContents
boolOptional bool. When not toggled the Character Creation Menu will not automatically open but will still be active and enabled.
Remarks
If a character already exists it will be copied and editable inside the menu. When the character is saved, all changes will be applied to the original character.
Exceptions
- ArgumentException
Thrown when
characterType
is invalid.
ResetCharacter()
Reset the LayeredCharacter inside the ActiveCharacterDraft to the state it was in when the Character Creation Menu was first enabled.
public void ResetCharacter()
SaveCharacter()
Save the ActiveCharacterDraft and put it in a group if relevent.
public void SaveCharacter()
Events
OnBeforeMenuDisabled
public event EventHandler OnBeforeMenuDisabled
Event Type
OnCharacterSavedInMenuInstance
public static event EventHandler<LayeredCharacter> OnCharacterSavedInMenuInstance
Event Type
OnMenuEnabledAndSetup
public event EventHandler OnMenuEnabledAndSetup
Event Type
OnMenuInstanceDisabled
public static event EventHandler<CharacterCreationMenuManager> OnMenuInstanceDisabled
Event Type
OnMenuLoadingProgressUpdated
public event EventHandler<float> OnMenuLoadingProgressUpdated