Skip to main content

SyncController

A class in Root.Township, ATT.MicroTutorial.

Network messages between server and client for micro tutorials: spawn, despawn and clear step content, and the client's load acknowledgement. Built on a sync entity.

Constructors​

MemberWhat it is
SyncController(NetworkEntity syncEntity)Creates a SyncController from syncEntity.

Fields​

6 private and internal fields
MemberWhat it is
private static readonly MicroTutorialLogger loggerMicro tutorial logger for this class.
private readonly MethodSync notifyClientToClearTutorialStepsMethod sync for clearing steps (SyncA).
private readonly MethodSyncStruct<DespawnStepContentCommand> notifyClientToDespawnTutorialStruct method sync for despawning step content.
private readonly MethodSyncStruct<SpawnStepContentCommand> notifyClientToSpawnAdditionalTutorialContentStructStruct method sync for spawning additional static content.
private readonly MethodSyncStruct<SpawnStepContentCommand> notifyClientToSpawnTutorialStructStruct method sync for spawning static step content.
private readonly MethodSync notifyServerClientLoadTutorialCompleteMethod sync the client uses to tell the server it has loaded (PlayerMessage).

Events​

MemberWhat it is
event Action<IPlayer> ClientLoadCompletedServer: raised when a client reports it has spawned the step content.
event Action<int> ServerClearedTutorialStepsClient: raised with the player ID when the server says to clear tutorial steps.
event Action<int, MicroTutorialStep> ServerDespawnedTutorialStepContentClient: raised with the player ID and step when the server despawns a step's content.
event Action<int, MicroTutorialStep> ServerSpawnedAdditionalStepContentClient: raised with the player ID and step when the server asks for additional content.
event Action<int, MicroTutorialStep, Transform> ServerSpawnedStepClient: raised with the player ID, step and parent transform when the server spawns a step.

Methods​

MemberWhat it is
void NotifyClientToClearTutorialSteps(IPlayer player)Server: tells the player to clear their runtime tutorial steps.
void NotifyClientToDespawnStep(IPlayer player, DespawnStepContentCommand content)Server: tells the player to despawn a step's content.
void NotifyClientToSpawnAdditionalStepContent(IPlayer player, SpawnStepContentCommand content)Server: tells the player to spawn a step's additional static content.
void NotifyClientToSpawnStep(IPlayer player, SpawnStepContentCommand content)Server: tells the player to spawn a step's static content under the tutorial entity.
5 private and internal methods
MemberWhat it is
private void SyncClientLoadTutorialComplete(IPlayer player, Stream stream)Server, when reading: raises ClientLoadCompleted for the sender (the current player in local test).
private void SyncNotifyClientToClearRuntimeSteps(IPlayer player, Stream stream)Sync body for the clear message; raises ServerClearedTutorialSteps on the client.
private void SyncNotifyPlayerToDespawnTutorial(IPlayer player, Stream stream, DespawnStepContentCommand content)Sync body for the despawn message; raises ServerDespawnedTutorialStepContent on the client.
private void SyncNotifyPlayerToSpawnAdditionalTutorialContent(IPlayer player, Stream stream, SpawnStepContentCommand content)Sync body for the additional content message; raises ServerSpawnedAdditionalStepContent on the client.
private void SyncNotifyPlayerToSpawnTutorial(IPlayer player, Stream stream, SpawnStepContentCommand content)Sync body for the spawn message; the client raises ServerSpawnedStep and then sends the load-complete message back.