Exemple #1
0
        private void SendWinnerSelected(Entities.Game game, Entities.GameRound round,
                                            IEnumerable<Entities.ActiveConnection> connections,
                                            List<Entities.GamePlayer> users)
        {
            Entities.GamePlayer sendToPlayer = null;

            foreach (Entities.ActiveConnection connection in connections)
            {
                sendToPlayer = users.FirstOrDefault(player => player.User.UserId == connection.User_UserId);

                if (sendToPlayer != null)
                {

                    Entities.Models.Game.Board.GameBoard model = GetGameBoardModal(connection, game);

                    Entities.Models.Game.Board.Answers answersModel = new Entities.Models.Game.Board.Answers(true, model.IsCommander, false,
                                                                                               false, false, true, round.GroupedAnswers());

                    //The round history tab repurposed this to be the winner of the round when the page is loaded
                    //so setting this here so that when pushed into the observable array it will look correct
                    round.CardCommander = round.Winner();

                    _hub.Clients.Client(connection.ActiveConnectionID)
                                       .WinnerSelected(answersModel, model, game.IsWaiting(), game.HasWinner(), round);
                }
            }
        }