EventReceiver Class
Namespace: Stride.Engine.EventsAssembly: Stride.Engine.dll
Creates an event receiver that is used to receive events from an EventKey
public sealed class EventReceiver : EventReceiverBase<bool>, IDisposable
Name | Description | |
---|---|---|
Constructors | ||
EventReceiver(EventKey, EventReceiverOptions) | Initializes a new instance of the EventReceiver class. Creates an event receiver, ready to receive broadcasts from the key. |
|
Methods | ||
ReceiveAsync() | Awaits a single event |
|
ReceiveOne(EventReceiverBase[]) | Combines multiple receivers in one call and tries to receive the first available events among all the passed receivers |
|
TryReceive() | Receives one event from the buffer, useful specially in Sync scripts |
|
TryReceiveAll() | Receives all the events from the queue (if buffered was true during creations), useful mostly only in Sync scripts |
Constructors
EventReceiver(EventKey, EventReceiverOptions)
Initializes a new instance of the EventReceiver class. Creates an event receiver, ready to receive broadcasts from the key.
public EventReceiver(EventKey key, EventReceiverOptions options = EventReceiverOptions.None)
Parameters
Type | Name | Description |
---|---|---|
EventKey | key | The event key to listen from |
EventReceiverOptions | options | Option flags |
Methods
ReceiveAsync()
Awaits a single event
public async Task ReceiveAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ReceiveOne(EventReceiverBase[])
Combines multiple receivers in one call and tries to receive the first available events among all the passed receivers
public static async Task<EventData> ReceiveOne(params EventReceiverBase[] events)
Parameters
Type | Name | Description |
---|---|---|
EventReceiverBase[] | events | The events you want to listen to |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<EventData> |
TryReceive()
Receives one event from the buffer, useful specially in Sync scripts
public bool TryReceive()
Returns
Type | Description |
---|---|
System.Boolean |
TryReceiveAll()
Receives all the events from the queue (if buffered was true during creations), useful mostly only in Sync scripts
public int TryReceiveAll()
Returns
Type | Description |
---|---|
System.Int32 |