Class EventInfo
- Namespace
- ONITwitchLib
- Assembly
- ONITwitchLib.dll
Represents an event that is known to the EventManager.
[PublicAPI]
public class EventInfo
- Inheritance
-
EventInfo
- Inherited Members
Properties
Danger
[PublicAPI]
[CanBeNull]
public Danger? Danger { get; set; }
Property Value
EventId
The ID of the EventInfo, without the EventNamespace.
[PublicAPI]
[Pure]
[NotNull]
public string EventId { get; }
Property Value
EventNamespace
The namespace of the EventInfo.
[PublicAPI]
[Pure]
[NotNull]
public string EventNamespace { get; }
Property Value
FriendlyName
The friendly name of the EventInfo.
[PublicAPI]
[CanBeNull]
public string FriendlyName { get; set; }
Property Value
Group
The EventGroup of the EventInfo.
[PublicAPI]
[NotNull]
public EventGroup Group { get; }
Property Value
Id
The full namespaced ID of the EventInfo.
[PublicAPI]
[Pure]
[NotNull]
public string Id { get; }
Property Value
Methods
AddCondition(Func<object, bool>)
Adds a condition to the event that should be run to determine if the event should run.
[PublicAPI]
public void AddCondition(Func<object, bool> condition)
Parameters
condition
Func<object, bool>A function that takes an object parameter to be called with the event's data, and returns true if the event should be run and false if it should not.
- See Also
AddListener(Action<object>)
Adds an Action<T> that is invoked with the event's data when the event is triggered.
[PublicAPI]
public void AddListener(Action<object> listener)
Parameters
- See Also
CheckCondition(object)
Checks whether an event should be run by invoking each of its conditions and returning false if any of the conditions return false.
[PublicAPI]
public bool CheckCondition(object data)
Parameters
data
objectThe data to be passed to each condition.
Returns
- See Also
RemoveListener(Action<object>)
Removes an Action<T> from the list of actions that are run when an event is triggered, if it exists.
[PublicAPI]
public void RemoveListener(Action<object> listener)
Parameters
- See Also
ToString()
Gets a string representation of the event.
public override string ToString()
Returns
- string
The friendly name of the event, if it exists, or the ID of the event otherwise.
- See Also
Trigger(object)
Triggers the event with the specified data by calling each registered listener. Callers are expected to provide the correct type and values of data for this EventInfo. The correct data can typically be found in the DataManager.
[PublicAPI]
public void Trigger(object data)
Parameters
data
objectThe data to call each listener with.
- See Also