예제 #1
0
        /// <summary>
        /// 不要牌
        /// </summary>
        /// <param name="client"></param>
        public void ngetCard(ClientPeer client)
        {
            SingleExecute.Instance.Execute(
                delegate()
            {
                if (userCache.IsOnline(client) == false)
                {
                    return;
                }
                //必须确保在线
                int userId = userCache.GetId(client);

                SingleRoom room = singleCache.GetRoomByUId(userId);

                //client.Send(OpCode._21Single, _21SingleCode.OVER_SRES, whichwin);
                //说明是分牌的
                if (room.player.SplitNum > 1)
                {
                    //room.addWeightAndMulti(1);
                    room.SaveList(3, false);
                    //client.Send(OpCode._21Single, _21SingleCode.SPLIT_PROMST_SRES, whichwin);
                    //先不能判断输赢
                    if (room.player.SpliteCardListQueue.Count() > 0)
                    {
                        client.Send(OpCode._21Single, _21SingleCode.SPLIT_PROMST_SRES, 0);    //随便提示一下

                        client.Send(OpCode._21Single, _21SingleCode.SPLIT_CAN_NEXT_SRES, null);
                    }
                    else
                    {
                        gameOver(userId, room, 7);
                    }
                }
                else
                {
                    client.Send(OpCode._21Single, _21SingleCode.NGET_SRES, null);
                    while (room.GetDealerWeight() < 17)
                    {
                        CardDto dto = room.GetOneDealerCard();
                        client.Send(OpCode._21Single, _21SingleCode.ADD_DCARD_SRES, dto);
                    }

                    int whichwin = room.whichWin();
                    gameOver(userId, room, whichwin);
                }
            });
        }
예제 #2
0
        /// <summary>
        /// 加倍
        /// </summary>
        /// <param name="client"></param>
        public void doubleCard(ClientPeer client)
        {
            SingleExecute.Instance.Execute(
                delegate()
            {
                if (userCache.IsOnline(client) == false)
                {
                    return;
                }
                //必须确保在线
                int userId = userCache.GetId(client);

                SingleRoom room = singleCache.GetRoomByUId(userId);

                CardDto dto = room.GetOnePlayerCard();
                client.Send(OpCode._21Single, _21SingleCode.GET_SRES, dto);
                //说明是分牌的
                if (room.player.SplitNum > 1)
                {
                    if (room.GetPlayerWeight() > 21)    //闲家爆牌 这局结束
                    {
                        room.SaveList(2, true);
                        client.Send(OpCode._21Single, _21SingleCode.SPLIT_PROMST_SRES, 2);    //闲家爆牌
                        //room.player.SpliteCardListList.Add(room.player.CardList);
                        if (room.player.SpliteCardListQueue.Count() > 0)
                        {
                            //room.player.winOrLose.Add(-2);//加倍的时候爆牌了,所以是-2
                            client.Send(OpCode._21Single, _21SingleCode.SPLIT_CAN_NEXT_SRES, null);
                        }
                        else
                        {
                            gameOver(userId, room, 7);
                        }
                    }
                    else
                    {
                        //room.addWeightAndMulti(2);
                        room.SaveList(3, true);
                        //client.Send(OpCode._21Single, _21SingleCode.SPLIT_PROMST_SRES, whichwin);
                        //先不能判断输赢
                        if (room.player.SpliteCardListQueue.Count() > 0)
                        {
                            client.Send(OpCode._21Single, _21SingleCode.SPLIT_PROMST_SRES, 0);    //随便提示一下

                            client.Send(OpCode._21Single, _21SingleCode.SPLIT_CAN_NEXT_SRES, null);
                        }
                        else
                        {
                            gameOver(userId, room, 7);
                        }
                    }
                }
                else
                {
                    //设置倍数
                    room.Multiple = 2;
                    if (room.GetPlayerWeight() > 21)    //闲家爆牌 这局结束
                    {
                        //client.Send(OpCode._21Single, _21SingleCode.OVER_SRES, 2);
                        client.Send(OpCode._21Single, _21SingleCode.NGET_SRES, null);
                        gameOver(userId, room, 2);
                    }
                    else
                    {
                        client.Send(OpCode._21Single, _21SingleCode.NGET_SRES, null);
                        while (room.GetDealerWeight() < 17)
                        {
                            CardDto dto2 = room.GetOneDealerCard();
                            client.Send(OpCode._21Single, _21SingleCode.ADD_DCARD_SRES, dto2);
                        }

                        int whichwin = room.whichWin();
                        //client.Send(OpCode._21Single, _21SingleCode.OVER_SRES, whichwin);
                        gameOver(userId, room, whichwin);
                    }
                }
            });
        }