Events are a fire-and-forget mechanism to transfer information from the simulation to the view. Use this class to subscribe and unsubscribe from Quantum events. More...
Additional Inherited Members | |
Static Public Member Functions inherited from Quantum.QuantumUnityStaticDispatcherAdapter< QuantumUnityEventDispatcher, EventBase > | |
static void | Clear () |
Removes all listeners and destroys the worker object. More... | |
static void | RemoveDeadListeners () |
Removes dead listeners from the dispatcher. More... | |
static DispatcherSubscription | Subscribe< TDispatchable > (Object listener, DispatchableHandler< TDispatchable > handler, DeterministicGameMode gameMode, bool exclude=false, bool once=false, bool onlyIfActiveAndEnabled=false, bool onlyIfEntityViewBound=false) |
Creates a subscription. The subscription lifetime is tied to the listener object, unless explicitly unsubscribed. More... | |
static DispatcherSubscription | Subscribe< TDispatchable > (Object listener, DispatchableHandler< TDispatchable > handler, DeterministicGameMode[] gameModes, bool exclude=false, bool once=false, bool onlyIfActiveAndEnabled=false, bool onlyIfEntityViewBound=false) |
Creates a subscription. The subscription lifetime is tied to the listener object, unless explicitly unsubscribed. More... | |
static DispatcherSubscription | Subscribe< TDispatchable > (Object listener, DispatchableHandler< TDispatchable > handler, DispatchableFilter filter=null, bool once=false, bool onlyIfActiveAndEnabled=false, bool onlyIfEntityViewBound=false) |
Creates a subscription. The subscription lifetime is tied to the listener object, unless explicitly unsubscribed. More... | |
static DispatcherSubscription | Subscribe< TDispatchable > (Object listener, DispatchableHandler< TDispatchable > handler, QuantumGame game, bool once=false, bool onlyIfActiveAndEnabled=false, bool onlyIfEntityViewBound=false) |
Creates a subscription. The subscription lifetime is tied to the listener object, unless explicitly unsubscribed. More... | |
static DispatcherSubscription | Subscribe< TDispatchable > (Object listener, DispatchableHandler< TDispatchable > handler, QuantumRunner runner, bool once=false, bool onlyIfActiveAndEnabled=false, bool onlyIfEntityViewBound=false) |
Creates a subscription. The subscription lifetime is tied to the listener object, unless explicitly unsubscribed. More... | |
static DispatcherSubscription | Subscribe< TDispatchable > (Object listener, DispatchableHandler< TDispatchable > handler, string runnerId, bool once=false, bool onlyIfActiveAndEnabled=false, bool onlyIfEntityViewBound=false) |
Creates a subscription. The subscription lifetime is tied to the listener object, unless explicitly unsubscribed. More... | |
static IDisposable | SubscribeManual< TDispatchable > (DispatchableHandler< TDispatchable > handler, DispatchableFilter filter=null, bool once=false) |
static IDisposable | SubscribeManual< TDispatchable > (DispatchableHandler< TDispatchable > handler, IDeterministicGame game, bool once=false) |
static IDisposable | SubscribeManual< TDispatchable > (object listener, DispatchableHandler< TDispatchable > handler, DispatchableFilter filter=null, bool once=false) |
static bool | Unsubscribe (DispatcherSubscription subscription) |
static bool | Unsubscribe (ref DispatcherSubscription subscription) |
static bool | UnsubscribeListener (object listener) |
static bool | UnsubscribeListener< TDispatchable > (object listener) |
Properties inherited from Quantum.QuantumUnityStaticDispatcherAdapter< QuantumUnityEventDispatcher, EventBase > | |
static TDispatcher | Dispatcher [get] |
The dispatcher instance. More... | |
Events are a fire-and-forget mechanism to transfer information from the simulation to the view. Use this class to subscribe and unsubscribe from Quantum events.
Events are mostly custom and code-generated by the Quantum DSL.
Events do not synchronize anything between clients and they are fired by each client's own simulation.
Since the same Frame can be simulated more than once (prediction, rollback), it is possible to have events being triggered multiple times. To avoid undesired duplicated Events Quantum identifies duplicates using a hash code function over the Event data members, the Event id and the tick.
Regular, non-synced, Events will be either cancelled or confirmed once the predicted Frame from which they were fired has been verified.
Events are dispatched after all Frames have been simulated right after the OnUpdateView callback. Events are called in the same order they were invoked with the exception of non-synced Events which can be skipped when identified as duplicated. Due to this timing, the targeted QuantumEntityView may already have been destroyed.