/// <summary> /// 开始战斗 /// </summary> /// <param name="clientList"></param> /// <param name="roomType"></param> public void StartFight(List <ClientPeer> clientList, int roomType) { SingleExecute.Instance.Execute(() => { FightRoom room = fightCache.CreatRoom(clientList); switch (roomType) { case 0: room.bottomStakes = 10; room.topStakes = 100; room.lastPlayerStakesCount = 10; break; case 1: room.bottomStakes = 20; room.topStakes = 200; room.lastPlayerStakesCount = 20; break; case 2: room.bottomStakes = 50; room.topStakes = 500; room.lastPlayerStakesCount = 50; break; default: break; } foreach (var client in clientList) { room.UpdatePlayerStakesSum(client.Id, room.bottomStakes); } //选择庄家 ClientPeer bankerClient = room.SetBanker(); //重置位置,排序 room.ResetPosition(bankerClient.Id); //发牌 room.DealCards(); //对手牌排序 room.SortAllPlayerCard(); //获得牌型 room.GetAllPlayerCardType(); room.Broadcast(OpCode.Fight, FightCode.StartFight_BRO, room.playerList); //转换下注,换到庄家下一位玩家下注 Turn(bankerClient); }); }
/// <summary> /// 开始战斗 /// </summary> /// <param name="uIdList"></param> public void StartFight(List <int> uIdList) { SingleExecute.Instance.Execute ( delegate() { //创建战斗房间 FightRoom room = fight.CreatRoom(uIdList); //创建牌 并排序 room.InitPlayerCards(); room.Sort(); //发送给每个客户端 自身有什么牌 foreach (int uId in uIdList) { ClientPeer client = user.GetClientById(uId); List <CardDto> cardList = room.GetPlayerCard(uId); client.Send(OpCode.FIGHT, FightCode.GET_CARD_SRES, cardList); } //发送开始抢地主响应 int firstUserId = room.GetFirstUid(); Brocast(room, OpCode.FIGHT, FightCode.TURN_GRAB__BRO, firstUserId, null); } ); }