Class TwitchElectionUtil
Inheritance
System.Object
TwitchElectionUtil
Namespace: Eco.Gameplay.Civics.Elections.Internal
Assembly: Eco.Gameplay.dll
Syntax
public class TwitchElectionUtil : Object
Constructors
TwitchElectionUtil()
Declaration
public TwitchElectionUtil()
Methods
DescribeTwitchVotesInElection(IEnumerable<(String, TwitchVote)>, Func<ElectionChoiceID, LocString>, ElectionProcess)
Output several lines describing a bunch of twitch votes in an election.
Declaration
public static LocString DescribeTwitchVotesInElection(IEnumerable<(string, TwitchVote)> votes, Func<ElectionChoiceID, LocString> choiceToName, ElectionProcess process)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.ValueTuple<System.String, TwitchVote>> | votes | |
System.Func<ElectionChoiceID, LocString> | choiceToName | |
ElectionProcess | process |
Returns
Type | Description |
---|---|
LocString |
GetTwitchVotes(IDictionary<String, TwitchVote>, Election, out LocString)
Compile a dictionary of ElectionChoiceIDs to the numer of weighted votes it has, using the TwitchVote data, and output a string to describe the result.
Declaration
public static Dictionary<ElectionChoiceID, float> GetTwitchVotes(IDictionary<string, TwitchVote> votesByName, Election election, out LocString reductionResult)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, TwitchVote> | votesByName | |
Election | election | Election to retrieve details from. |
LocString | reductionResult |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<ElectionChoiceID, System.Single> |
GetTwitchVotes(IDictionary<String, TwitchVote>, Single, ElectionProcess, Int32, out LocString)
Compile a dictionary of ElectionChoiceIDs to the numer of weighted votes it has, using the TwitchVote data, and output a string to describe the result.
Declaration
public static Dictionary<ElectionChoiceID, float> GetTwitchVotes(IDictionary<string, TwitchVote> votesByName, float maxPercentTwitchVotes, ElectionProcess process, int userVotes, out LocString reductionResult)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, TwitchVote> | votesByName | |
System.Single | maxPercentTwitchVotes | Cap the twitch votes to this percent of the total votes in the election. |
ElectionProcess | process | |
System.Int32 | userVotes | count of user votes |
LocString | reductionResult |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<ElectionChoiceID, System.Single> |
NotifyTwitchVoterVoted(String, TwitchVote, Election, Settlement, Func<ElectionChoiceID, LocString>)
Do the notification when a twich user votes.
Declaration
public static void NotifyTwitchVoterVoted(string twitchUserName, TwitchVote vote, Election election, Settlement settlement, Func<ElectionChoiceID, LocString> choiceToName)
Parameters
Type | Name | Description |
---|---|---|
System.String | twitchUserName | |
TwitchVote | vote | |
Election | election | |
Settlement | settlement | |
System.Func<ElectionChoiceID, LocString> | choiceToName |