/// <summary>
        /// 根据房间编号设置房间内指定用户的分数
        /// </summary>
        /// <param name="roomId">设置分数的房间</param>
        /// <param name="userInfo">设置分数的玩家</param>
        /// <param name="cardData">按照那张卡牌来设置玩家分数</param>
        /// <param name="setUserScoreCode">设置玩家分数的代码</param>
        public void SetUserScoreByRoomId(int roomId, UserInfo userInfo, string cardData, PasseServiceUserScoreCode userScoreCode)
        {
            if (roomId < 0 || userInfo == null || string.IsNullOrEmpty(cardData))//做参数数据完整校验工作(防止程序抛出异常)
            {
                return;
            }
            RoomInfo tmpRoomInfo = this.GetRoomInfoByRoomId(roomId); //根据房间编号获取房间信息数据
            int      userScore   = 0;                                //临时存储用户分数数据

            switch (userScoreCode)
            {
            case PasseServiceUserScoreCode.底牌:    //按照底牌的方式来设置玩家的分数
            {
                bool isGetUserInfoSuccess = this.roomUserTouchCardScoreDict[tmpRoomInfo].TryGetValue(userInfo, out userScore);
                //如果获取成功,则开始计算分数
                if (isGetUserInfoSuccess)
                {
                    //循环遍历卡牌值得数组
                    foreach (string cardValue in this.cardValues)
                    {
                        if (cardData.Contains(cardValue))        //如果传递过来的卡牌数据中包含卡牌值的话,就计算分数即可
                        {
                            userScore += this.GetScoreByCardValue(cardValue);
                            break;        //这里使用break关键字的用意在于,只进行循环遍历一次,目的是节省性能.
                        }
                        else
                        {
                            continue;
                        }
                    }
                    if (userScore != 0)                                                     //表示计算了一次分数,需要根据用户信息来重新给用户赋分数的值
                    {
                        this.roomUserTouchCardScoreDict[tmpRoomInfo][userInfo] = userScore; //为用户的分数值重新赋值
                    }
                }
            }
            break;

            case PasseServiceUserScoreCode.明牌:    //按照明牌的方式来设置玩家的分数
            {
                bool isGetUserInfoSuccess = this.roomUserClearCardScoreDict[tmpRoomInfo].TryGetValue(userInfo, out userScore);
                //如果获取成功,则开始计算分数
                if (isGetUserInfoSuccess)
                {
                    //循环遍历卡牌值得数组
                    foreach (string cardValue in this.cardValues)
                    {
                        if (cardData.Contains(cardValue))        //如果传递过来的卡牌数据中包含卡牌值的话,就计算分数即可
                        {
                            userScore += this.GetScoreByCardValue(cardValue);
                            break;        //这里使用break关键字的用意在于,只进行循环遍历一次,目的是节省性能.
                        }
                        else
                        {
                            continue;
                        }
                    }
                    if (userScore != 0)                                                     //表示计算了一次分数,需要根据用户信息来重新给用户赋分数的值
                    {
                        this.roomUserClearCardScoreDict[tmpRoomInfo][userInfo] = userScore; //为用户的分数值重新赋值
                    }
                }
            }
            break;
            }
        }
        /// <summary>
        /// 根据房间编号比较房间内的客户端用户分数
        /// </summary>
        /// <param name="roomId">要进行比较的房间</param>
        /// <param name="userScoreCode">用户分数码</param>
        public void CompleteUserScoreByRoomId(int roomId, PasseServiceUserScoreCode userScoreCode)
        {
            RoomInfo tmpRoomInfo = this.GetRoomInfoByRoomId(roomId);

            if (tmpRoomInfo != null)
            {
                UserInfo userInfo     = null;         //存储分数最大的玩家信息数据
                int      maxUserScore = int.MinValue; //存储最大分数
                switch (userScoreCode)
                {
                case PasseServiceUserScoreCode.明牌:    //仅处理比较明牌
                {
                    #region 记录玩家的明牌分数
                    //这里遍历明牌的玩家分数数据字典
                    foreach (KeyValuePair <UserInfo, int> userItem in this.roomUserClearCardScoreDict[tmpRoomInfo])
                    {
                        int tmpUserScore = userItem.Value;
                        userInfo = userItem.Key;
                        //判断用户存不存在
                        if (!userScoreDict.ContainsKey(userInfo))      //不存在
                        {
                            userScoreDict.Add(userInfo, tmpUserScore); //添加
                        }
                        else                                           //存在
                        {
                            userScoreDict[userInfo] = tmpUserScore;    //累加并重新赋值
                        }
                    }
                    #endregion
                }
                break;

                case PasseServiceUserScoreCode.底明牌:    //处理比较底牌 + 明牌
                {
                    #region 记录玩家的底牌分数
                    //这里遍历底牌的玩家分数数据字典
                    foreach (KeyValuePair <UserInfo, int> userItem in this.roomUserTouchCardScoreDict[tmpRoomInfo])
                    {
                        int tmpUserScore = userItem.Value;             //取得当前遍历到的用户分数
                        userInfo = userItem.Key;                       //保存当前遍历到的用户
                                                                       //判断用户存不存在
                        if (!userScoreDict.ContainsKey(userInfo))      //不存在
                        {
                            userScoreDict.Add(userInfo, tmpUserScore); //添加
                        }
                        else                                           //存在
                        {
                            userScoreDict[userInfo] = tmpUserScore;    //累加并重新赋值
                        }
                    }
                    #endregion

                    #region 记录玩家的明牌分数
                    //这里遍历明牌的玩家分数数据字典
                    foreach (KeyValuePair <UserInfo, int> userItem in this.roomUserClearCardScoreDict[tmpRoomInfo])
                    {
                        int tmpUserScore = userItem.Value;
                        userInfo = userItem.Key;
                        //判断用户存不存在
                        if (!userScoreDict.ContainsKey(userInfo))      //不存在
                        {
                            userScoreDict.Add(userInfo, tmpUserScore); //添加
                        }
                        else                                           //存在
                        {
                            userScoreDict[userInfo] = tmpUserScore;    //累加并重新赋值
                        }
                    }
                    #endregion
                }
                break;
                }
                #region 判断谁是最大分数玩家
                //这里遍历存储用户分数的数据字典
                foreach (KeyValuePair <UserInfo, int> userItem in userScoreDict)
                {
                    int tmpScore = userItem.Value;   //取得当前遍历到的玩家分数
                    if (tmpScore > maxUserScore)     //如果大于最大分数
                    {
                        maxUserScore = tmpScore;     //设置最大分数
                        userInfo     = userItem.Key; //设置最大分数的玩家
                    }
                }
                #endregion

                #region 记录最大分数的玩家
                if (!this.roomUserMaxScoreDict.ContainsKey(tmpRoomInfo))//如果不存在房间这个键
                {
                    this.roomUserMaxScoreDict.Add(tmpRoomInfo, new Dictionary <UserInfo, int>()
                    {
                        { userInfo, maxUserScore }
                    });                                                                                                        //添加
                }
                else//存在
                {
                    this.roomUserMaxScoreDict[tmpRoomInfo][userInfo] = maxUserScore;//重新赋值
                }
                #endregion

                #region 显示所有玩家的分数值
                //这里循环遍历 底牌 或者 明牌的分数数据字典都可以,因为存储的玩家都是保持一致的
                foreach (KeyValuePair <UserInfo, int> userItem in this.roomUserClearCardScoreDict[tmpRoomInfo])
                {
                    if (this.userScoreDict.ContainsKey(userItem.Key))//如果存储用户分数的数据字典中存在这个玩家
                    {
                        LogMessage.Instance.SetLogMessage("玩家[ " + userItem.Key.UserName + " ] 当前一共获得了[ " + this.userScoreDict[userItem.Key] + " ]分数~");
                    }
                    else
                    {
                        continue;
                    }
                }
                #endregion

                #region 广播通知每一个客户端对象(告知他们谁的分数最大)
                //消息格式:前边是废话|最大分数,最大分数的玩家座位索引
                string msg = "本轮游戏 [" + userInfo.UserName + "] 获得了胜利.|" + maxUserScore + "," + userInfo.ClientIndex;
                this.message.ChangeMessage(OperationCode.Service, (int)ServiceCode.Passe_GetMaxScoreResponse, msg);
                this.roomCache.BroadcastMessageByRoomId(tmpRoomInfo.Id, this.message);
                Thread.Sleep(1000);
                #endregion
                if (tmpRoomInfo.RoomState != RoomState.Ending)
                {
                    #region 提示玩家下注
                    Thread.Sleep(1000);
                    //Todo:这里提示玩家进行下注操作[客户端接收到下注响应之后,需要进行下注]
                    this.message.ChangeMessage(OperationCode.Service, (int)ServiceCode.Passe_Response, (int)PasseGameCode.BottomPour_Response);
                    ClientPeer maxScoreClinePeer = this.roomCache.GetClientPeerByUserInfo(userInfo);
                    maxScoreClinePeer.OnSendMessage(this.message);//先告诉最大玩家下注
                    #endregion
                }
                else if (tmpRoomInfo.RoomState == RoomState.Ending && userScoreCode == PasseServiceUserScoreCode.底明牌)
                {
                    //msg = "你获得了胜利";
                    //ClientPeer winClientpeer = this.roomCache.GetClientPeerByUserInfo(userInfo);
                    //this.message.ChangeMessage(OperationCode.GameResult, (int)GameResultCode.Game_Success_Response, msg);
                    //winClientpeer.OnSendMessage(this.message);
                    ////给其他玩家广播消息
                    //msg = "你失败了,座位号为 [" + userInfo.ClientIndex + "] 获得了游戏胜利~";
                    //this.message.ChangeMessage(OperationCode.GameResult, (int)GameResultCode.Game_Faild_Response, msg);
                    //this.roomCache.BroadCastMessageByExClient(winClientpeer, tmpRoomInfo.Id, this.message);
                    this.Gameover(tmpRoomInfo, userInfo);
                }
            }
        }