Esempio n. 1
0
        private static void Bet(ClientInfo client, JObject jsonObject)
        {
            var gameIdToken      = jsonObject["gameId"];
            var playerIndexToken = jsonObject["playerIndex"];
            var coinsToken       = jsonObject["coins"];

            if (((gameIdToken == null) || (gameIdToken.Type != JTokenType.Integer)) ||
                ((playerIndexToken == null) || (playerIndexToken.Type != JTokenType.Integer)) ||
                ((coinsToken == null) || (coinsToken.Type != JTokenType.Integer)))
            {
                throw new ArgumentException("Error: Parameters Mismatch at Raise.");
            }

            var gameId      = (int)gameIdToken;
            var playerIndex = (int)playerIndexToken;
            var coins       = (int)coinsToken;

            Console.WriteLine("Bet. parameters are: gameId: {0}, playerIndex: {1}, coins: {2}", gameId, playerIndex, coins);

            SendMessage(client, new { response = sl.Bet(gameId, playerIndex, coins) });
        }