Class EventGroup
- Namespace
- ONITwitchLib
- Assembly
- ONITwitchLib.dll
A group of associated EventInfos with relative weights. EventInfos in an EventGroup will attempt to be spread out for variety.
[PublicAPI]
public class EventGroup
- Inheritance
-
EventGroup
- Inherited Members
Properties
Name
The name of the group.
[PublicAPI]
[NotNull]
public string Name { get; }
Property Value
TotalWeight
The total weight of the group.
[PublicAPI]
public int TotalWeight { get; }
Property Value
Methods
AddEvent(string, int, string)
Creates a new EventInfo in this EventGroup.
[PublicAPI]
[NotNull]
public EventInfo AddEvent(string id, int weight, string friendlyName = null)
Parameters
id
stringThe id of the EventInfo to create.
weight
intThe weight of the EventInfo to create.
friendlyName
stringThe friendly name of the EventInfo to create.
Returns
DefaultSingleEventGroup(string, int, string)
Creates an EventInfo with a unique EventGroup that has a default name and no other EventInfos.
[PublicAPI]
[MustUseReturnValue("The group should be added to the TwitchDeckManager to be used")]
public static (EventInfo EventInfo, EventGroup Group) DefaultSingleEventGroup(string id, int weight, string friendlyName = null)
Parameters
id
stringThe id of the EventInfo to create.
weight
intThe weight of the EventInfo to create.
friendlyName
stringThe friendly name of the EventInfo to create.
Returns
- (EventInfo EventInfo, EventGroup Group)
The newly created EventInfo and its unique EventGroup.
GetOrCreateGroup(string)
Gets an existing EventGroup with a specified name, or creates it if it does not exist.
[PublicAPI]
[Pure]
[NotNull]
public static EventGroup GetOrCreateGroup(string name)
Parameters
name
stringThe name of the EventGroup to get or create.
Returns
- EventGroup
The group that was found or created.
GetWeights()
Gets a the weight of each EventInfo in the group.
[PublicAPI]
[Pure]
[NotNull]
public IReadOnlyDictionary<EventInfo, int> GetWeights()
Returns
- IReadOnlyDictionary<EventInfo, int>
A read-only dictionary of each EventInfo and its corresponding weight.
RemoveEvent(EventInfo)
Removes the specified EventInfo from the group.
[PublicAPI]
public void RemoveEvent(EventInfo item)
Parameters
SetWeight(EventInfo, int)
Sets the weight of a specified EventInfo in the group.
[PublicAPI]
public void SetWeight(EventInfo eventInfo, int weight)
Parameters
Exceptions
- ArgumentOutOfRangeException
weight
is less than 0.
ToString()
Displays a string representation of a group using its name.
public override string ToString()
Returns
- string
A string representation of the object.
Events
OnGroupChanged
An event that fires when the group is changed, called with the group that changed.
[PublicAPI]
public event Action<EventGroup> OnGroupChanged