void Interrupt(PlayerVoted e)
 {
     if (e.player == player && e.yea != votedYea)
     {
         SetStatus(TaskStatus.Aborted);
     }
 }
Example #2
0
    void Vote(PlayerVoted e)
    {
        Player player = e.player;
        bool   yea    = e.yea;

        if (yea)
        {
            if (!yeaVotes.Contains(player))
            {
                yeaVotes.Add(player);
                PlayerShiftTask shiftYea = new PlayerShiftTask(player, true);
                Services.TaskManager.AddTask(shiftYea);
            }
            if (nayVotes.Contains(player))
            {
                nayVotes.Remove(player);
            }
        }
        else
        {
            if (!nayVotes.Contains(player))
            {
                nayVotes.Add(player);
                PlayerShiftTask shiftNay = new PlayerShiftTask(player, false);
                Services.TaskManager.AddTask(shiftNay);
            }
            if (yeaVotes.Contains(player))
            {
                yeaVotes.Remove(player);
            }
        }
    }
Example #3
0
        protected void ReceivedVote(object sender, PlayerVoted e)
        {
            var player = players.FirstOrDefault(p => p.Id == e.UserId);

            if (player != null)
            {
                player.Vote = e.Vote;
            }

            if (players.All(p => p.Vote != null))
            {
                voteComplete = true;
            }

            StateHasChanged();
        }
Example #4
0
 public async Task Vote(PlayerVoted playerVoted)
 {
     //var currentGame = GetCurrentGame(playerVoted.GameId);
     await Clients.Group(playerVoted.GameId).SendAsync(SignalRConstants.ReceiveVote, playerVoted);
 }