Пример #1
0
        public JoinNextHandResult JoinNextHand(JoinNextHandRequest request)
        {
            var result = new JoinNextHandResult();

            try
            {
                var player = _cache.RefreshAndGet(
                    Players,
                    request.Player,
                    new PlayerNotFoundException(string.Format("Cannot find player id: {0}, please exit and re-enter the room.", request.Player))
                    );

                var user = _cache.RefreshAndGet(
                    Users,
                    request.UserName,
                    new UserNotFoundException(string.Format("Cannot find user name: {0}, please login to the server again.", request.UserName))
                    );
                UserManager.SecurityCheck(request.SecurityKey, user);

                user.JoinNextHand(player, request.SeatIndex, request.BuyIn);
                result.UserBank = user.UserBank.Money;
                result.Wallet   = player.Wallet.AmountOfMoney;
                result.Success  = true;
            }
            catch (PokerException e)
            {
                result.Success      = false;
                result.ErrorMessage = e.Message;
                Logger.Error(e, this);
            }
            return(result);
        }
Пример #2
0
        public double JoinNextHand(string userName, int key, int?player, int seatIndex, double buyIn, out double wallet)
        {
            JoinNextHandResult result = roomService.JoinNextHand(new JoinNextHandRequest()
            {
                UserName = userName, Player = (int)player, SeatIndex = seatIndex, BuyIn = buyIn, SecurityKey = key
            });

            if (!result.Success.HasValue || !result.Success.Value)
            {
                string e = result.ErrorMessage;
                wallet = 0;
                return(0);
            }
            wallet = result.Wallet;
            return(result.UserBank);
        }
Пример #3
0
        public HttpResponseMessage JoinNextHand(JoinNextHandRequest request)
        {
            var result = new JoinNextHandResult();

            try
            {
                result = service.JoinNextHand(request);
            }
            catch (Exception e)
            {
                result.ErrorMessage = e.Message;
                result.Success      = false;
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, result));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }