/// <summary> /// 分牌 /// </summary> /// <param name="client"></param> public void splitCard(ClientPeer client) { SingleExecute.Instance.Execute( delegate() { if (userCache.IsOnline(client) == false) { return; } //必须确保在线 int userId = userCache.GetId(client); SingleRoom room = singleCache.GetRoomByUId(userId); room.SpliteCard(); List <CardDto> cardList = room.GetUserCards(userId); client.Send(OpCode._21Single, _21SingleCode.GET_PCARD_SRES, cardList); if (room.isPlayer21()) //21点 这局结束 { //room.player.SpliteCardListList.Add(cardList); //client.Send(OpCode._21Single, _21SingleCode.OVER_SRES, 1); room.SaveList(1, false); if (room.player.SpliteCardListQueue.Count() > 0) { client.Send(OpCode._21Single, _21SingleCode.SPLIT_PROMST_SRES, 1); //21点牛逼 //room.player.winOrLose.Add(1.5); client.Send(OpCode._21Single, _21SingleCode.SPLIT_CAN_NEXT_SRES, null); } else { gameOver(userId, room, 7); } } else if (cardList[0].Weight == cardList[1].Weight) { BasicStrategyDto basicStrategyDto = new BasicStrategyDto(); basicStrategyDto.dealerCardType = room.getDealerCardType(); basicStrategyDto.playerCardType = room.getPlayerCardType(); basicStrategyDto.realAns = basicStrategy.trueStrategy(basicStrategyDto.dealerCardType, basicStrategyDto.playerCardType); client.Send(OpCode._21Single, _21SingleCode.BASIC_STRATEGY_SRES, basicStrategyDto); client.Send(OpCode._21Single, _21SingleCode.CAN_SPLIT_SRES, null); } else { BasicStrategyDto basicStrategyDto = new BasicStrategyDto(); basicStrategyDto.dealerCardType = room.getDealerCardType(); basicStrategyDto.playerCardType = room.getPlayerCardType(); basicStrategyDto.realAns = basicStrategy.trueStrategy(basicStrategyDto.dealerCardType, basicStrategyDto.playerCardType); client.Send(OpCode._21Single, _21SingleCode.BASIC_STRATEGY_SRES, basicStrategyDto); } }); }