/// <summary> /// 下一把 /// </summary> /// <param name="client"></param> public void nextGame(ClientPeer client) { SingleExecute.Instance.Execute( delegate() { if (userCache.IsOnline(client) == false) { return; } //必须确保在线 int userId = userCache.GetId(client); SingleRoom room = singleCache.GetRoomByUId(userId); room.Multiple = 1; if (room.libraryModel.CardQueue.Count() < 12) { room.libraryModel.Init(); client.Send(OpCode._21Single, _21SingleCode.RESHUFF_SRES, null); //重新洗牌,给客户端,让客户端给提示 } //测试,只发俩A //room.TestInitPlayerCards(); room.InitPlayerCards(); //发送给客户端 他自身有什么牌 庄家有什么牌 List <CardDto> cardList = room.GetUserCards(userId); client.Send(OpCode._21Single, _21SingleCode.GET_PCARD_SRES, cardList); client.Send(OpCode._21Single, _21SingleCode.GET_DCARD_SRES, room.DealerCardList); Thread.Sleep(100); //摸到21点,牛逼,游戏结束 if (room.isPlayer21()) //21点 这局结束 { //client.Send(OpCode._21Single, _21SingleCode.OVER_SRES, 1); client.Send(OpCode._21Single, _21SingleCode.NGET_SRES, null); gameOver(userId, room, 1); } //能够分牌了 else if (cardList.Count > 1 && 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); } }); }