Skip to main content

PlayerEventBuffer

A class in Root.Township, ATT.MicroTutorial.

Server: records the tutorial player's events for each step so a step can see events that happened before it started. Created by ServerStepInstance.

Constructors​

MemberWhat it is
PlayerEventBuffer(IServerStepInstance step, IEventBus eventBus)Creates a PlayerEventBuffer from step and eventBus.

Fields​

4 private and internal fields
MemberWhat it is
private readonly List<IPlayerEvent>[] eventBufferOne list of buffered events per tutorial step.
private readonly IEventBus eventBusEvent bus the buffer listens on.
private Action<IPlayerEvent> passthroughHandlerHandler set by SwitchToPassthrough. When set, events skip the buffer.
private readonly IServerStepInstance stepThe server step instance this buffer belongs to.

Methods​

MemberWhat it is
IEnumerable<IPlayerEvent> SwitchToPassthrough(Action<IPlayerEvent> passthroughHandler)Sends future events straight to the handler and returns buffered events from the current step back PlayerEventSearchDepth steps (all steps if negative).
2 private and internal methods
MemberWhat it is
private void OnPlayerEvent(IPlayerEvent playerEvent)Handles an event from the tutorial's player: passes it through if a handler is set, otherwise buffers it under the current step.
private void OnStepCompleted(IServerStepInstance _)Stops listening for the step's required event types once the step completes.

Used in​

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