public ABCard PlayerGetOnePoker(int playerId) { Seat seat = GetSeatByPlayerId(playerId); var player = seat.IPlayer; int opponentId = GetOpponentId(playerId); Seat opponentSeat = GetSeatByPlayerId(opponentId); if (player.AccountNotEnough(ChipInAmount)) { NotifySinglePlayer(WebscoketSendObjs.Alert(player.Id, "账户余额不足"), player.Id); } if (null == seat.PlayOutPokers && null != seat.GetPoker) { return(null); } player.DecutMoney(ChipInAmount); lock (Locker) { if (Poker.RemaindCount > 0) { if (null == seat.PlayOutPokers) { var card = Poker.TackOut(1)[0]; seat.GetPoker = card; seat.CompareResult = null; NotifySinglePlayer(WebscoketSendObjs.FreshGameFace(player.Id), player.Id); return(card); } return(null); } InningeGame.GameOver();//触发游戏结束事件 return(null); } }
/// <summary> /// 满足最大轮次等条件时自动开牌 /// </summary> private void CompareAll() { if (CurrentStage != EStage.Running) { return; } CheckDateTime = DateTime.Now; List <Seat> notGaveupSeats = new List <Seat>(); if (JoinSeats.Count != 0) { CheckDateTime = DateTime.Now; for (int i = 0; i < JoinSeats.Count; i++) { if (JoinSeats[i].IsGaveUp) { continue; } notGaveupSeats.Add(JoinSeats[i]); } WinnerSeat = (notGaveupSeats.OrderByDescending(s => s.Pokers).ToList())[0]; } decimal playerWinAmount = 0; playerWinAmount = SystemTax(playerWinAmount); WinnerSeat.IPlayer.DecutMoney(playerWinAmount); FirstSeat = WinnerSeat;//新庄家 CurrentSeat = WinnerSeat; CurrentStage = EStage.Computed; NotifyRoomPlayers(new FreshGameFace(0)); InningeGame.GameOver(false, false);//触发游戏结束事件 }
/// <summary> /// 玩家获得一张牌 /// </summary> /// <param name="playerId_">玩家Id</param> /// <returns>获得的牌</returns> public ABCard PlayerGetOnePoker(int playerId) { var seat = InningeGame.GetSeatByPlayerId(playerId); var player = seat.IPlayer; var opponentId = GetOpponentId(playerId); var opponentSeat = InningeGame.GetSeatByPlayerId(opponentId); if (player.AccountNotEnough(ChipInAmount)) { Notify?.Invoke(WebscoketSendObjs.Alert(player.Id, "账户余额不足")); } if (seat.GameDateObj["getPokers"].Count > 0) { return(null); } player.DecutMoney(ChipInAmount); if (Poker.RemaindCount > 0) { var card = Poker.TackOut(1)[0]; seat.GameDateObj["getPokers"].Add(card); seat.GameDateObj["compareResult"].Clear(); Notify?.Invoke(WebscoketSendObjs.FreshGameFace(player.Id)); return(card); } InningeGame.GameOver();//触发游戏结束事件 return(null); }
public void Compare(int playerId) { if (CurrentStage != EStage.Running) { return; } Seat seat = (Seat)GetJionSeatByPlayerId(playerId); if (IsNotPassedCheck(seat)) { return; } bool iHadLook = seat.IsLooked; Seat opponetSeat = GetOnlyOpponentSeat(); if (null == opponetSeat) { return; } CheckDateTime = DateTime.Now; decimal chipInAmount = PreSeatAmount; if (iHadLook != PreSeatIsLook) { if (PreSeatIsLook) { chipInAmount = chipInAmount / 2; } else { chipInAmount = chipInAmount * 2; } } if (chipInAmount > LimitAmount) { chipInAmount = LimitAmount; } if (!IsDecutMoneySuccess(seat.IPlayer, chipInAmount)) { return; } AddCurrentTotal(chipInAmount); seat.PreChipInAmount = chipInAmount; seat.PreChipType = EChipinType.Compare; WinnerSeat = GetWinner(seat, opponetSeat); decimal playerWinAmount = 0; playerWinAmount = SystemTax(playerWinAmount); WinnerSeat.IPlayer.DecutMoney(-playerWinAmount); // IsWinnerStage = true;//? FirstSeat = WinnerSeat;//新庄家 CurrentSeat = WinnerSeat; CurrentStage = EStage.Computed; NotifyRoomPlayers(new ChipinAnimation(0, chipInAmount, playerId, EChipinType.Compare)); NotifyRoomPlayers(new FreshGameFace(0)); InningeGame.GameOver(false, false); }
public override void Stoped(object inningeGame, EventArgs e) { // if (!IsChipinClose) { if (CurrentStage == EStage.CanChipIning) { for (int i = 0; i < JoinSeats.Count(); i++) { var seat = JoinSeats[0]; if (seat.IsChipIned) { seat.IPlayer.DecutMoney(-seat.ChipinAmount); } } } InningeGame.GameOver(); base.Stoped(inningeGame, e); }