Exemplo n.º 1
0
 private void eventReceived(Client sender, string name, object[] args)
 {
     if (name == "cast_vote" && CurrentVote != null)
     {
         CurrentVote.CastVote(sender, (int)args[0]);
     }
 }
Exemplo n.º 2
0
        private void playerJoin(Client player)
        {
            if (CurrentVote != null && API.getEntitySyncedData(player, "VOTEMANAGER_PLAYER_JOINED") != true)
            {
                CurrentVote.SendVoteToClient(CurrentVote.Type, player);
            }

            API.setEntitySyncedData(player, "VOTEMANAGER_PLAYER_JOINED", true);
        }
Exemplo n.º 3
0
        public VotemanagerEntryPoint()
        {
            API.onClientEventTrigger     += eventReceived;
            API.onPlayerFinishedDownload += playerJoin;
            API.onResourceStop           += () =>
            {
                if (CurrentVote != null)
                {
                    CurrentVote.Dispose();
                }
            };

            API.onResourceStart += () =>
            {
                foreach (var p in API.getAllPlayers())
                {
                    API.setEntitySyncedData(p, "VOTEMANAGER_PLAYER_JOINED", true);
                }
            };

            cr.CrossReference = API;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Called by <see cref="Vote"/> objects when voting ends.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An <see cref="EventArgs"/> object containing the event data.</param>
 private static void VoteEnded(object sender, EventArgs e)
 {
     CurrentVote.Dispose();
     CurrentVote    = null;
     VoteInProgress = false;
 }