Skip to main content

CosmeticRotatingSlot

A class in Root.Township, Alta.Customization.

The cosmetic preset shelf slot in the customization room: ten numbered preset slots shown one at a time, each saved to the API as a trophy. Client side; used by CosmeticPresetsManager.

Constructors​

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

Fields​

10 private and internal fields
MemberWhat it is
private GameObject androidWaitTimerGameObject hidden when switching to an empty index.
private CosmeticPresetData[] dataPreset data for the 10 indices, null where empty.
private GameObject effectParentGameObject holding the highlight effects.
private AltaEvent gotTrophyEvent raised when a preset is saved.
private Coroutine hapticsThe running haptics coroutine, if any.
private float hapticStrengthStrength of the hover haptic pulse.
private int indexBacking field for Index.
private TextRenderer indexTextText showing the current index.
private Transform trophyPositionTransform marking where the trophy sits.
private CosmeticPresetTrophyTrigger trophySourceTrigger that detects trophies near the slot.

Properties​

MemberWhat it is
Vector3 TargetPosition { get; }World position where the trophy sits.
Quaternion TargetRotation { get; }World rotation the trophy sits at.
CosmeticPresetTrophy Trophy { get; private set; }The trophy object used to show the preset of the current slot.
1 private and internal property
MemberWhat it is
private int Index { get; set; }The preset index (0 to 9) shown. Setting it updates the number text, shown one higher.

Methods​

MemberWhat it is
void Clear()Destroys the trophy and frees all loaded preset data.
void DecreaseIndex()Moves to the previous slot, wrapping from 1 to 10.
async void DeregisterTrophy(CosmeticPresetTrophy trophy)When the shown trophy is removed from a filled slot, hides it, clears the slot and deletes that preset through the API.
void IncreaseIndex()Moves to the next slot, wrapping from 10 to 1.
bool IsAllEmpty()True when none of the ten slots holds a preset.
async void SaveTrophy(CosmeticPresetTrophy trophy)If the current slot is empty, stores the released trophy's cosmetics there, shows it and creates the preset through the API.
void Setup(CosmeticPresetTrophy trophy, IEnumerable<UserPresetDataInfo> databasePresets)Loads the user's saved presets into the slots and shows the first filled one, or hides the trophy if there are none.
void UpdateIndex(float progress)Switches to a slot (by index, or from a 0 to 1 progress value), dropping the trophy back into place and applying that slot's preset.
void UpdateIndex(int newIndex)Switches to a slot (by index, or from a 0 to 1 progress value), dropping the trophy back into place and applying that slot's preset.
9 private and internal methods
MemberWhat it is
private bool ApplyTrophy(int index)Shows the preset at an index on the trophy, if that preset has data.
private void Awake()Hooks the trophy trigger's release, enter and exit events.
private void DisableEffects(CosmeticPresetTrophy trophy)Hides the highlight effects. The overload taking a trophy only does it once no trophies are in the trigger.
private void DisableEffects()Hides the highlight effects. The overload taking a trophy only does it once no trophies are in the trigger.
private void EnableEffects(CosmeticPresetTrophy trophy)Shows the highlight effects and starts haptics while the current index is empty.
private CosmeticPresetData GetDataFrom(UserPresetDataInfo source)Copies preset data from an API preset or a trophy into a pooled array.
private CosmeticPresetData GetDataFrom(CosmeticPresetTrophy source)Copies preset data from an API preset or a trophy into a pooled array.
private IEnumerator Haptics() (iterator)Coroutine that buzzes the hand holding a hovering trophy.
private void ResetTrophy()Snaps the trophy back to the slot, makes it kinematic and enables its colliders.

Used in​

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