Skip to main content

CustomizationState

A class in Root.Township, Alta.PlayerStates.

The player state for the character customization room. The client spawns the room and a customization controller; when the player finishes, the server saves their cosmetics and moves them to playing.

Constructors​

MemberWhat it is
CustomizationState(IPostProcessController postProcessController)Creates a CustomizationState from postProcessController.

Fields​

4 private and internal fields
MemberWhat it is
private CustomizationPlayerController customizationControllerThe local customization player controller while the room is open.
private CosmeticCustomizationManager customizationRoomThe spawned CosmeticCustomizationManager room.
private static readonly Logger loggerClass logger.
private readonly IPostProcessController postProcessControllerPost processing controller, reset when the room opens.

Properties​

MemberWhat it is
override string Name { get; set; }"Customization State".
override PlayerStateType StateType { get; }PlayerStateType.Customization.
1 private and internal property
MemberWhat it is
private CustomizationStateSettings Settings { get; }The state's CustomizationStateSettings (room prefab, position, fade time and so on).

Methods​

MemberWhat it is
protected override void OnActivate()Server: loads the chunk at the player's spawn position if they are not in one yet.
protected override async void OnActivateRemote(bool isPlayerCharacterSpawned)Client, local player: spawns the customization room and controller, then resets post processing.
protected override void OnDeactivate()Server: counts a finish customization action for the player.
protected override void OnDeactivateRemote(bool isPlayerCharacterSpawned)Client, local player: fades out, unlinks and destroys the customization controller and room.
protected override async void Sync(IPlayer player, Stream stream)Sends the chosen cosmetics. On the server it checks them, saves them, syncs them to others and starts the customization to playing transition.
5 private and internal methods
MemberWhat it is
private void DestroyCustomizationControllerAndRoom()Client: destroys the customization controller and room.
private void RepositionPlayer()Client: turns and moves the customization controller to the room position, then fades the screen back in.
private void SpawnController()Client: spawns the customization player controller at the room, links it to the player and initializes it locally.
private async Task SpawnCustomizationRoom()Client: loads owned cosmetics, spawns the room and makes its end button send the chosen cosmetics.
private async Task VerifyCustomization(bool isValid)Server: checks the player owns the sent cosmetics, and randomizes from owned items if not.