WebSocketServer.CardServer.RegisterVote C# (CSharp) Method

RegisterVote() public method

Registers a new vote for the specified client, with the specified vote value.
public RegisterVote ( Client c, string vote ) : bool
c Client The client who voted.
vote string The value of the vote.
return bool
        public bool RegisterVote(Client c, string vote)
        {
            if (ActiveRound == null || ActiveRound.Flipped)
            {
                return false;
            }
            if (!CardSet.Default.Cards.Contains(vote))
            {
                return false;
            }
            if (c.Info.IsSpectator)
            {
                return false;
            }

            bool result = ActiveRound.RegisterVote(new Vote() { ClientID = c.Info.ID, ClientName = c.Info.Name, VoteValue = vote });

            CheckVoteCount();

            if(result)
            {
                // If successful, broadcast the new state to the clients.
                BroadcastGameState();
            }
            return result;
        }