Show / Hide Table of Contents

Class Election

Inheritance
System.Object
SimpleEntry
SimpleProposable
Election
Implements
ILinkableParameterized<SimpleEntry.NamingOptions>
ICachesValidity
IDescribable
IRPCAuthChecks
IProposable
IHasID
IReInitializable
IHasReferenceableSerializableID
IHostedObject
INamed
IHasTeleportOption
IHasSerializableID
ILinkableParameterized<System.Boolean>
ILinkable
ICustomValidity
IValidity
ISuffixName
ISingleEditingUser
IPlayerUseTracking
IThreadSafeSubscriptions
ISubscriptions<ThreadSafeSubscriptions>
ISubscriptions
ISettlementAssociated
IController
IViewController
IHasUniversalID
System.ComponentModel.INotifyPropertyChanged
Inherited Members
SimpleProposable.requiresHost
SimpleProposable.SetRequiresHost(Boolean)
SimpleProposable.Valid()
SimpleProposable.DisableHostedObject()
SimpleProposable.AssignHostObject(WorldObject)
SimpleProposable.CanBeAssignedTo(IOrphanAssignment)
SimpleProposable.OnBeforeStateChangeInternal(ProposableState, CivicsUtils.StateChangeDetailFlags)
SimpleProposable.OnStateChangedInternal(ProposableState, CivicsUtils.StateChangeDetailFlags)
SimpleProposable.InitializeDraftProposable()
SimpleProposable.GetPairsOfOldAndNewRevisions(IProposable)
SimpleProposable.ApplyUpdatedProposable(IProposable)
SimpleProposable.OnCreate()
SimpleProposable.Destroyed()
SimpleProposable.SetState(ProposableState)
SimpleProposable.UsingPlayers
SimpleProposable.State
SimpleProposable.HostID
SimpleProposable.HostObject
SimpleProposable.TargetToReplace
SimpleProposable.ScanPeriodically
SimpleProposable.LastValidTime
SimpleProposable.Submitted
SimpleProposable.RevisionParent
SimpleProposable.Election
SimpleProposable.RemovedBy
SimpleProposable.RemovalElection
SimpleProposable.Settlement
SimpleProposable.CurrentEditingUser
SimpleProposable.DescribedWithTable
SimpleProposable.RequiresSlot
SimpleProposable.IsActive
SimpleProposable.WasRemoved
SimpleProposable.IHostedObject.HostingSettlement
SimpleProposable.IHostedObject.CanBeEdited
SimpleProposable.IHostedObject.ExpirationWarningsIssued
SimpleEntry.PostLoad()
SimpleEntry.CreatorText(Player)
SimpleEntry.ToString()
SimpleEntry.SaveInRegistrar()
SimpleEntry.UILinkContent()
SimpleEntry.UILinkContent(Boolean)
SimpleEntry.UILinkContent(SimpleEntry.NamingOptions)
SimpleEntry.ReInitialize()
SimpleEntry.MarkDirty()
SimpleEntry.UserDescription
SimpleEntry.Name
SimpleEntry.Creator
SimpleEntry.NameSuffix
SimpleEntry.CreationTime
SimpleEntry.CachedValidity
SimpleEntry.IsDestroyed
SimpleEntry.OnValidityChanged
SimpleEntry.Initialized
SimpleEntry.MarkedUpName
SimpleEntry.Id
SimpleEntry.IconName
SimpleEntry.Registrar
SimpleEntry.WorldTimeSinceCreation
SimpleEntry.CanBeDeleted
SimpleEntry.TextName
SimpleEntry.Scannable
SimpleEntry.Style
SimpleEntry.ControllerID
SimpleEntry.TrueResult
SimpleEntry.Subscriptions
SimpleEntry.PropertyChanged
Namespace: Eco.Gameplay.Civics.Elections
Assembly: Eco.Gameplay.dll
Syntax
public sealed class Election : SimpleProposable, ILinkableParameterized<SimpleEntry.NamingOptions>, ICachesValidity, IDescribable, IRPCAuthChecks, IProposable, IHasID, IReInitializable, IHasReferenceableSerializableID, IHostedObject, INamed, IHasTeleportOption, IHasSerializableID, ILinkableParameterized<bool>, ILinkable, ICustomValidity, IValidity, ISuffixName, ISingleEditingUser, IPlayerUseTracking, IThreadSafeSubscriptions, ISubscriptions<ThreadSafeSubscriptions>, ISubscriptions, ISettlementAssociated, IController, IViewController, IHasUniversalID, INotifyPropertyChanged

Constructors

Election()

Declaration
public Election()

Fields

ElectionChoicesChangedEvent

Executed whenever an election's choice options change.

Declaration
public static ThreadSafeAction<Election> ElectionChoicesChangedEvent
Field Value
Type Description
ThreadSafeAction<Election>

ElectionFinishedEvent

Executed whenever an election completes.

Declaration
public static ThreadSafeAction<Election> ElectionFinishedEvent
Field Value
Type Description
ThreadSafeAction<Election>

ElectionProvisionsChanged

Executed whenever an election's provisions change.

Declaration
public static ThreadSafeAction<Election> ElectionProvisionsChanged
Field Value
Type Description
ThreadSafeAction<Election>

ProvisionsChanged

Declaration
public ThreadSafeAction ProvisionsChanged
Field Value
Type Description
ThreadSafeAction

TwitchVotedEvent

Executed when a Twitch user voted on any election.

Declaration
public static ThreadSafeAction<TwitchVote> TwitchVotedEvent
Field Value
Type Description
ThreadSafeAction<TwitchVote>

UserVotedEvent

Executed when somebody voted in any election.

Declaration
public static ThreadSafeAction<UserRunoffVote> UserVotedEvent
Field Value
Type Description
ThreadSafeAction<UserRunoffVote>

Properties

ActionsOnComplete

The actions we run when the election succeeds. We dont scan the contents because CanStartForActions is called when an election starts, and that does a full consideration of what states should be allowed, ensures that referenced drafts are also in the election, etc. (we could move that to be a Valid check in the election and then allow it to be scanned normally, but we'll leave that for now)

Declaration
public ControllerList<CivicAction> ActionsOnComplete { get; }
Property Value
Type Description
ControllerList<CivicAction>

AllowEarlyEndWithEnoughVotes

Declaration
public bool AllowEarlyEndWithEnoughVotes { get; set; }
Property Value
Type Description
System.Boolean

BooleanElection

Declaration
public bool BooleanElection { get; }
Property Value
Type Description
System.Boolean

BooleanElectionNoMarkedUpName

Declaration
public string BooleanElectionNoMarkedUpName { get; }
Property Value
Type Description
System.String

BooleanElectionYesMarkedUpName

Declaration
public string BooleanElectionYesMarkedUpName { get; }
Property Value
Type Description
System.String

BriefStatus

Declaration
public LocString BriefStatus { get; }
Property Value
Type Description
LocString

Choices

Declaration
public ControllerList<ElectionChoice> Choices { get; set; }
Property Value
Type Description
ControllerList<ElectionChoice>

Comments

Declaration
public ThreadSafeList<ElectionComment> Comments { get; set; }
Property Value
Type Description
ThreadSafeList<ElectionComment>

CurrentResults

Declaration
public ElectionResult CurrentResults { get; }
Property Value
Type Description
ElectionResult

CurrentSimpleResults

Declaration
public IEnumerable<SimpleResult> CurrentSimpleResults { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<SimpleResult>

DebugElection

Declaration
public bool DebugElection { get; set; }
Property Value
Type Description
System.Boolean

Elapsed

Declaration
public double Elapsed { get; }
Property Value
Type Description
System.Double

ElectionStartedEvent

Executed whenever voting for an election starts.

Declaration
public static ThreadSafeAction<Election> ElectionStartedEvent { get; }
Property Value
Type Description
ThreadSafeAction<Election>

EndDateTime

Represents the election ending timestamp as System.DateTime

Declaration
public DateTime EndDateTime { get; }
Property Value
Type Description
System.DateTime

Finished

Declaration
public bool Finished { get; }
Property Value
Type Description
System.Boolean

MaxEndTime

Declaration
public double MaxEndTime { get; }
Property Value
Type Description
System.Double

OnComplete

Declaration
public HandleEvent OnComplete { get; }
Property Value
Type Description
HandleEvent

PollElection

Declaration
public bool PollElection { get; }
Property Value
Type Description
System.Boolean

PositionForWinner

Declaration
public ElectedTitle PositionForWinner { get; set; }
Property Value
Type Description
ElectedTitle

PossibleWinners

Declaration
public int PossibleWinners { get; }
Property Value
Type Description
System.Int32

Process

Declaration
public ElectionProcess Process { get; set; }
Property Value
Type Description
ElectionProcess

ProposablesInElection

Declaration
public IEnumerable<IProposable> ProposablesInElection { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<IProposable>

RawTwitchVotes

Declaration
public ThreadSafeDictionary<string, TwitchVote> RawTwitchVotes { get; set; }
Property Value
Type Description
ThreadSafeDictionary<System.String, TwitchVote>

RequiresHost

Declaration
public override bool RequiresHost { get; }
Property Value
Type Description
System.Boolean
Overrides
SimpleProposable.RequiresHost

SimpleResults

Declaration
public IEnumerable<SimpleResult> SimpleResults { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<SimpleResult>

TimeEnded

Declaration
public double TimeEnded { get; set; }
Property Value
Type Description
System.Double

TimeLeft

Declaration
public double TimeLeft { get; }
Property Value
Type Description
System.Double

TimeStarted

Declaration
public double TimeStarted { get; set; }
Property Value
Type Description
System.Double

TotalVotes

Declaration
public int TotalVotes { get; }
Property Value
Type Description
System.Int32

UserVotes

Declaration
public ThreadSafeDictionary<User, UserRunoffVote> UserVotes { get; set; }
Property Value
Type Description
ThreadSafeDictionary<User, UserRunoffVote>

Methods

AddChoice(ElectionChoice)

Declaration
public void AddChoice(ElectionChoice candidateChoice)
Parameters
Type Name Description
ElectionChoice candidateChoice

AttachCivicAction(CivicAction)

Declaration
public void AttachCivicAction(CivicAction actionPerformed)
Parameters
Type Name Description
CivicAction actionPerformed

CancelDraftElection(Player)

Declaration
public void CancelDraftElection(Player player)
Parameters
Type Name Description
Player player

CanJoinElection(User)

Declaration
public Result CanJoinElection(User user)
Parameters
Type Name Description
User user
Returns
Type Description
Result

CanVote(User)

Check the various things that determine if a user can vote or not.

Declaration
public Result CanVote(User user)
Parameters
Type Name Description
User user
Returns
Type Description
Result

CheckFinishedAndProcess(Boolean)

Declaration
public void CheckFinishedAndProcess(bool forceUpdate = false)
Parameters
Type Name Description
System.Boolean forceUpdate

Contains(User)

Declaration
public bool Contains(User user)
Parameters
Type Name Description
User user
Returns
Type Description
System.Boolean

DebugForceFinish()

Declaration
public void DebugForceFinish()

Description()

Declaration
public override LocString Description()
Returns
Type Description
LocString
Overrides
SimpleEntry.Description()

Enter()

Declaration
public void Enter()

ForceUpdate()

Declaration
public void ForceUpdate()

FullDescribe()

Declaration
public LocString FullDescribe()
Returns
Type Description
LocString

GetChoiceById(ElectionChoiceID)

Declaration
public ElectionChoice GetChoiceById(ElectionChoiceID id)
Parameters
Type Name Description
ElectionChoiceID id
Returns
Type Description
ElectionChoice

GetChoiceByName(String)

Declaration
public ElectionChoice GetChoiceByName(string name)
Parameters
Type Name Description
System.String name
Returns
Type Description
ElectionChoice

GetChoiceByUser(User)

Declaration
public ElectionChoice GetChoiceByUser(User user)
Parameters
Type Name Description
User user
Returns
Type Description
ElectionChoice

GetChoiceName(ElectionChoiceID)

Declaration
public LocString GetChoiceName(ElectionChoiceID id)
Parameters
Type Name Description
ElectionChoiceID id
Returns
Type Description
LocString

GetChoiceUser(ElectionChoiceID)

Declaration
public User GetChoiceUser(ElectionChoiceID id)
Parameters
Type Name Description
ElectionChoiceID id
Returns
Type Description
User

GetCurrentResults()

Generates the current results if theyre not set.

Declaration
public ElectionResult GetCurrentResults()
Returns
Type Description
ElectionResult

GetFinishedResult()

Return the finished results, or null if theyre not done.

Declaration
public ElectionResult GetFinishedResult()
Returns
Type Description
ElectionResult

GetSpeech(ElectionChoiceID)

Declaration
public string GetSpeech(ElectionChoiceID id)
Parameters
Type Name Description
ElectionChoiceID id
Returns
Type Description
System.String

HasProvisionFor(IProposable)

Declaration
public bool HasProvisionFor(IProposable element)
Parameters
Type Name Description
IProposable element
Returns
Type Description
System.Boolean

Initialize()

Declaration
public override void Initialize()
Overrides
SimpleProposable.Initialize()

OnLinkClicked(TooltipOrigin, TooltipClickContext, User)

Declaration
public override void OnLinkClicked(TooltipOrigin origin, TooltipClickContext clickContext, User user)
Parameters
Type Name Description
TooltipOrigin origin
TooltipClickContext clickContext
User user
Overrides
SimpleProposable.OnLinkClicked(TooltipOrigin, TooltipClickContext, User)

OnPostLoad()

Declaration
public void OnPostLoad()

RemoveProvisionsWhere(Predicate<CivicAction>)

Declaration
public void RemoveProvisionsWhere(Predicate<CivicAction> predicate)
Parameters
Type Name Description
System.Predicate<CivicAction> predicate

ShowAllVotes(Player)

Display a large text of all the votes.

Declaration
[RPCAuthMaxProposableState]
public void ShowAllVotes(Player player)
Parameters
Type Name Description
Player player

Start(Player)

Declaration
public Election Start(Player player)
Parameters
Type Name Description
Player player
Returns
Type Description
Election

Start(User, Boolean, Boolean)

Declaration
public Election Start(User user, bool notify = true, bool force = false)
Parameters
Type Name Description
User user
System.Boolean notify
System.Boolean force
Returns
Type Description
Election

TwitchVote(String, String, TwitchVote)

Cast a vote from a twitch user.

Declaration
public Result TwitchVote(string twitchID, string twitchUserName, TwitchVote vote)
Parameters
Type Name Description
System.String twitchID
System.String twitchUserName
TwitchVote vote
Returns
Type Description
Result

Veto(User)

Declaration
public void Veto(User user)
Parameters
Type Name Description
User user

Vote(UserRunoffVote)

Declaration
public Result Vote(UserRunoffVote vote)
Parameters
Type Name Description
UserRunoffVote vote
Returns
Type Description
Result

Voted(User)

Declaration
public bool Voted(User user)
Parameters
Type Name Description
User user
Returns
Type Description
System.Boolean

Withdraw(User)

Declaration
public void Withdraw(User user)
Parameters
Type Name Description
User user

Explicit Interface Implementations

IProposable.RequiresCivicActionToActivate

Declaration
bool IProposable.RequiresCivicActionToActivate { get; }
Returns
Type Description
System.Boolean

Implements

ILinkableParameterized<T>
ICachesValidity
IDescribable
IRPCAuthChecks
IProposable
IHasID
IReInitializable
IHasReferenceableSerializableID
IHostedObject
INamed
IHasTeleportOption
IHasSerializableID
ILinkableParameterized<T>
ILinkable
ICustomValidity
IValidity
ISuffixName
ISingleEditingUser
IPlayerUseTracking
IThreadSafeSubscriptions
ISubscriptions<TSubscriptionsList>
ISubscriptions
ISettlementAssociated
IController
IViewController
IHasUniversalID
System.ComponentModel.INotifyPropertyChanged

Extension Methods

CivicsExtensions.IsBrowserVisible(Election)
TagUtils.TagNames(Object, Boolean)
TagUtils.TagDisplayNames(Object, Boolean)
ClientSetViewExtensions.SetClassOfProperty(Object, Player, String, String, Int32)
ElectionUtils.DoesElectionConcernsProposable(Election, IProposable)
ElectionUtils.AllProposables(Election)
ElectionUtils.ProposablesBecomingActive(Election)
ElectionUtils.ProposablesBeingReplaced(Election)
TypeTooltipExtensions.UILinkGeneric(Object)
CivicsTooltipLibrary.MainInformationTooltip(Election)
CivicsTooltipLibrary.ElectionCanVote(Election, User)
ILinkableTooltipLibrary.ElectionLinkClicked(Election)
ILinkableTooltipLibrary.SimpleProposableLinkClicked(SimpleProposable)
MiscTooltipLibrary.SimpleEntryTooltip(SimpleEntry, User)
MiscTooltipLibrary.SimpleEntryTitle(SimpleEntry)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾