Arma Reforger Script API
|
Base class for voting types. More...
Public Member Functions | |
bool | AddPlayerVotedServer (int playerID) |
A player has voted to approve (server only) | |
bool | RemovePlayerVotedServer (int playerID) |
A player has voted to remove or abstain (server only) | |
void | SetCurrentVoteCount (int currentVoteCount) |
Set the current amount of votes this vote has. | |
int | GetCurrentVoteCount () |
int | GetJoinServerVoteCooldown () |
int | GetServerRuntimeIgnoreJoinServerCooldown () |
int | GetVoteCooldownTime () |
bool | HasCooldown () |
float | GetLocalCooldownTimeStamp () |
void | SetLocalCooldownTimeStamp (float newTimeStamp) |
Set the time stamp for cooldowns for this voting param[in] New Time stamp to set. | |
bool | HasInitiatedVotingLocallyOnce () |
void | SetHasInitiatedVotingLocallyOnce () |
Set Has initiated voting locally at least once to true. | |
void | SetVote (int playerID, int value=DEFAULT_VALUE) |
Set vote of given player. | |
bool | RemoveVote (int playerID) |
Remove vote of given player. | |
bool | RemoveValue (int value) |
Remove all votes for given value. | |
bool | CanSendNotification (int value) |
Check if notification can be shown for this voting. | |
bool | Evaluate (out EVotingOutcome outcome) |
Evaluate if the voting can end. | |
int | GetWinner () |
Get winner of the vote. | |
void | OnVotingEnd (int value=DEFAULT_VALUE, int winner=DEFAULT_VALUE) |
Event called when the voting ends. | |
int | GetPlayerVote (int playerID) |
bool | IsAvailable (int value, bool isOngoing) |
Check if the voting is available in the current world. | |
bool | IsMatching (EVotingType type, int value=DEFAULT_VALUE) |
Check if the voting is matching given params. | |
void | Log () |
string | GetValueName (int value) |
Get name of the value. | |
EVotingType | GetType () |
Get voting type. | |
EVotingType | GetValue () |
Get voting value. | |
SCR_VotingUIInfo | GetInfo () |
Get voting UI representation. | |
float | GetRemainingDuration () |
bool | IsValuePlayerID () |
Check if the voting is about player IDs. | |
void | SetVoteLocal (int value) |
Save local vote. | |
void | RemoveVoteLocal () |
Remove local vote. | |
int | GetLocalVote () |
Get local vote. | |
void | Update (float timeSlice) |
Periodically update the voting. | |
void | InitFromTemplate (SCR_VotingBase template, int value, float remainingDuration) |
Initialise voting from given template. | |
int | GetPlayerCount () |
Get total player count of players that are valid to vote for the issue. | |
int | GetVoteCountRequired () |
Get total players needed to make sure the vote is successfull. | |
Static Public Attributes | |
static const int | DEFAULT_VALUE = -1 |
Protected Member Functions | |
bool | EvaluateParticipation (int voteCount) |
Protected Attributes | |
EVotingType | m_Type |
bool | m_bIsValuePlayerID |
float | m_fDuration |
float | m_fThreshold |
float | m_iMinParticipation |
int | m_iMinVotes |
ref SCR_VotingUIInfo | m_Info |
int | m_iJoinServerVoteCooldown |
int | m_iServerRuntimeIgnoreJoinServerCooldown |
int | m_iVoteCooldownTime |
float | m_fVoteCooldownTimeStamp = -1 |
bool | m_bHasInitiatedVotingLocallyOnce |
int | m_iLocalValue = DEFAULT_VALUE |
int | m_iCurrentVoteCount |
ref array< int > | m_aPlayersVoted_Server = {} |
Base class for voting types.
Do not expose objects of this class outside of SCR_VotingManagerComponent! Other systems should always go through the manager.
bool SCR_VotingBase.AddPlayerVotedServer | ( | int | playerID | ) |
A player has voted to approve (server only)
[in] | playerID | Id of player who voted |
bool SCR_VotingBase.CanSendNotification | ( | int | value | ) |
Check if notification can be shown for this voting.
[in] | value | Voting value |
Implemented in SCR_VotingEditorIn, and SCR_VotingEditorOut.
bool SCR_VotingBase.Evaluate | ( | out EVotingOutcome | outcome | ) |
Evaluate if the voting can end.
[out] | outcome | Outcome of the vote (used only when returned value is true) |
Implemented in SCR_VotingReferendum, SCR_VotingElection, SCR_VotingEditorIn, and SCR_VotingEditorWithdraw.
|
protected |
int SCR_VotingBase.GetCurrentVoteCount | ( | ) |
SCR_VotingUIInfo SCR_VotingBase.GetInfo | ( | ) |
Get voting UI representation.
int SCR_VotingBase.GetJoinServerVoteCooldown | ( | ) |
float SCR_VotingBase.GetLocalCooldownTimeStamp | ( | ) |
int SCR_VotingBase.GetLocalVote | ( | ) |
Get local vote.
It is purely informative and does not affect voting outcome!
int SCR_VotingBase.GetPlayerCount | ( | ) |
Get total player count of players that are valid to vote for the issue.
Implemented in SCR_VotingEditorOut, and SCR_VotingKick.
int SCR_VotingBase.GetPlayerVote | ( | int | playerID | ) |
float SCR_VotingBase.GetRemainingDuration | ( | ) |
int SCR_VotingBase.GetServerRuntimeIgnoreJoinServerCooldown | ( | ) |
EVotingType SCR_VotingBase.GetType | ( | ) |
Get voting type.
EVotingType SCR_VotingBase.GetValue | ( | ) |
Get voting value.
Applicable only if the voting targets specific value, e.g., is referendum about certain outcome.
Implemented in SCR_VotingReferendum.
string SCR_VotingBase.GetValueName | ( | int | value | ) |
Get name of the value.
[in] | value |
int SCR_VotingBase.GetVoteCooldownTime | ( | ) |
int SCR_VotingBase.GetVoteCountRequired | ( | ) |
Get total players needed to make sure the vote is successfull.
int SCR_VotingBase.GetWinner | ( | ) |
Get winner of the vote.
Implemented in SCR_VotingReferendum, and SCR_VotingElection.
bool SCR_VotingBase.HasCooldown | ( | ) |
bool SCR_VotingBase.HasInitiatedVotingLocallyOnce | ( | ) |
void SCR_VotingBase.InitFromTemplate | ( | SCR_VotingBase | template, |
int | value, | ||
float | remainingDuration | ||
) |
Initialise voting from given template.
[in] | template | Source template |
[in] | value | Target value |
[in] | remainingDuration | Remaining time until the voting ends in seconds (-1 to use default) |
Implemented in SCR_VotingReferendum, SCR_VotingEditorIn, and SCR_VotingKick.
bool SCR_VotingBase.IsAvailable | ( | int | value, |
bool | isOngoing | ||
) |
Check if the voting is available in the current world.
[in] | value | Potential voting value |
[in] | isOngoing | True if the voting was already initiated |
Implemented in SCR_VotingAdmin, SCR_VotingAutoKick, SCR_VotingEditorIn, SCR_VotingEditorOut, SCR_VotingEditorWithdraw, and SCR_VotingKick.
bool SCR_VotingBase.IsMatching | ( | EVotingType | type, |
int | value = DEFAULT_VALUE |
||
) |
Check if the voting is matching given params.
[in] | type | Voting type |
[in] | value | Voting value |
Implemented in SCR_VotingReferendum, and SCR_VotingElection.
bool SCR_VotingBase.IsValuePlayerID | ( | ) |
Check if the voting is about player IDs.
void SCR_VotingBase.Log | ( | ) |
Implemented in SCR_VotingReferendum, and SCR_VotingElection.
void SCR_VotingBase.OnVotingEnd | ( | int | value = DEFAULT_VALUE , |
int | winner = DEFAULT_VALUE |
||
) |
Event called when the voting ends.
[in] | value | Voting value |
[in] | winner | Winning value |
Implemented in SCR_VotingAdmin, SCR_VotingEditorIn, SCR_VotingEditorOut, SCR_VotingEditorWithdraw, and SCR_VotingKick.
bool SCR_VotingBase.RemovePlayerVotedServer | ( | int | playerID | ) |
A player has voted to remove or abstain (server only)
[in] | playerID | Id of player who voted to remove or abstain |
bool SCR_VotingBase.RemoveValue | ( | int | value | ) |
Remove all votes for given value.
[in] | value | Value |
Implemented in SCR_VotingReferendum, and SCR_VotingElection.
bool SCR_VotingBase.RemoveVote | ( | int | playerID | ) |
Remove vote of given player.
[in] | playerID | Player ID |
Implemented in SCR_VotingReferendum, and SCR_VotingElection.
void SCR_VotingBase.RemoveVoteLocal | ( | ) |
Remove local vote.
It is purely informative and does not affect voting outcome!
void SCR_VotingBase.SetCurrentVoteCount | ( | int | currentVoteCount | ) |
Set the current amount of votes this vote has.
[in] | currentVoteCount | New current vote amount |
void SCR_VotingBase.SetHasInitiatedVotingLocallyOnce | ( | ) |
Set Has initiated voting locally at least once to true.
void SCR_VotingBase.SetLocalCooldownTimeStamp | ( | float | newTimeStamp | ) |
Set the time stamp for cooldowns for this voting param[in] New Time stamp to set.
void SCR_VotingBase.SetVote | ( | int | playerID, |
int | value = DEFAULT_VALUE |
||
) |
Set vote of given player.
[in] | playerID | Player ID |
[in] | value | Cast vote |
Implemented in SCR_VotingReferendum, and SCR_VotingElection.
void SCR_VotingBase.SetVoteLocal | ( | int | value | ) |
Save local vote.
It's purely informative, does not affect voting outcome!
[in] | value | Voted value |
void SCR_VotingBase.Update | ( | float | timeSlice | ) |
Periodically update the voting.
[in] | timeSlice | Time since the last update |
|
static |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |