Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    EventReceiver Class

    Namespace: Stride.Engine.Events
    Assembly: Stride.Engine.dll

    Creates an event receiver that is used to receive events from an EventKey

    System.Object → EventReceiverBase → EventReceiverBase<System.Boolean> → EventReceiver
    Derived from EventReceiver:

    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

    | Improve this Doc View Source

    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

    | Improve this Doc View Source

    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

    Inherited Members

    EventReceiverBase<Boolean>.Key
    EventReceiverBase<Boolean>.InternalReceiveAsync()
    EventReceiverBase<Boolean>.GetAwaiter()
    EventReceiverBase<Boolean>.Count
    EventReceiverBase<Boolean>.InternalTryReceive(Boolean)
    EventReceiverBase<Boolean>.InternalTryReceiveAll(ICollection<Boolean>)
    EventReceiverBase<Boolean>.Reset()
    EventReceiverBase<Boolean>.Dispose()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation