EventReceiver<T> Class
Namespace: Stride.Engine.EventsAssembly: Stride.Engine.dll
Creates an event receiver that is used to receive T type events from an EventKey
Derived from EventReceiver<T>:
public sealed class EventReceiver<T> : EventReceiverBase<T>, IDisposable
Type Parameters
| Name | Description |
|---|---|
| T | The type of data the EventKey will send |
| Name | Description | |
|---|---|---|
| Constructors | ||
| EventReceiver(EventKey<T>, EventReceiverOptions) | Creates an event receiver, ready to receive broadcasts from the key |
|
| Methods | ||
| ReceiveAsync() | Awaits a single event |
|
| TryReceive(out T) | Receives one event from the buffer, useful specially in Sync scripts |
|
| TryReceiveAll(ICollection<T>) | Receives all the events from the queue (if buffered was true during creations), useful mostly only in Sync scripts |
|
Constructors
EventReceiver(EventKey<T>, EventReceiverOptions)
Creates an event receiver, ready to receive broadcasts from the key
public EventReceiver(EventKey<T> key, EventReceiverOptions options = EventReceiverOptions.None)
Parameters
| Type | Name | Description |
|---|---|---|
| EventKey<T> | key | The event key to listen from |
| EventReceiverOptions | options | Option flags |
Methods
ReceiveAsync()
Awaits a single event
public Task<T> ReceiveAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<T> |
TryReceive(out T)
Receives one event from the buffer, useful specially in Sync scripts
public bool TryReceive(out T data)
Parameters
| Type | Name | Description |
|---|---|---|
| T | data |
Returns
| Type | Description |
|---|---|
| System.Boolean |
TryReceiveAll(ICollection<T>)
Receives all the events from the queue (if buffered was true during creations), useful mostly only in Sync scripts
public int TryReceiveAll(ICollection<T> collection)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.ICollection<T> | collection |
Returns
| Type | Description |
|---|---|
| System.Int32 |