Ejemplo n.º 1
0
        public bool AddAuto(RoomInfo roomInfo, UserInfo userInfo)
        {
            userInfo.Socket = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp);
            Server.GetInstance()._NotifyHandler(NotifyType.Request_Login, userInfo.Socket, userInfo);

            userInfo = Users.GetInstance().FindUser(userInfo.Id);

            if (userInfo == null)
            {
                return(false);
            }

            Random random = new Random();

            if (userInfo.Cash < 1000)
            {
                int cash = random.Next() % 1000 + 500;

                Cash.GetInstance().GiveCash(userInfo.Id, cash);
                Cash.GetInstance().GiveChargeSum(userInfo.Id, cash);
            }

            Server.GetInstance()._NotifyHandler(NotifyType.Request_EnterRoom, userInfo.Socket, roomInfo);

            userInfo.WaitSecond = random.Next() % 30;
            _Autos.Add(userInfo);

            return(true);
        }
Ejemplo n.º 2
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            string userID = textUserId.Text.Trim();

            if (userID.Length == 0)
            {
                MessageBox.Show("请输入会员帐号.");
                return;
            }

            UserInfo userInfo = Database.GetInstance().FindUser(userID);

            if (userInfo == null)
            {
                MessageBox.Show("不准确帐号.");
                return;
            }

            int cash = 0;

            try
            {
                cash = Convert.ToInt32(textMoney.Text);
            }
            catch
            {
            }

            if (cash == 0)
            {
                MessageBox.Show("请准确输入金额.");
                return;
            }

            if (cash < 0 && userInfo.Cash + cash * _envInfo.CashRate < 0)
            {
                string errStr = string.Format("持有缓存已满。当前缓存是{0}", userInfo.Cash);
                MessageBox.Show(errStr);
                return;
            }

            if (Cash.GetInstance().ProcessCharge(userID, cash) == false)
            {
                ErrorInfo errorInfo = BaseInfo.GetError();
                MessageBox.Show(errorInfo.ErrorString);
                return;
            }

            if (cash > 0)
            {
                MessageBox.Show("充电成功");
            }
            else
            {
                MessageBox.Show("兑换成功");
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 3
0
        public override bool PlayerOutTable(BaseInfo baseInfo, UserInfo userInfo)
        {
            BumperCarInfo bumperCarInfo = (BumperCarInfo)_TableInfo;
            int           wChairID      = GetPlayerIndex(userInfo);

            //闲家判断
            if (bumperCarInfo.m_wCurrentBanker != wChairID)
            {
                //变量定义
                int lAllScore = 0;

                //统计成绩
                for (int nAreaIndex = 1; nAreaIndex <= BumperCarDefine.AREA_COUNT; ++nAreaIndex)
                {
                    lAllScore += bumperCarInfo.m_lUserJettonScore[nAreaIndex, wChairID];
                }

                // added by usc at 2014/03/04
                for (int i = 0; i < BumperCarDefine.AREA_COUNT; i++)
                {
                    // deleted by usc at 2014/04/03
                    //bumperCarInfo.m_lAllJettonScore[i + 1] -= bumperCarInfo.m_lUserJettonScore[i + 1, wChairID];
                    bumperCarInfo.m_lUserJettonScore[i + 1, wChairID] = 0;
                }

                if (lAllScore > 0)
                {
                    bumperCarInfo.m_lUserWinScore[wChairID] = -lAllScore;

                    Cash.GetInstance().ProcessGameCash(wChairID, _GameInfo, _TableInfo);
                }

                for (int i = wChairID; i < _TableInfo._Players.Count; i++)
                {
                    for (int k = 0; k < BumperCarDefine.AREA_COUNT; k++)
                    {
                        bumperCarInfo.m_lUserJettonScore[k, i] = bumperCarInfo.m_lUserJettonScore[k, i + 1];
                    }

                    bumperCarInfo.m_lUserRevenue[i]  = bumperCarInfo.m_lUserRevenue[i + 1];
                    bumperCarInfo.m_lUserWinScore[i] = bumperCarInfo.m_lUserWinScore[i + 1];

                    // added by usc at 2014/04/09
                    bumperCarInfo.m_lUserBetScore[i] = bumperCarInfo.m_lUserBetScore[i + 1];
                }
            }

            return(base.PlayerOutTable(baseInfo, userInfo));
        }
Ejemplo n.º 4
0
        public override bool PlayerOutTable(BaseInfo baseInfo, UserInfo userInfo)
        {
            int seaterIndex = GetPlayerIndex(userInfo);

            if (seaterIndex >= 0)
            {
                if (_Rounds[_TableInfo._RoundIndex] is DiceBettingRound)
                {
                    DiceInfo diceInfo = (DiceInfo)_TableInfo;

                    int lAllScore = 0;

                    for (int i = 0; i < 4; i++)
                    {
                        lAllScore += diceInfo.m_lUserScore[seaterIndex, i];
                    }

                    // added by usc at 2014/02/23
                    for (int i = 0; i < 4; i++)
                    {
                        // deleted by usc at 2014/04/03
                        //diceInfo.m_lPlayerBetAll[i] -= diceInfo.m_lUserScore[seaterIndex, i];
                        diceInfo.m_lUserScore[seaterIndex, i] = 0;
                    }

                    if (lAllScore > 0)
                    {
                        diceInfo.m_lUserWinScore[seaterIndex] = -lAllScore;

                        Cash.GetInstance().ProcessGameCash(seaterIndex, _GameInfo, _TableInfo);
                    }

                    for (int i = seaterIndex; i < _TableInfo._Players.Count; i++)
                    {
                        for (int k = 0; k < 4; k++)
                        {
                            diceInfo.m_lUserScore[i, k] = diceInfo.m_lUserScore[i + 1, k];
                        }

                        // added by usc at 2014/04/09
                        diceInfo.m_lUserBetScore[i] = diceInfo.m_lUserBetScore[i + 1];
                    }
                }
            }

            return(base.PlayerOutTable(baseInfo, userInfo));
        }
Ejemplo n.º 5
0
        public override void Start()
        {
            TableInfo tableInfo = (TableInfo)_GameTable.GetTableInfo();

            CheckWinner();

            CheckScore();

            for (int i = 0; i < tableInfo._Players.Count; i++)
            {
                Cash.GetInstance().ProcessGameCash(i, _GameTable._GameInfo, tableInfo);
            }

            _TimerId = TimerID.End;
            _GameTable.AddGameTimer(_TimerId, tableInfo.m_EndingTime);

            base.Start();
        }
Ejemplo n.º 6
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            string userID = textUserId.Text.Trim();

            if (userID.Length == 0)
            {
                MessageBox.Show("请输入会员帐号.");
                return;
            }

            UserInfo userInfo = Database.GetInstance().FindUser(userID);

            if (userInfo == null)
            {
                MessageBox.Show("不准确的帐号.");
                return;
            }

            int cash = 0;

            try
            {
                cash = Convert.ToInt32(textMoney.Text);
            }
            catch
            {
            }

            if (cash == 0)
            {
                MessageBox.Show("请准确输入积分金额.");
                return;
            }

            if (Cash.GetInstance().ProcessPoint(userID, cash) == false)
            {
                ErrorInfo errorInfo = BaseInfo.GetError();
                MessageBox.Show(errorInfo.ErrorString);
                return;
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 7
0
        public override bool PlayerOutTable(BaseInfo baseInfo, UserInfo userInfo)
        {
            int seaterIndex = GetPlayerIndex(userInfo);

            if (seaterIndex >= 0)
            {
                if (_Rounds[_TableInfo._RoundIndex] is SicboBettingRound)
                {
                    SicboInfo sicboInfo = (SicboInfo)_TableInfo;

                    int lAllScore = 0;

                    for (int i = 0; i < SicboDefine.COUNT_AZIMUTH; i++)
                    {
                        lAllScore += sicboInfo.m_lUserScore[i, seaterIndex];
                    }

                    if (lAllScore > 0)
                    {
                        sicboInfo.m_lUserWinScore[seaterIndex] = -lAllScore;
                        Cash.GetInstance().ProcessGameCash(seaterIndex, _GameInfo, _TableInfo);

                        sicboInfo.m_lUserWinScore[seaterIndex] = 0;
                    }

                    for (int i = seaterIndex; i < _TableInfo._Players.Count; i++)
                    {
                        for (int k = 0; k < SicboDefine.COUNT_AZIMUTH; k++)
                        {
                            sicboInfo.m_lUserScore[k, i] = sicboInfo.m_lUserScore[k, i + 1];
                        }
                    }
                }
            }

            return(base.PlayerOutTable(baseInfo, userInfo));
        }
Ejemplo n.º 8
0
        public void NotifyOccured(NotifyType notifyType, Socket socket, BaseInfo baseInfo)
        {
            Database database = Database.GetInstance();
            Server   server   = Server.GetInstance();
            Users    users    = Users.GetInstance();

            ResultInfo resultInfo = new ResultInfo();

            switch (notifyType)
            {
            case NotifyType.Request_EnterMeeting:
            {
                UserInfo userInfo = Users.GetInstance().FindUser(socket);

                if (userInfo == null)
                {
                    SetError(ErrorType.Unknown_User, "알수 없는 사용자입니다.");
                    Main.ReplyError(socket);
                    return;
                }

                AskChatInfo askChatInfo = (AskChatInfo)baseInfo;

                UserInfo targetInfo = Users.GetInstance().FindUser(askChatInfo.TargetId);

                if (targetInfo == null)
                {
                    SetError(ErrorType.Unknown_User, "채팅대상이 존재하지 않습니다.");
                    Main.ReplyError(socket);
                    return;
                }

                askChatInfo.TargetId = userInfo.Id;
                server.Send(targetInfo.Socket, NotifyType.Request_EnterMeeting, askChatInfo);
            }
            break;

            case NotifyType.Reply_EnterMeeting:
            {
                AskChatInfo askChatInfo = (AskChatInfo)baseInfo;

                UserInfo targetInfo = Users.GetInstance().FindUser(askChatInfo.TargetId);

                if (targetInfo == null)
                {
                    SetError(ErrorType.Unknown_User, "채팅대상이 존재하지 않습니다.");
                    Main.ReplyError(socket);
                    return;
                }

                if (askChatInfo.Agree == 0)
                {
                    server.Send(targetInfo.Socket, NotifyType.Reply_EnterMeeting, askChatInfo);
                    return;
                }

                RoomInfo meetingInfo = EnterMeeting(socket, askChatInfo);

                if (meetingInfo == null)
                {
                    Main.ReplyError(socket);
                    return;
                }
            }
            break;

            case NotifyType.Request_OutMeeting:
            {
                RoomInfo roomInfo = (RoomInfo)baseInfo;
                UserInfo userInfo = OutMeeting(socket, roomInfo);

                if (userInfo == null)
                {
                    Main.ReplyError(socket);
                }
            }
            break;

            case NotifyType.Request_RoomList:
            {
                UserInfo userInfo = Users.GetInstance().FindUser(socket);

                if (userInfo == null)
                {
                    SetError(ErrorType.Unknown_User, "알수 없는 사용자가 방목록을 요구하였습니다.");
                    Main.ReplyError(socket);
                    return;
                }


                List <RoomInfo> rooms = null;

                if (userInfo.Kind == (int)UserKind.ServiceWoman)
                {
                    rooms = database.GetAllRooms();
                }
                else
                {
                    rooms = GetRooms();
                }

                if (rooms == null)
                {
                    Main.ReplyError(socket);
                    return;
                }

                RoomListInfo roomListInfo = new RoomListInfo();
                roomListInfo.Rooms = rooms;

                server.Send(socket, NotifyType.Reply_RoomList, roomListInfo);
            }
            break;

            case NotifyType.Request_MakeRoom:
            {
                RoomInfo roomInfo = (RoomInfo)baseInfo;

                UserInfo userInfo = users.FindUser(socket);

                if (userInfo == null)
                {
                    Main.ReplyError(socket);
                    return;
                }

                roomInfo.Owner = userInfo.Id;

                if (database.AddRoom(roomInfo) == false)
                {
                    Main.ReplyError(socket);
                    return;
                }

                string str = string.Format("{0} 님이 방 {1} 을 만들었습니다.", userInfo.Id, roomInfo.Id);
                LogView.AddLogString(str);

                server.Send(socket, NotifyType.Reply_MakeRoom, roomInfo);
                View._isUpdateRoomList = true;

                ReplyRoomList();
            }
            break;

            case NotifyType.Request_UpdateRoom:
            {
                RoomInfo updateInfo = (RoomInfo)baseInfo;

                RoomInfo roomInfo = Database.GetInstance().FindRoom(updateInfo.Id);

                if (roomInfo == null)
                {
                    Main.ReplyError(socket);
                    return;
                }

                roomInfo.Body = updateInfo;

                if (Database.GetInstance().UpdateRoom(roomInfo) == false)
                {
                    Main.ReplyError(socket);
                    return;
                }
                server.Send(socket, NotifyType.Reply_UpdateRoom, roomInfo);
            }
            break;

            case NotifyType.Request_DelRoom:
            {
                RoomInfo delInfo = (RoomInfo)baseInfo;

                if (FindRoom(delInfo.Id) != null)
                {
                    SetError(ErrorType.Live_Room, "유저들이 들어있는 방입니다.");
                    Main.ReplyError(socket);
                    return;
                }

                if (Database.GetInstance().FindRoom(delInfo.Id) == null)
                {
                    SetError(ErrorType.Invalid_RoomId, "삭제하려는 방이 없습니다.");
                    Main.ReplyError(socket);
                    return;
                }

                if (Database.GetInstance().DelRoom(delInfo.Id) == false)
                {
                    Main.ReplyError(socket);
                    return;
                }
                server.Send(socket, NotifyType.Reply_DelRoom, delInfo);
            }
            break;

            case NotifyType.Request_EnterRoom:
            {
                OutRoom(socket);

                RoomInfo enterInfo = (RoomInfo)baseInfo;

                UserInfo userInfo = EnterRoom(socket, enterInfo.Id);

                if (userInfo == null)
                {
                    Main.ReplyError(socket);
                    return;
                }
            }
            break;

            case NotifyType.Request_RoomInfo:
            {
                RoomInfo enterInfo = (RoomInfo)baseInfo;

                UserInfo userInfo = Users.GetInstance().FindUser(socket);

                if (userInfo == null)
                {
                    Main.ReplyError(socket);
                    return;
                }

                //RoomInfo roomInfo = FindRoom(userInfo.RoomId);
                RoomInfo roomInfo = FindRoom(enterInfo.Id);

                if (roomInfo == null)
                {
                    //roomInfo = FindMeeting(userInfo.RoomId);
                    roomInfo = FindMeeting(enterInfo.Id);
                }

                if (roomInfo == null)
                {
                    Main.ReplyError(socket);
                    return;
                }

                roomInfo.Cash = enterInfo.Cash;

                BroadCast(enterInfo.Id, NotifyType.Reply_RoomInfo, enterInfo, null);

                ReplyRoomList();
            }
            break;

            case NotifyType.Request_RoomPrice:
            {
                UserInfo userInfo = Users.GetInstance().FindUser(socket);

                if (userInfo == null)
                {
                    Main.ReplyError(socket);
                    return;
                }

                RoomInfo replyInfo = (RoomInfo)baseInfo;

                bool     bMeeting = false;
                RoomInfo roomInfo = Chat.GetInstance().FindRoom(replyInfo.Id);

                if (roomInfo == null)
                {
                    roomInfo = Chat.GetInstance().FindMeeting(replyInfo.Id);
                    bMeeting = true;
                }

                if (roomInfo == null)
                {
                    BaseInfo.SetError(ErrorType.Unknown_User, "알수 없는 사용자가 선물하려고 합니다.");
                    Main.ReplyError(socket);
                    return;
                }

                if (Cash.GetInstance().ProcessChatCash(userInfo, roomInfo, bMeeting) == false)
                {
                    Main.ReplyError(socket);
                    return;
                }

                userInfo.WaitSecond = -1;
                userInfo.CashTime   = DateTime.Now.AddMinutes(1);
                //BroadCast(roomPrice.RoomId, NotifyType.Reply_RoomPrice, roomPrice, null);
            }
            break;

            case NotifyType.Request_OutRoom:
            {
                if (OutRoom(socket) == null)
                {
                    Main.ReplyError(socket);
                    break;
                }
            }
            break;

            case NotifyType.Request_RoomDetail:
            {
                RoomInfo roomInfo = (RoomInfo)baseInfo;

                ReplyRoomDetailInfo(roomInfo.Id);
            }
            break;

            case NotifyType.Request_StringChat:
            {
                StringInfo stringInfo = (StringInfo)baseInfo;

                UserInfo userInfo = users.FindUser(socket);

                if (userInfo == null)
                {
                    BaseInfo.SetError(ErrorType.Unknown_User, "알수 없는 사용자가 채팅하려고 합니다.");
                    Main.ReplyError(socket);
                    return;
                }

                stringInfo.UserId = userInfo.Id;

                //BroadCast(userInfo.RoomId, NotifyType.Reply_StringChat, stringInfo, null );
                BroadCast(stringInfo.strRoomID, NotifyType.Reply_StringChat, stringInfo, stringInfo.UserId);
            }
            break;

            case NotifyType.Request_SendIP:
            {
                AVMsg avMsg = (AVMsg)baseInfo;

                UserInfo userInfo = users.FindUser(socket);

                if (userInfo == null)
                {
                    BaseInfo.SetError(ErrorType.Unknown_User, "알수 없는 사용자가 채팅하려고 합니다.");
                    Main.ReplyError(socket);
                    return;
                }

                BroadCast(avMsg._strRoomID, NotifyType.Reply_SendIP, avMsg, userInfo.Id);
            }
            break;

            case NotifyType.Request_VideoInfo:
            {
                AVMsg avMsg = (AVMsg)baseInfo;

                UserInfo userInfo = users.FindUser(socket);

                if (userInfo == null)
                {
                    BaseInfo.SetError(ErrorType.Unknown_User, "알수 없는 사용자가 채팅하려고 합니다.");
                    Main.ReplyError(socket);
                    return;
                }

                BroadCast(avMsg._strRoomID, NotifyType.Reply_VideoInfo, avMsg, userInfo.Id);
            }
            break;

            case NotifyType.Request_VoiceChat:
            {
                VoiceInfo voiceInfo = (VoiceInfo)baseInfo;

                UserInfo userInfo = users.FindUser(socket);

                if (userInfo == null)
                {
                    BaseInfo.SetError(ErrorType.Unknown_User, "알수 없는 사용자가 채팅하려고 합니다.");
                    Main.ReplyError(socket);
                    return;
                }

                voiceInfo.UserId = userInfo.Id;

                BroadCast(userInfo.RoomId, NotifyType.Reply_VoiceChat, voiceInfo, userInfo.Id);
            }
            break;

            case NotifyType.Request_VideoChat:
            {
                VideoInfo videoInfo = (VideoInfo)baseInfo;

                UserInfo userInfo = users.FindUser(socket);

                if (userInfo == null)
                {
                    BaseInfo.SetError(ErrorType.Unknown_User, "알수 없는 사용자가 채팅하려고 합니다.");
                    Main.ReplyError(socket);
                    return;
                }

                videoInfo.UserId = userInfo.Id;

                BroadCast(userInfo.RoomId, NotifyType.Reply_VideoChat, videoInfo, userInfo.Id);
            }
            break;

            case NotifyType.Request_Give:
            {
                UserInfo userInfo = users.FindUser(socket);

                if (userInfo == null)
                {
                    BaseInfo.SetError(ErrorType.Unknown_User, "알수 없는 사용자가 선물하려고 합니다.");
                    Main.ReplyError(socket);
                    return;
                }

                PresentHistoryInfo presentInfo = (PresentHistoryInfo)baseInfo;
                presentInfo.SendId = userInfo.Id;

                UserInfo targetInfo = database.FindUser(presentInfo.ReceiveId);

                if (targetInfo == null)
                {
                    BaseInfo.SetError(ErrorType.Unknown_User, "받으려는 사용자정보가 정확치 않습니다.");
                    Main.ReplyError(socket);
                    return;
                }

                if (Cash.GetInstance().ProcessPresent(presentInfo) == false)
                {
                    Main.ReplyError(socket);
                    return;
                }

                //BroadCast(userInfo.RoomId, NotifyType.Reply_Give, baseInfo, null);
                BroadCast(presentInfo.strRoomID, NotifyType.Reply_Give, baseInfo, null);

                //ReplyRoomDetailInfo(userInfo.RoomId);

                users.ReplyUserList(null);

                View._isUpdateUserList = true;
            }
            break;

            case NotifyType.Request_MusiceInfo:
            {
                UserInfo userInfo = users.FindUser(socket);

                if (userInfo == null)
                {
                    BaseInfo.SetError(ErrorType.Unknown_User, "不明会员准备删除过照片信息.");
                    Main.ReplyError(socket);
                    return;
                }

                MusiceInfo musiceInfo = (MusiceInfo)baseInfo;

                BroadCast(userInfo.RoomId, NotifyType.Reply_MusiceInfo, musiceInfo, null);
                //server.Send(socket, NotifyType.Reply_MusiceInfo, musiceInfo);
            }
            break;

            case NotifyType.Request_MusiceStateInfo:
            {
                UserInfo userInfo = users.FindUser(socket);

                if (userInfo == null)
                {
                    BaseInfo.SetError(ErrorType.Unknown_User, "不明会员准备删除过照片信息.");
                    Main.ReplyError(socket);
                    return;
                }

                MusiceStateInfo musiceStateInfo = (MusiceStateInfo)baseInfo;

                BroadCast(userInfo.RoomId, NotifyType.Reply_MusiceStateInfo, musiceStateInfo, null);
                //server.Send(socket, NotifyType.Reply_MusiceStateInfo, musiceStateInfo);
            }
            break;
            }
        }
Ejemplo n.º 9
0
        bool OnUserGiveUp(UserInfo userInfo, AddScoreInfo giveInfo)
        {
            int wChairID = ((DzCardTable)_GameTable).GetSeatterIndex(userInfo);

            if (wChairID == GameDefine.INVALID_CHAIR)
            {
                return(true);
            }

            DzCardInfo dzCardInfo = (DzCardInfo)_GameTable._TableInfo;

            //重置状态
            dzCardInfo.m_cbPlayStatus[wChairID] = false;
            dzCardInfo.m_cbShowHand[wChairID]   = false;

            //发送消息
            AddScoreInfo GiveUp = giveInfo;

            GiveUp.wAddScoreUser = wChairID;
            GiveUp.lAddLessScore = -dzCardInfo.m_lTotalScore[wChairID];

            _GameTable.BroadCastGame(NotifyType.Reply_GiveUp, GiveUp);

            //写入金币
            //m_pITableFrame->WriteUserScore(wChairID,-m_lTotalScore[wChairID],0,enScoreKind_Lost);
            int playerIndex = _GameTable.GetPlayerIndex(userInfo);

            if (playerIndex >= 0)
            {
                _GameTable._TableInfo.m_lUserWinScore[playerIndex] = -dzCardInfo.m_lTotalScore[wChairID];
                Cash.GetInstance().ProcessGameCash(playerIndex, _GameTable._GameInfo, _GameTable._TableInfo);

                _GameTable._TableInfo.m_lUserWinScore[playerIndex] = 0;
            }

            //清空下注
            dzCardInfo.m_lTableScore[wChairID] = 0;

            //人数统计
            int wPlayerCount = 0;

            for (int i = 0; i < DzCardDefine.GAME_PLAYER; i++)
            {
                if (dzCardInfo.m_cbPlayStatus[i] == true)
                {
                    wPlayerCount++;
                }
            }

            //判断结束
            if (wPlayerCount >= 2)
            {
                if (dzCardInfo.m_wCurrentUser == wChairID)
                {
                    OnUserAddScore(wChairID, 0, true);
                }
            }
            else
            {
                //OnEventGameEnd(INVALID_CHAIR, NULL, GER_NO_PLAYER);
                _isEnd = true;
            }

            return(true);
        }
Ejemplo n.º 10
0
        public bool AddAuto(GameInfo gameInfo, UserInfo userInfo, bool bAddMoney)
        {
            userInfo.Socket = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp);
            Server.GetInstance()._NotifyHandler(NotifyType.Request_Login, userInfo.Socket, userInfo);

            userInfo = Users.GetInstance().FindUser(userInfo.Id);

            if (userInfo == null)
            {
                return(false);
            }

            Random random = new Random();

            // added by usc at 2014/03/19
            if (bAddMoney)
            {
                int nGameMoney = 0;

                if (gameInfo.nCashOrPointGame == 0)
                {
                    nGameMoney = userInfo.Cash;
                }
                else
                {
                    nGameMoney = userInfo.Point;
                }

                if (nGameMoney < 10000)
                {
                    int nAddMoney = 15000 + (random.Next() % 100) * 100;

                    Cash.GetInstance().GiveCashOrPoint(userInfo.Id, nAddMoney, gameInfo);

                    if (gameInfo.nCashOrPointGame == 0)
                    {
                        Cash.GetInstance().GiveChargeSum(userInfo.Id, nAddMoney);
                    }
                }
            }

            Server.GetInstance()._NotifyHandler(NotifyType.Request_EnterGame, userInfo.Socket, gameInfo);
            Server.GetInstance()._NotifyHandler(NotifyType.Request_PlayerEnter, userInfo.Socket, userInfo);

            bool bFound = false;

            for (int i = 0; i < _Autos.Count; i++)
            {
                if (_Autos[i].Id == userInfo.Id)
                {
                    bFound = true;
                    break;
                }
            }

            if (!bFound)
            {
                //NicknameInfo nameInfo = Database.GetInstance().GetFreeNicknameInfo();

                //if (nameInfo.IsValid() == false)
                //    return false;

                //userInfo.Nickname = nameInfo.Nickname;
                //Database.GetInstance().UpdateUser(userInfo);

                //nameInfo.AutoId = userInfo.Id;
                //nameInfo.StartTime = DateTime.Now;
                //Database.GetInstance().UpdateNicknameInfo(nameInfo);
                userInfo.WaitSecond = random.Next() % 30;
                _Autos.Add(userInfo);
            }

            return(true);
        }