/// <summary> /// 开始战斗 /// </summary> /// <param name="clientList"></param> /// <param name="roomType"></param> public void StartFight(List <ClientPeer> clientList, int roomType) { SingleExecute.Instance.Exeecute(() => { FightRoom room = fightCache.CreateRoom(clientList); switch (roomType) { case 0: room.bottomStakes = 10; room.topStakes = 100; room.lastPlayerStakes = 10; break; case 1: room.bottomStakes = 20; room.topStakes = 200; room.lastPlayerStakes = 20; break; case 2: room.bottomStakes = 50; room.topStakes = 500; room.lastPlayerStakes = 50; break; default: break; } foreach (var client in clientList) { room.UpdatePlayerStakesSum(client.Id, room.bottomStakes); } // 选择庄家 ClientPeer bankerClient = room.SetBanker(); // 重置位置,排序 room.ResetPosition(bankerClient.Id); // 发牌 room.DealCard(); // 对手牌排序 room.SortAllPlayerCard(); // 获得牌型 room.GetAllPlayerCardType(); room.Broadcast(OpCode.Fight, FightCode.StartFight_BRO, room.playerList); // 转换下注,换到庄家的下一位玩家下注 Turn(bankerClient); }); }
/// <summary> /// 开始战斗 /// </summary> /// <param name="clientList"></param> /// <param name="roomType"></param> public void StartFight(List <ClientPeer> clientList, int roomType) { SingleExecute.Instance.Execute(() => { FightRoom room = fightCache.CreateRoom(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; } //选择庄家 ClientPeer bankerClient = room.SetBanker(); //发牌 room.DealCard(); //对手牌排序 room.SortAllPlayerCard(); //获得牌型 room.GetAllPlayerCardType(); room.Broadcase(OpCode.Fight, FightCode.StartFight_BRO, room.playerList); //转换下注,换到下一个玩家下注 //TODO }); }