Example #1
0
        private int MakeRoomHelper(int userId, int startingCheap)
        {
            IUser user = _userService.GetUserById(userId);

            if (user != null)
            {
                int roomId = _gameService.CreateNewRoom(userId, startingCheap, true, GameMode.NoLimit, 2, 8, 0, 10);
                if (roomId >= 0)
                {
                    return(roomId);
                }
            }
            return(-1);
        }
Example #2
0
        public ResponeCommMessage HandleEvent(CreateNewRoomMessage msg)
        {
            if (_sessionIdHandler != null)
            {
                int roomId = _gameService.CreateNewRoom(msg.UserId, msg._chipPolicy,
                                                        msg._canSpectate, msg._mode, msg._minPlayer, msg._maxPlayers,
                                                        msg._buyInPolicy, msg._minBet);
                var success = roomId != -1;

                CreateNewGameResponse respons;
                if (success)
                {
                    List <string> names = new List <string>();
                    IUser         user  = _userService.GetUserById(msg.UserId);
                    names.Add(user.MemberName());
                    var gameData = new GameDataCommMessage(msg.UserId, roomId, _sessionIdHandler.GetSessionIdByUserId(msg.UserId), null, null, new List <Card>(),
                                                           msg._chipPolicy, 0, names, new List <string>(), null, null, null, true,
                                                           "", "", 0, CommunicationMessage.ActionType.CreateRoom, GameRoom.HandStep.PreFlop.ToString(), "");
                    respons = new CreateNewGameResponse(msg.UserId, _sessionIdHandler.GetSessionIdByUserId(msg.UserId), success, msg, gameData);
                }
                else
                {
                    respons = new CreateNewGameResponse();
                }
                return(respons);
            }
            return(new ResponeCommMessage(msg.UserId, msg.SessionId, false, msg));
        }