Skip to main content

CosmeticPresetsManager

A class in Root.Township, Alta.Customization.

Client: runs the cosmetic preset shelf. On login it loads the account's saved presets into trophies on the slots, and it makes new trophies from the current outfit.

Constructors​

MemberWhat it is
CosmeticPresetsManager()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

14 private and internal fields
MemberWhat it is
private PlayerCustomizationHandler baseHandlerCustomization handler for the player's own outfit.
private AltaEvent beganUsingFromStoreEvent raised when the outfit starts using items the player doesn't own.
private CosmeticCustomizationManager customizationManagerThe cosmetic customization manager in the room.
private PlayerCustomizationHandler handlerPrefabCustomization handler prefab. Not used in this class.
private bool isDestroyedSet in OnDestroy.
private bool isUsingOnlyOwnedItemsLast known state of whether the outfit uses only owned items.
private CosmeticPresetTrophy latestTrophyThe last trophy made by GetCurrentPreset. Burned if a new one is made before it is shelved.
private static Logger loggerNLog logger for this class.
private Transform newPresetsPositionWhere new trophies appear.
private AltaEvent requestPresetFromStoreEvent raised when the outfit needs store items before it can become a preset.
private CosmeticRotatingSlot rotatingSlotA CosmeticRotatingSlot reference. Not used in this class.
private CosmeticPresetSlot[] slotsThe preset shelf slots.
private AltaEvent stopedUsingFromStoreEvent raised when the outfit goes back to only owned items.
private CosmeticPresetTrophy trophyPrefabPrefab for preset trophies.

Methods​

MemberWhat it is
void CheckStorageUsage()Raises the store events when the outfit switches between only owned items and items from the store.
async void GetCurrentPreset()Makes a new trophy from the current outfit, or asks the player to buy store items first if the outfit uses any.
protected override async void LoggedIn()Clears the slots, loads the account's presets into trophies, and deletes presets of 4 bytes or less.
protected override void LoggedOut()Does nothing.
protected override void OnDestroy()Marks the manager destroyed so a late login result is ignored.
protected override void Start()Gives each slot its index and listens for the customization end button.
5 private and internal methods
MemberWhat it is
private async void CheckSavePresetIfEmpty()When the player finishes customizing and no preset is saved, saves the current outfit as preset 0.
private void CheckStorageUsage(uint definition)Raises the store events when the outfit switches between only owned items and items from the store.
private CosmeticPresetTrophy GetNewTrophy()Spawns a local, non-networked trophy from the prefab.
private void OnDisable()Destroys every trophy on the shelf and the latest unsaved trophy.
private void SetupWithManager(PlayerCharacterCustomizationManager manager)Watches the customization manager's cosmetics for changes, or waits until the handler has one.

Used in​

Members of other types that take, return or hold a CosmeticPresetsManager: