Exemple #1
0
        private int SendMessageToPlayer(GameMessageApiModel message, PlayerApiModel player)
        {
            System.Diagnostics.Debug.WriteLine(message.ToDisplay());
            int result = player.SendMessageAsync(message);

            return(result);
        }
Exemple #2
0
        public GameMessageApiModel(PlayerApiModel player)
        {
            PlayerList = new List <PlayerApiModel>();
            HandList   = new List <HandApiModel>();

            PlayerId = player.PlayerId;
            PlayerList.Add(player);
            HandList.Add(player.PlayerHand);
        }
Exemple #3
0
 private bool ScorePlayerHand(PlayerApiModel player)
 {
     if (player.PlayerHand.TotalValue <= 21)
     {
         return(true);
     }
     //busted
     System.Diagnostics.Debug.WriteLine(player.PlayerName + "busted with total value of " + player.PlayerHand.TotalValue);
     return(false);
 }
Exemple #4
0
 public Guid JoinGame(string playername)
 {
     if (players.Count < 3)
     {
         PlayerApiModel p = new PlayerApiModel(playername);
         players.Add(p);
         return(p.PlayerId);
     }
     else
     {
         throw new Exception("Too many men!");
     }
 }
Exemple #5
0
        private void dealCards(PlayerApiModel player, int numberOfCards)
        {
            List <CardApiModel> c = playdeck.Draw(numberOfCards);

            player.giveCards(c);
        }