예제 #1
0
        public void SetPlayers(List<StatePlayer> players)
        {
            this.players.Clear();

            foreach (var player in players) {
                var playerObject = new Player(player.username, player.username == playingAs, player.seatNumber);
                playerObject.Balance = player.balance;
                this.players.Add(playerObject);
            }
        }
예제 #2
0
 void GettingPlayersParser(string line)
 {
     var match = playerRegex.Match(line);
     if (match.Success) {
         var name = match.Value.Replace(" : [", "");
         Player player;
         if (name == playingAs) {
             player = new Player(name, true);
             player.Cards = ExtractCards(line);
         }
         else {
             player = new Player(name, false);
         }
         players.Add(player);
     }
     else if (dealerPositionRegex.IsMatch(line)) {
         currentParser = IgnorePostedParser;
     }//else if
 }
예제 #3
0
 public void SetPlayerAction(int seat, Player.Action action)
 {
     var player = players.Find(p => { return p.SeatNumber == seat; });
     player.LastAction = action;
 }
예제 #4
0
        public void sendAction(Player.Action action, string tableId, int amount = 0) {
            Console.WriteLine("Sending action: {0} to table: {1}", action, tableId);
            ClientMessage clientMessage = new ClientMessage();
            clientMessage.messageType = "GAME";
            clientMessage.tableId = tableId;

            switch (action) {
            case Player.Action.Check:
                clientMessage.message.action = "CHECK";
                break;
            case Player.Action.Fold:
                clientMessage.message.action = "FOLD";
                break;
            case Player.Action.Call:
                clientMessage.message.action = "CALL";
                break;
            case Player.Action.Raise:
                clientMessage.message.action = "RAISE";
                clientMessage.message.amount = amount;
                break;
            case Player.Action.Bet:
                clientMessage.message.action = "BET";
                clientMessage.message.amount = amount;
                break;
            case Player.Action.AllIn:
                clientMessage.message.action = "BET";
                clientMessage.message.amount = amount;
                break;
            default:
                break;
            }//switch

            Message message = new Message();
            message.From = xmppClient.Username + "@" + domain;
            message.To = gameDomain;
            message.Body = JsonConvert.SerializeObject(clientMessage);
            
            xmppClient.Send(message);
        }//sendCommand