Class Vote
- Namespace
- Unity.Multiplayer.Core
A running vote on the server, as its Passed effect and Current see it. The roster when it started (less anyone the kind leaves out) is its voter list; it passes once Yes reaches Quorum and is rejected as soon as it no longer can. Players are identified by their network client id. Only the VoteBox changes it.
public sealed class Vote
- Inheritance
-
Vote
- Inherited Members
Properties
CannotPass
True once Yes can no longer reach the quorum, even if every undecided voter says Yes.
public bool CannotPass { get; }
Property Value
Description
The optional second line; empty when there is none.
public string Description { get; }
Property Value
HasPassed
True once Yes has reached the quorum.
public bool HasPassed { get; }
Property Value
Kind
What is being voted on.
public VoteKind Kind { get; }
Property Value
No
The voters who said No.
public IReadOnlyList<ulong> No { get; }
Property Value
Number
The request's number payload.
public long Number { get; }
Property Value
Quorum
Yes votes needed to pass, recomputed whenever a voter leaves.
public int Quorum { get; }
Property Value
QuorumFraction
The fraction Quorum is taken of.
public double QuorumFraction { get; }
Property Value
Request
The request as the starter sent it.
public VoteRequest Request { get; }
Property Value
Sequence
1 for the box's first vote, counting up.
public int Sequence { get; }
Property Value
StartedAtTick
The clock tick it started on.
public long StartedAtTick { get; }
Property Value
StartedBy
Client id of the player who started it.
public ulong StartedBy { get; }
Property Value
Text
The request's text payload (never null).
public string Text { get; }
Property Value
TimeoutTicks
How many ticks it runs before it lapses.
public long TimeoutTicks { get; }
Property Value
Title
The question, worded when it started.
public string Title { get; }
Property Value
Undecided
Voters who have voted neither way.
public int Undecided { get; }
Property Value
Voters
Who may vote: the roster at the start, less the kind's exclusions and anyone who has left since.
public IReadOnlyList<ulong> Voters { get; }
Property Value
Yes
The voters who said Yes.
public IReadOnlyList<ulong> Yes { get; }
Property Value
Methods
ChoiceOf(ulong)
Where player stands on it.
public VoteChoice ChoiceOf(ulong player)
Parameters
playerulong
Returns
IsExpired(long)
True once its time has run out at nowTick.
public bool IsExpired(long nowTick)
Parameters
nowTicklong
Returns
ResultOf(VoteEnding)
How it ended, for every peer.
public VoteResult ResultOf(VoteEnding ending)
Parameters
endingVoteEnding
Returns
SecondsLeft(long, int)
Whole seconds until it lapses at nowTick, rounded up (a countdown that shows 15 at the start and 0 once over).
public int SecondsLeft(long nowTick, int tickRate)
Parameters
Returns
StatusAt(long, int)
What every peer is told about it at nowTick.
public VoteStatus StatusAt(long nowTick, int tickRate)
Parameters
Returns
TicksLeft(long)
Ticks until it lapses at nowTick; 0 once it has.
public long TicksLeft(long nowTick)
Parameters
nowTicklong
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.