Photon Quantum 3.0.0

Static Public Member Functions | Properties | List of all members
Quantum.QuantumUnityStaticDispatcherAdapter< TDispatcher, TDispatchableBase > Class Template Reference

Adapter for static dispatchers in Unity. Provides utility static methods, internal worker that removes dead listeners and means for creating a dispatcher. More...

Static Public Member Functions

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

static TDispatcher Dispatcher = new TDispatcher() [get]
 The dispatcher instance. More...
 

Detailed Description

Adapter for static dispatchers in Unity. Provides utility static methods, internal worker that removes dead listeners and means for creating a dispatcher.

Template Parameters
TDispatcher
TDispatchableBase
Type Constraints
TDispatcher :DispatcherBase 
TDispatcher :IQuantumUnityDispatcher 
TDispatcher :new() 
TDispatchableBase :IDispatchable 

Member Function Documentation

◆ Clear()

static void Quantum.QuantumUnityStaticDispatcherAdapter< TDispatcher, TDispatchableBase >.Clear ( )
inlinestatic

Removes all listeners and destroys the worker object.

◆ RemoveDeadListeners()

static void Quantum.QuantumUnityStaticDispatcherAdapter< TDispatcher, TDispatchableBase >.RemoveDeadListeners ( )
inlinestatic

Removes dead listeners from the dispatcher.

◆ Subscribe< TDispatchable >() [1/6]

static DispatcherSubscription Quantum.QuantumUnityStaticDispatcherAdapter< TDispatcher, TDispatchableBase >.Subscribe< TDispatchable > ( Object  listener,
DispatchableHandler< TDispatchable >  handler,
DispatchableFilter  filter = null,
bool  once = false,
bool  onlyIfActiveAndEnabled = false,
bool  onlyIfEntityViewBound = false 
)
inlinestatic

Creates a subscription. The subscription lifetime is tied to the listener object, unless explicitly unsubscribed.

Template Parameters
TDispatchable
Parameters
listenerAn object listening. Used to unsubscribe all subscriptions when the object is destroyed.
handlerActual event handler.
onceCall handler only once.
filterOptional event filter. If returns false, handler will not be invoked.
onlyIfActiveAndEnabledOnly invoke handler if the listener is active and enabled
onlyIfEntityViewBoundOnly invoke handler if the listener QuantumEntityView component and it is bound to an entity
Returns
Subscription that can be stored and used in Unsubscribe
Type Constraints
TDispatchable :TDispatchableBase 

◆ Subscribe< TDispatchable >() [2/6]

static DispatcherSubscription Quantum.QuantumUnityStaticDispatcherAdapter< TDispatcher, TDispatchableBase >.Subscribe< TDispatchable > ( Object  listener,
DispatchableHandler< TDispatchable >  handler,
DeterministicGameMode  gameMode,
bool  exclude = false,
bool  once = false,
bool  onlyIfActiveAndEnabled = false,
bool  onlyIfEntityViewBound = false 
)
inlinestatic

Creates a subscription. The subscription lifetime is tied to the listener object, unless explicitly unsubscribed.

Template Parameters
TDispatchable
Parameters
listenerAn object listening. Used to unsubscribe all subscriptions when the object is destroyed.
handlerActual event handler.
onceCall handler only once.
gameModeOnly invoke for a specific game mode
excludeIf true, the handler will be invoked for all game modes except the specified one
onlyIfActiveAndEnabledOnly invoke handler if the listener is active and enabled
onlyIfEntityViewBoundOnly invoke handler if the listener QuantumEntityView component and it is bound to an entity
Returns
Subscription that can be stored and used in Unsubscribe
Type Constraints
TDispatchable :TDispatchableBase 

◆ Subscribe< TDispatchable >() [3/6]

static DispatcherSubscription Quantum.QuantumUnityStaticDispatcherAdapter< TDispatcher, TDispatchableBase >.Subscribe< TDispatchable > ( Object  listener,
DispatchableHandler< TDispatchable >  handler,
DeterministicGameMode[]  gameModes,
bool  exclude = false,
bool  once = false,
bool  onlyIfActiveAndEnabled = false,
bool  onlyIfEntityViewBound = false 
)
inlinestatic

Creates a subscription. The subscription lifetime is tied to the listener object, unless explicitly unsubscribed.

Template Parameters
TDispatchable
Parameters
listenerAn object listening. Used to unsubscribe all subscriptions when the object is destroyed.
handlerActual event handler.
onceCall handler only once.
gameModesOnly invoke for specific game modes
excludeIf true, the handler will be invoked for all game modes except the specified ones
onlyIfActiveAndEnabledOnly invoke handler if the listener is active and enabled
onlyIfEntityViewBoundOnly invoke handler if the listener QuantumEntityView component and it is bound to an entity
Returns
Subscription that can be stored and used in Unsubscribe
Type Constraints
TDispatchable :TDispatchableBase 

◆ Subscribe< TDispatchable >() [4/6]

static DispatcherSubscription Quantum.QuantumUnityStaticDispatcherAdapter< TDispatcher, TDispatchableBase >.Subscribe< TDispatchable > ( Object  listener,
DispatchableHandler< TDispatchable >  handler,
string  runnerId,
bool  once = false,
bool  onlyIfActiveAndEnabled = false,
bool  onlyIfEntityViewBound = false 
)
inlinestatic

Creates a subscription. The subscription lifetime is tied to the listener object, unless explicitly unsubscribed.

Template Parameters
TDispatchable
Parameters
listenerAn object listening. Used to unsubscribe all subscriptions when the object is destroyed.
handlerActual event handler.
onceCall handler only once.
runnerIdOnly invoke for a QuantumRunner with a specific ID
onlyIfActiveAndEnabledOnly invoke handler if the listener is active and enabled
onlyIfEntityViewBoundOnly invoke handler if the listener QuantumEntityView component and it is bound to an entity
Returns
Subscription that can be stored and used in Unsubscribe
Type Constraints
TDispatchable :TDispatchableBase 

◆ Subscribe< TDispatchable >() [5/6]

static DispatcherSubscription Quantum.QuantumUnityStaticDispatcherAdapter< TDispatcher, TDispatchableBase >.Subscribe< TDispatchable > ( Object  listener,
DispatchableHandler< TDispatchable >  handler,
QuantumRunner  runner,
bool  once = false,
bool  onlyIfActiveAndEnabled = false,
bool  onlyIfEntityViewBound = false 
)
inlinestatic

Creates a subscription. The subscription lifetime is tied to the listener object, unless explicitly unsubscribed.

Template Parameters
TDispatchable
Parameters
listenerAn object listening. Used to unsubscribe all subscriptions when the object is destroyed.
handlerActual event handler.
onceCall handler only once.
runnerOnly invoke for a QuantumRunner instance
onlyIfActiveAndEnabledOnly invoke handler if the listener is active and enabled
onlyIfEntityViewBoundOnly invoke handler if the listener QuantumEntityView component and it is bound to an entity
Returns
Subscription that can be stored and used in Unsubscribe
Type Constraints
TDispatchable :TDispatchableBase 

◆ Subscribe< TDispatchable >() [6/6]

static DispatcherSubscription Quantum.QuantumUnityStaticDispatcherAdapter< TDispatcher, TDispatchableBase >.Subscribe< TDispatchable > ( Object  listener,
DispatchableHandler< TDispatchable >  handler,
QuantumGame  game,
bool  once = false,
bool  onlyIfActiveAndEnabled = false,
bool  onlyIfEntityViewBound = false 
)
inlinestatic

Creates a subscription. The subscription lifetime is tied to the listener object, unless explicitly unsubscribed.

Template Parameters
TDispatchable
Parameters
listenerAn object listening. Used to unsubscribe all subscriptions when the object is destroyed.
handlerActual event handler.
onceCall handler only once.
gameOnly invoke for a QuantumGame instance
onlyIfActiveAndEnabledOnly invoke handler if the listener is active and enabled
onlyIfEntityViewBoundOnly invoke handler if the listener QuantumEntityView component and it is bound to an entity
Returns
Subscription that can be stored and used in Unsubscribe
Type Constraints
TDispatchable :TDispatchableBase 

Property Documentation

◆ Dispatcher

TDispatcher Quantum.QuantumUnityStaticDispatcherAdapter< TDispatcher, TDispatchableBase >.Dispatcher = new TDispatcher()
staticget

The dispatcher instance.